summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-10-18 21:33:25 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-10-18 21:33:25 +0000
commitfe2ed5aaa408e1ab996a9fe1595a05634208a79c (patch)
treee1027fbc9d8a4a8c33f8149b2b42e8cde89c74f6
parent571c782b982d888565e7d06bfc2f3d47582fe829 (diff)
Merge changes between r23946 and r24305 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@24306 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/COPYING39
-rw-r--r--libc/COPYING.LIB84
-rw-r--r--libc/ChangeLog1854
-rw-r--r--libc/INSTALL13
-rw-r--r--libc/Makefile31
-rw-r--r--libc/Makerules37
-rw-r--r--libc/NEWS57
-rw-r--r--libc/README5
-rw-r--r--libc/benchtests/Makefile53
-rw-r--r--libc/benchtests/README38
-rw-r--r--libc/benchtests/acos-inputs3
-rw-r--r--libc/benchtests/acosh-inputs3
-rw-r--r--libc/benchtests/asin-inputs3
-rw-r--r--libc/benchtests/asinh-inputs3
-rw-r--r--libc/benchtests/atan-inputs3
-rw-r--r--libc/benchtests/atanh-inputs3
-rw-r--r--libc/benchtests/bench-sincos.c86
-rw-r--r--libc/benchtests/bench-skeleton.c6
-rw-r--r--libc/benchtests/bench-timing.h14
-rw-r--r--libc/benchtests/cos-inputs3
-rw-r--r--libc/benchtests/cosh-inputs3
-rw-r--r--libc/benchtests/exp-inputs3
-rw-r--r--libc/benchtests/log-inputs3
-rw-r--r--libc/benchtests/pow-inputs3
-rw-r--r--libc/benchtests/rint-inputs3
-rw-r--r--libc/benchtests/sin-inputs3
-rw-r--r--libc/benchtests/sinh-inputs3
-rw-r--r--libc/benchtests/tan-inputs3
-rw-r--r--libc/benchtests/tanh-inputs3
-rw-r--r--libc/config.h.in4
-rwxr-xr-xlibc/configure4
-rw-r--r--libc/configure.in4
-rw-r--r--libc/conform/data/pthread.h-data15
-rw-r--r--libc/conform/data/sched.h-data14
-rw-r--r--libc/csu/init-first.c5
-rw-r--r--libc/csu/libc-start.c16
-rw-r--r--libc/elf/Makefile12
-rw-r--r--libc/elf/cache.c9
-rw-r--r--libc/elf/dl-deps.c1
-rw-r--r--libc/elf/dl-libc.c1
-rw-r--r--libc/elf/dl-support.c6
-rw-r--r--libc/elf/elf.h113
-rw-r--r--libc/elf/ldd.bash.in27
-rw-r--r--libc/elf/tst-ptrguard1-static.c1
-rw-r--r--libc/elf/tst-ptrguard1.c202
-rw-r--r--libc/elf/tst-tls-dlinfo.c2
-rw-r--r--libc/elf/tst-tls1.c2
-rw-r--r--libc/elf/tst-tls10.h1
-rw-r--r--libc/elf/tst-tls14.c2
-rw-r--r--libc/elf/tst-tls2.c2
-rw-r--r--libc/elf/tst-tls3.c2
-rw-r--r--libc/elf/tst-tls4.c2
-rw-r--r--libc/elf/tst-tls5.c2
-rw-r--r--libc/elf/tst-tls6.c1
-rw-r--r--libc/elf/tst-tls7.c1
-rw-r--r--libc/elf/tst-tls8.c1
-rw-r--r--libc/elf/tst-tls9.c1
-rw-r--r--libc/elf/tst-tlsmod1.c2
-rw-r--r--libc/elf/tst-tlsmod13.c2
-rw-r--r--libc/elf/tst-tlsmod13a.c2
-rw-r--r--libc/elf/tst-tlsmod14a.c2
-rw-r--r--libc/elf/tst-tlsmod16a.c2
-rw-r--r--libc/elf/tst-tlsmod16b.c2
-rw-r--r--libc/elf/tst-tlsmod2.c2
-rw-r--r--libc/elf/tst-tlsmod3.c2
-rw-r--r--libc/elf/tst-tlsmod4.c2
-rw-r--r--libc/elf/tst-tlsmod5.c2
-rw-r--r--libc/elf/tst-tlsmod6.c2
-rw-r--r--libc/iconv/iconv_prog.c2
-rw-r--r--libc/include/string.h1
-rw-r--r--libc/inet/inet_net.c22
-rw-r--r--libc/inet/tst-network.c1
-rw-r--r--libc/libio/fileops.c21
-rw-r--r--libc/libio/iofwrite.c10
-rw-r--r--libc/libio/iofwrite_u.c10
-rw-r--r--libc/libio/iopadn.c2
-rw-r--r--libc/libio/iowpadn.c2
-rw-r--r--libc/libio/memstream.c5
-rw-r--r--libc/libio/wmemstream.c6
-rw-r--r--libc/locale/hashval.h2
-rw-r--r--libc/locale/iso-3166.def12
-rw-r--r--libc/locale/iso-639.def17
-rw-r--r--libc/locale/loadlocale.c2
-rw-r--r--libc/locale/localeinfo.h10
-rw-r--r--libc/locale/programs/3level.h4
-rw-r--r--libc/locale/programs/ld-collate.c44
-rw-r--r--libc/locale/programs/ld-ctype.c4
-rw-r--r--libc/locale/programs/localedef.c7
-rw-r--r--libc/locale/programs/locarchive.c427
-rw-r--r--libc/locale/programs/locfile.c7
-rw-r--r--libc/locale/programs/locfile.h22
-rw-r--r--libc/locale/setlocale.c2
-rw-r--r--libc/locale/weight.h16
-rw-r--r--libc/localedata/ChangeLog256
-rw-r--r--libc/localedata/SUPPORTED8
-rw-r--r--libc/localedata/locales/aa_DJ3
-rw-r--r--libc/localedata/locales/aa_ER6
-rw-r--r--libc/localedata/locales/aa_ET3
-rw-r--r--libc/localedata/locales/af_ZA10
-rw-r--r--libc/localedata/locales/ak_GH216
-rw-r--r--libc/localedata/locales/am_ET9
-rw-r--r--libc/localedata/locales/ar_AE6
-rw-r--r--libc/localedata/locales/ar_BH6
-rw-r--r--libc/localedata/locales/ar_DZ6
-rw-r--r--libc/localedata/locales/ar_EG7
-rw-r--r--libc/localedata/locales/ar_IN7
-rw-r--r--libc/localedata/locales/ar_IQ7
-rw-r--r--libc/localedata/locales/ar_JO7
-rw-r--r--libc/localedata/locales/ar_KW7
-rw-r--r--libc/localedata/locales/ar_LB7
-rw-r--r--libc/localedata/locales/ar_LY7
-rw-r--r--libc/localedata/locales/ar_MA7
-rw-r--r--libc/localedata/locales/ar_OM7
-rw-r--r--libc/localedata/locales/ar_QA7
-rw-r--r--libc/localedata/locales/ar_SA7
-rw-r--r--libc/localedata/locales/ar_SD26
-rw-r--r--libc/localedata/locales/ar_SS227
-rw-r--r--libc/localedata/locales/ar_SY7
-rw-r--r--libc/localedata/locales/ar_TN7
-rw-r--r--libc/localedata/locales/ar_YE7
-rw-r--r--libc/localedata/locales/as_IN8
-rw-r--r--libc/localedata/locales/ast_ES15
-rw-r--r--libc/localedata/locales/ayc_PE17
-rw-r--r--libc/localedata/locales/az_AZ7
-rw-r--r--libc/localedata/locales/be_BY7
-rw-r--r--libc/localedata/locales/bem_ZM7
-rw-r--r--libc/localedata/locales/ber_DZ3
-rw-r--r--libc/localedata/locales/ber_MA3
-rw-r--r--libc/localedata/locales/bg_BG1
-rw-r--r--libc/localedata/locales/bho_IN12
-rw-r--r--libc/localedata/locales/bn_BD7
-rw-r--r--libc/localedata/locales/bn_IN7
-rw-r--r--libc/localedata/locales/bo_CN4
-rw-r--r--libc/localedata/locales/bo_IN5
-rw-r--r--libc/localedata/locales/br_FR6
-rw-r--r--libc/localedata/locales/brx_IN13
-rw-r--r--libc/localedata/locales/bs_BA7
-rw-r--r--libc/localedata/locales/byn_ER3
-rw-r--r--libc/localedata/locales/ca_AD8
-rw-r--r--libc/localedata/locales/ca_ES7
-rw-r--r--libc/localedata/locales/ca_FR17
-rw-r--r--libc/localedata/locales/ca_IT17
-rw-r--r--libc/localedata/locales/cmn_TW220
-rw-r--r--libc/localedata/locales/crh_UA6
-rw-r--r--libc/localedata/locales/csb_PL4
-rw-r--r--libc/localedata/locales/cv_RU17
-rw-r--r--libc/localedata/locales/da_DK7
-rw-r--r--libc/localedata/locales/de_AT7
-rw-r--r--libc/localedata/locales/de_BE7
-rw-r--r--libc/localedata/locales/de_CH7
-rw-r--r--libc/localedata/locales/de_DE3
-rw-r--r--libc/localedata/locales/de_LU7
-rw-r--r--libc/localedata/locales/doi_IN12
-rw-r--r--libc/localedata/locales/dv_MV6
-rw-r--r--libc/localedata/locales/dz_BT14
-rw-r--r--libc/localedata/locales/el_CY8
-rw-r--r--libc/localedata/locales/el_GR7
-rw-r--r--libc/localedata/locales/en_AG6
-rw-r--r--libc/localedata/locales/en_AU7
-rw-r--r--libc/localedata/locales/en_BW7
-rw-r--r--libc/localedata/locales/en_CA9
-rw-r--r--libc/localedata/locales/en_DK6
-rw-r--r--libc/localedata/locales/en_GB7
-rw-r--r--libc/localedata/locales/en_HK7
-rw-r--r--libc/localedata/locales/en_IE7
-rw-r--r--libc/localedata/locales/en_IN7
-rw-r--r--libc/localedata/locales/en_NG10
-rw-r--r--libc/localedata/locales/en_NZ7
-rw-r--r--libc/localedata/locales/en_PH7
-rw-r--r--libc/localedata/locales/en_SG7
-rw-r--r--libc/localedata/locales/en_US10
-rw-r--r--libc/localedata/locales/en_ZA12
-rw-r--r--libc/localedata/locales/en_ZM8
-rw-r--r--libc/localedata/locales/en_ZW7
-rw-r--r--libc/localedata/locales/es_AR7
-rw-r--r--libc/localedata/locales/es_BO7
-rw-r--r--libc/localedata/locales/es_CL7
-rw-r--r--libc/localedata/locales/es_CO7
-rw-r--r--libc/localedata/locales/es_CR10
-rw-r--r--libc/localedata/locales/es_CU8
-rw-r--r--libc/localedata/locales/es_DO7
-rw-r--r--libc/localedata/locales/es_EC7
-rw-r--r--libc/localedata/locales/es_ES7
-rw-r--r--libc/localedata/locales/es_GT7
-rw-r--r--libc/localedata/locales/es_HN6
-rw-r--r--libc/localedata/locales/es_MX7
-rw-r--r--libc/localedata/locales/es_NI7
-rw-r--r--libc/localedata/locales/es_PA7
-rw-r--r--libc/localedata/locales/es_PE7
-rw-r--r--libc/localedata/locales/es_PR6
-rw-r--r--libc/localedata/locales/es_PY7
-rw-r--r--libc/localedata/locales/es_SV7
-rw-r--r--libc/localedata/locales/es_US6
-rw-r--r--libc/localedata/locales/es_UY7
-rw-r--r--libc/localedata/locales/es_VE7
-rw-r--r--libc/localedata/locales/eu_ES7
-rw-r--r--libc/localedata/locales/ff_SN6
-rw-r--r--libc/localedata/locales/fil_PH14
-rw-r--r--libc/localedata/locales/fo_FO5
-rw-r--r--libc/localedata/locales/fr_BE7
-rw-r--r--libc/localedata/locales/fr_CA7
-rw-r--r--libc/localedata/locales/fr_CH7
-rw-r--r--libc/localedata/locales/fr_FR7
-rw-r--r--libc/localedata/locales/fr_LU7
-rw-r--r--libc/localedata/locales/fur_IT2
-rw-r--r--libc/localedata/locales/fy_DE9
-rw-r--r--libc/localedata/locales/fy_NL7
-rw-r--r--libc/localedata/locales/ga_IE7
-rw-r--r--libc/localedata/locales/gd_GB246
-rw-r--r--libc/localedata/locales/gez_ER2
-rw-r--r--libc/localedata/locales/gez_ET1
-rw-r--r--libc/localedata/locales/gl_ES7
-rw-r--r--libc/localedata/locales/gu_IN7
-rw-r--r--libc/localedata/locales/gv_GB7
-rw-r--r--libc/localedata/locales/hak_TW219
-rw-r--r--libc/localedata/locales/he_IL7
-rw-r--r--libc/localedata/locales/hi_IN7
-rw-r--r--libc/localedata/locales/hne_IN8
-rw-r--r--libc/localedata/locales/hr_HR5
-rw-r--r--libc/localedata/locales/hsb_DE8
-rw-r--r--libc/localedata/locales/ht_HT4
-rw-r--r--libc/localedata/locales/hu_HU7
-rw-r--r--libc/localedata/locales/hy_AM9
-rw-r--r--libc/localedata/locales/ia_FR10
-rw-r--r--libc/localedata/locales/id_ID7
-rw-r--r--libc/localedata/locales/ig_NG10
-rw-r--r--libc/localedata/locales/ik_CA7
-rw-r--r--libc/localedata/locales/is_IS7
-rw-r--r--libc/localedata/locales/it_CH7
-rw-r--r--libc/localedata/locales/it_IT7
-rw-r--r--libc/localedata/locales/iu_CA9
-rw-r--r--libc/localedata/locales/kl_GL2
-rw-r--r--libc/localedata/locales/kok_IN2
-rw-r--r--libc/localedata/locales/ks_IN3
-rw-r--r--libc/localedata/locales/lij_IT2
-rw-r--r--libc/localedata/locales/lzh_TW254
-rw-r--r--libc/localedata/locales/mag_IN11
-rw-r--r--libc/localedata/locales/mai_IN11
-rw-r--r--libc/localedata/locales/mg_MG2
-rw-r--r--libc/localedata/locales/mhr_RU2
-rw-r--r--libc/localedata/locales/mni_IN9
-rw-r--r--libc/localedata/locales/my_MM2
-rw-r--r--libc/localedata/locales/nan_TW220
-rw-r--r--libc/localedata/locales/nhn_MX12
-rw-r--r--libc/localedata/locales/niu_NZ2
-rw-r--r--libc/localedata/locales/or_IN7
-rw-r--r--libc/localedata/locales/os_RU12
-rw-r--r--libc/localedata/locales/pa_PK2
-rw-r--r--libc/localedata/locales/pap_AN13
-rw-r--r--libc/localedata/locales/pap_AW172
-rw-r--r--libc/localedata/locales/pap_CW172
-rw-r--r--libc/localedata/locales/quz_PE13
-rw-r--r--libc/localedata/locales/rw_RW2
-rw-r--r--libc/localedata/locales/sat_IN11
-rw-r--r--libc/localedata/locales/sc_IT12
-rw-r--r--libc/localedata/locales/sd_IN2
-rw-r--r--libc/localedata/locales/sd_IN@devanagari3
-rw-r--r--libc/localedata/locales/shs_CA2
-rw-r--r--libc/localedata/locales/si_LK6
-rw-r--r--libc/localedata/locales/sid_ET3
-rw-r--r--libc/localedata/locales/sq_MK22
-rw-r--r--libc/localedata/locales/sw_KE2
-rw-r--r--libc/localedata/locales/sw_TZ2
-rw-r--r--libc/localedata/locales/szl_PL12
-rw-r--r--libc/localedata/locales/ta_LK9
-rw-r--r--libc/localedata/locales/ti_ER3
-rw-r--r--libc/localedata/locales/tig_ER3
-rw-r--r--libc/localedata/locales/tl_PH1
-rw-r--r--libc/localedata/locales/ts_ZA2
-rw-r--r--libc/localedata/locales/unm_US18
-rw-r--r--libc/localedata/locales/ur_IN10
-rw-r--r--libc/localedata/locales/wa_BE3
-rw-r--r--libc/localedata/locales/yi_US3
-rw-r--r--libc/malloc/Makefile4
-rw-r--r--libc/malloc/arena.c11
-rw-r--r--libc/malloc/hooks.c11
-rw-r--r--libc/malloc/malloc.c77
-rw-r--r--libc/malloc/tst-memalign.c99
-rw-r--r--libc/malloc/tst-posix_memalign.c108
-rw-r--r--libc/malloc/tst-pvalloc.c99
-rw-r--r--libc/malloc/tst-realloc.c146
-rw-r--r--libc/malloc/tst-valloc.c108
-rw-r--r--libc/manual/Makefile2
-rw-r--r--libc/manual/arith.texi3
-rw-r--r--libc/manual/freemanuals.texi5
-rw-r--r--libc/manual/install.texi13
-rw-r--r--libc/manual/libc.texinfo1
-rw-r--r--libc/manual/probes.texi355
-rw-r--r--libc/manual/socket.texi19
-rw-r--r--libc/manual/string.texi10
-rw-r--r--libc/manual/threads.texi4
-rw-r--r--libc/math/Makefile11
-rw-r--r--libc/math/libm-test.inc37
-rw-r--r--libc/math/test-fpucw-ieee-static.c1
-rw-r--r--libc/math/test-fpucw-ieee.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c)17
-rw-r--r--libc/math/test-fpucw-static.c1
-rw-r--r--libc/math/test-fpucw.c10
-rw-r--r--libc/math/test-misc.c289
-rw-r--r--libc/misc/error.c2
-rw-r--r--libc/misc/swapon.c3
-rw-r--r--libc/nptl/ChangeLog22
-rw-r--r--libc/nptl/pthread_cond_broadcast.c5
-rw-r--r--libc/nptl/pthread_cond_signal.c7
-rw-r--r--libc/nptl/shlib-versions1
-rw-r--r--libc/nptl/sysdeps/pthread/bits/libc-lock.h6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c13
-rw-r--r--libc/nptl/tst-mutex8.c12
-rw-r--r--libc/nscd/aicache.c15
-rw-r--r--libc/nscd/initgrcache.c15
-rw-r--r--libc/nscd/netgroupcache.c4
-rw-r--r--libc/po/zh_TW.po1916
-rw-r--r--libc/ports/ChangeLog4
-rw-r--r--libc/ports/ChangeLog.aarch6414
-rw-r--r--libc/ports/ChangeLog.alpha20
-rw-r--r--libc/ports/ChangeLog.arm49
-rw-r--r--libc/ports/ChangeLog.hppa4
-rw-r--r--libc/ports/ChangeLog.ia645
-rw-r--r--libc/ports/ChangeLog.m68k8
-rw-r--r--libc/ports/ChangeLog.mips124
-rw-r--r--libc/ports/ChangeLog.powerpc42
-rw-r--r--libc/ports/ChangeLog.tile9
-rw-r--r--libc/ports/sysdeps/aarch64/machine-gmon.h15
-rw-r--r--libc/ports/sysdeps/alpha/alphaev67/ffs.S1
-rw-r--r--libc/ports/sysdeps/alpha/ffs.S1
-rw-r--r--libc/ports/sysdeps/arm/__longjmp.S18
-rw-r--r--libc/ports/sysdeps/arm/armv6t2/ffs.S1
-rw-r--r--libc/ports/sysdeps/arm/armv7/multiarch/memcpy_impl.S11
-rw-r--r--libc/ports/sysdeps/arm/bits/atomic.h94
-rw-r--r--libc/ports/sysdeps/arm/include/bits/setjmp.h5
-rw-r--r--libc/ports/sysdeps/arm/jmpbuf-unwind.h13
-rw-r--r--libc/ports/sysdeps/arm/nptl/tls.h4
-rw-r--r--libc/ports/sysdeps/arm/setjmp.S17
-rw-r--r--libc/ports/sysdeps/arm/sysdep.h12
-rw-r--r--libc/ports/sysdeps/ia64/fpu/printf_fphex.c10
-rw-r--r--libc/ports/sysdeps/ia64/stackguard-macros.h3
-rw-r--r--libc/ports/sysdeps/m68k/ffs.c1
-rw-r--r--libc/ports/sysdeps/m68k/start.S21
-rw-r--r--libc/ports/sysdeps/mips/bits/atomic.h2
-rw-r--r--libc/ports/sysdeps/mips/bits/nan.h23
-rw-r--r--libc/ports/sysdeps/mips/configure160
-rw-r--r--libc/ports/sysdeps/mips/configure.in9
-rw-r--r--libc/ports/sysdeps/mips/dl-machine.h14
-rw-r--r--libc/ports/sysdeps/mips/fpu/fegetround.c2
-rw-r--r--libc/ports/sysdeps/mips/fpu/fesetround.c4
-rw-r--r--libc/ports/sysdeps/mips/fpu_control.h33
-rw-r--r--libc/ports/sysdeps/mips/math_private.h114
-rw-r--r--libc/ports/sysdeps/mips/memset.S394
-rw-r--r--libc/ports/sysdeps/mips/mips32/fpu/e_sqrt.c1
-rw-r--r--libc/ports/sysdeps/mips/mips32/fpu/e_sqrtf.c1
-rw-r--r--libc/ports/sysdeps/mips/mips64/memset.S90
-rw-r--r--libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrt.c1
-rw-r--r--libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c1
-rw-r--r--libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrt.c1
-rw-r--r--libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c1
-rw-r--r--libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h18
-rw-r--r--libc/ports/sysdeps/mips/shlib-versions4
-rw-r--r--libc/ports/sysdeps/mips/soft-fp/sfp-machine.h18
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/Makefile8
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile11
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions8
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S107
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S38
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c31
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h2
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c5
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S28
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyint.c5
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyintf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S103
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S43
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/spe.h12
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c700
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix16.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix32.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix64.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix16.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix32.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix64.c27
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/t_sqrt.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/tst-spepim.c493
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrt.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrtf.c1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Makefile4
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Subdirs1
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Versions19
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/sfp-machine.h65
-rw-r--r--libc/ports/sysdeps/powerpc/preconfigure20
-rw-r--r--libc/ports/sysdeps/tile/ffs.c1
-rw-r--r--libc/ports/sysdeps/tile/stackguard-macros.h6
-rw-r--r--libc/ports/sysdeps/unix/alpha/sysdep.h52
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c)25
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h42
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/Makefile90
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/configure171
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/configure.in23
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h26
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c35
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/Implies1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext-extra.S60
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext.S59
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext.S59
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/swapcontext.S60
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libc.abilist2478
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libm.abilist503
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/localplt.data13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/shlib-versions1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/Implies1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/c++-types.data67
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/ld.abilist17
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libBrokenLocale.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libanl.abilist6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libc.abilist2499
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libcrypt.abilist9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libdl.abilist18
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libm.abilist503
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libnsl.abilist127
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libpthread.abilist277
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libresolv.abilist104
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/librt.abilist52
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libthread_db.abilist48
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libutil.abilist8
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/localplt.data31
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/shlib-versions1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data67
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist17
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist18
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist127
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist277
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist104
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist52
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist48
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist8
-rw-r--r--libc/posix/glob.c6
-rw-r--r--libc/resolv/res_send.c2
-rwxr-xr-xlibc/scripts/bench.pl148
-rw-r--r--libc/shlib-versions1
-rw-r--r--libc/soft-fp/adddf3.c15
-rw-r--r--libc/soft-fp/addsf3.c15
-rw-r--r--libc/soft-fp/addtf3.c15
-rw-r--r--libc/soft-fp/divdf3.c15
-rw-r--r--libc/soft-fp/divsf3.c15
-rw-r--r--libc/soft-fp/divtf3.c15
-rw-r--r--libc/soft-fp/double.h398
-rw-r--r--libc/soft-fp/eqdf2.c19
-rw-r--r--libc/soft-fp/eqsf2.c19
-rw-r--r--libc/soft-fp/eqtf2.c19
-rw-r--r--libc/soft-fp/extenddftf2.c17
-rw-r--r--libc/soft-fp/extended.h745
-rw-r--r--libc/soft-fp/extendsfdf2.c17
-rw-r--r--libc/soft-fp/extendsftf2.c17
-rw-r--r--libc/soft-fp/extendxftf2.c53
-rw-r--r--libc/soft-fp/fixdfdi.c10
-rw-r--r--libc/soft-fp/fixdfsi.c10
-rw-r--r--libc/soft-fp/fixdfti.c46
-rw-r--r--libc/soft-fp/fixsfdi.c10
-rw-r--r--libc/soft-fp/fixsfsi.c10
-rw-r--r--libc/soft-fp/fixsfti.c46
-rw-r--r--libc/soft-fp/fixtfdi.c10
-rw-r--r--libc/soft-fp/fixtfsi.c10
-rw-r--r--libc/soft-fp/fixtfti.c46
-rw-r--r--libc/soft-fp/fixunsdfdi.c10
-rw-r--r--libc/soft-fp/fixunsdfsi.c10
-rw-r--r--libc/soft-fp/fixunsdfti.c46
-rw-r--r--libc/soft-fp/fixunssfdi.c10
-rw-r--r--libc/soft-fp/fixunssfsi.c10
-rw-r--r--libc/soft-fp/fixunssfti.c46
-rw-r--r--libc/soft-fp/fixunstfdi.c10
-rw-r--r--libc/soft-fp/fixunstfsi.c10
-rw-r--r--libc/soft-fp/fixunstfti.c46
-rw-r--r--libc/soft-fp/floatdidf.c10
-rw-r--r--libc/soft-fp/floatdisf.c10
-rw-r--r--libc/soft-fp/floatditf.c12
-rw-r--r--libc/soft-fp/floatsidf.c12
-rw-r--r--libc/soft-fp/floatsisf.c10
-rw-r--r--libc/soft-fp/floatsitf.c12
-rw-r--r--libc/soft-fp/floattidf.c46
-rw-r--r--libc/soft-fp/floattisf.c46
-rw-r--r--libc/soft-fp/floattitf.c46
-rw-r--r--libc/soft-fp/floatundidf.c10
-rw-r--r--libc/soft-fp/floatundisf.c10
-rw-r--r--libc/soft-fp/floatunditf.c11
-rw-r--r--libc/soft-fp/floatunsidf.c12
-rw-r--r--libc/soft-fp/floatunsisf.c10
-rw-r--r--libc/soft-fp/floatunsitf.c11
-rw-r--r--libc/soft-fp/floatuntidf.c46
-rw-r--r--libc/soft-fp/floatuntisf.c46
-rw-r--r--libc/soft-fp/floatuntitf.c46
-rw-r--r--libc/soft-fp/fmadf4.c15
-rw-r--r--libc/soft-fp/fmasf4.c15
-rw-r--r--libc/soft-fp/fmatf4.c15
-rw-r--r--libc/soft-fp/gedf2.c19
-rw-r--r--libc/soft-fp/gesf2.c19
-rw-r--r--libc/soft-fp/getf2.c19
-rw-r--r--libc/soft-fp/ledf2.c19
-rw-r--r--libc/soft-fp/lesf2.c19
-rw-r--r--libc/soft-fp/letf2.c19
-rw-r--r--libc/soft-fp/muldf3.c15
-rw-r--r--libc/soft-fp/mulsf3.c15
-rw-r--r--libc/soft-fp/multf3.c15
-rw-r--r--libc/soft-fp/negdf2.c15
-rw-r--r--libc/soft-fp/negsf2.c15
-rw-r--r--libc/soft-fp/negtf2.c15
-rw-r--r--libc/soft-fp/op-1.h419
-rw-r--r--libc/soft-fp/op-2.h987
-rw-r--r--libc/soft-fp/op-4.h1201
-rw-r--r--libc/soft-fp/op-8.h135
-rw-r--r--libc/soft-fp/op-common.h2878
-rw-r--r--libc/soft-fp/quad.h436
-rw-r--r--libc/soft-fp/single.h197
-rw-r--r--libc/soft-fp/soft-fp.h199
-rw-r--r--libc/soft-fp/sqrtdf2.c12
-rw-r--r--libc/soft-fp/sqrtsf2.c12
-rw-r--r--libc/soft-fp/sqrttf2.c12
-rw-r--r--libc/soft-fp/subdf3.c15
-rw-r--r--libc/soft-fp/subsf3.c15
-rw-r--r--libc/soft-fp/subtf3.c15
-rw-r--r--libc/soft-fp/truncdfsf2.c15
-rw-r--r--libc/soft-fp/trunctfdf2.c15
-rw-r--r--libc/soft-fp/trunctfsf2.c15
-rw-r--r--libc/soft-fp/trunctfxf2.c53
-rw-r--r--libc/soft-fp/unorddf2.c17
-rw-r--r--libc/soft-fp/unordsf2.c18
-rw-r--r--libc/soft-fp/unordtf2.c18
-rw-r--r--libc/stdio-common/printf_fp.c3
-rw-r--r--libc/stdio-common/printf_fphex.c14
-rw-r--r--libc/stdio-common/printf_size.c12
-rw-r--r--libc/stdio-common/psiginfo-data.h2
-rw-r--r--libc/stdio-common/tst-long-dbl-fphex.c4
-rw-r--r--libc/stdio-common/vfprintf.c12
-rw-r--r--libc/stdlib/isomac.c1
-rw-r--r--libc/stdlib/strtod_l.c2
-rw-r--r--libc/string/Makefile2
-rw-r--r--libc/string/ffs.c1
-rw-r--r--libc/string/strcoll_l.c273
-rw-r--r--libc/string/test-memcpy.c4
-rw-r--r--libc/string/tester.c6
-rw-r--r--libc/string/tst-strcoll-overflow.c61
-rw-r--r--libc/sunrpc/rpc/types.h5
-rw-r--r--libc/sysdeps/generic/ldconfig.h39
-rw-r--r--libc/sysdeps/generic/math_private.h6
-rw-r--r--libc/sysdeps/generic/stackguard-macros.h8
-rw-r--r--libc/sysdeps/i386/ffs.c1
-rw-r--r--libc/sysdeps/i386/i686/ffs.c1
-rw-r--r--libc/sysdeps/i386/stackguard-macros.h8
-rw-r--r--libc/sysdeps/ieee754/dbl-64/MathLib.h30
-rw-r--r--libc/sysdeps/ieee754/dbl-64/dbl2mpn.c8
-rw-r--r--libc/sysdeps/ieee754/dbl-64/dla.h86
-rw-r--r--libc/sysdeps/ieee754/dbl-64/dosincos.c254
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_acosh.c55
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_atan2.c27
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_cosh.c72
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_exp.c406
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_exp2.c8
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_fmod.c225
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_gamma_r.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_hypot.c157
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_ilogb.c53
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_j0.c394
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_j1.c366
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_jn.c478
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_log.c23
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_log10.c16
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_log2.c28
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_pow.c573
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_rem_pio2.c215
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_remainder.c180
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_sinh.c69
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_sqrt.c95
-rw-r--r--libc/sysdeps/ieee754/dbl-64/halfulp.c129
-rw-r--r--libc/sysdeps/ieee754/dbl-64/k_rem_pio2.c315
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpa-arch.h20
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpa.c29
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpatan.c1
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpn2dbl.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mptan.c1
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mydefs.h9
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_asinh.c54
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_atan.c21
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_cbrt.c19
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_ceil.c91
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_copysign.c13
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_erf.c523
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_expm1.c227
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_fabs.c11
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_finite.c9
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_floor.c91
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_frexp.c37
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_isinf.c10
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_isinf_ns.c6
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_isnan.c15
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_llround.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_log1p.c171
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_logb.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_lrint.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_modf.c84
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_nearbyint.c63
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_remquo.c16
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_rint.c46
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_scalbln.c61
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_scalbn.c61
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_sin.c445
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_sincos.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_tan.c10
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_tanh.c68
-rw-r--r--libc/sysdeps/ieee754/dbl-64/sincos32.c520
-rw-r--r--libc/sysdeps/ieee754/dbl-64/slowexp.c13
-rw-r--r--libc/sysdeps/ieee754/dbl-64/slowpow.c14
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/printf_fphex.c14
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_acosl.c38
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_asinl.c28
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c14
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c6
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c6
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c34
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c125
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c7
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c88
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c16
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c32
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_log10l.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_log2l.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_logl.c32
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c136
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c7
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c18
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c51
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h98
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c12
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/k_tanl.c34
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c46
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h206
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c72
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c42
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c5
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c15
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_cosl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c55
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c12
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_finitel.c12
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c5
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c19
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c15
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c17
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c14
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c7
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c11
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c5
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_modfl.c27
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c62
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c57
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c13
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_remquol.c16
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c21
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c21
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_sinl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_tanl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c26
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/printf_fphex.c8
-rw-r--r--libc/sysdeps/mach/hurd/fork.c15
-rw-r--r--libc/sysdeps/mach/hurd/i386/tls.h1
-rw-r--r--libc/sysdeps/posix/dirstream.h9
-rw-r--r--libc/sysdeps/posix/getaddrinfo.c103
-rw-r--r--libc/sysdeps/powerpc/bits/fenv.h71
-rw-r--r--libc/sysdeps/powerpc/bits/mathinline.h26
-rw-r--r--libc/sysdeps/powerpc/ffs.c1
-rw-r--r--libc/sysdeps/powerpc/fpu/e_sqrt.c2
-rw-r--r--libc/sysdeps/powerpc/fpu/e_sqrtf.c2
-rw-r--r--libc/sysdeps/powerpc/fpu/fclrexcpt.c4
-rw-r--r--libc/sysdeps/powerpc/fpu/fedisblxcpt.c10
-rw-r--r--libc/sysdeps/powerpc/fpu/feenablxcpt.c10
-rw-r--r--libc/sysdeps/powerpc/fpu/fegetexcept.c10
-rw-r--r--libc/sysdeps/powerpc/fpu/feholdexcpt.c5
-rw-r--r--libc/sysdeps/powerpc/fpu/fenv_libc.h2
-rw-r--r--libc/sysdeps/powerpc/fpu/fesetenv.c4
-rw-r--r--libc/sysdeps/powerpc/fpu/feupdateenv.c6
-rw-r--r--libc/sysdeps/powerpc/fpu/fgetexcptflg.c2
-rw-r--r--libc/sysdeps/powerpc/fpu/fraiseexcpt.c12
-rw-r--r--libc/sysdeps/powerpc/fpu/fsetexcptflg.c8
-rw-r--r--libc/sysdeps/powerpc/fpu/ftestexcept.c2
-rw-r--r--libc/sysdeps/powerpc/fpu/libm-test-ulps68
-rw-r--r--libc/sysdeps/powerpc/fpu/s_float_bitwise.h54
-rw-r--r--libc/sysdeps/powerpc/fpu/s_llround.c33
-rw-r--r--libc/sysdeps/powerpc/fpu/s_llroundf.c33
-rw-r--r--libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c87
-rw-r--r--libc/sysdeps/powerpc/fpu_control.h69
-rw-r--r--libc/sysdeps/powerpc/jmpbuf-offsets.h6
-rw-r--r--libc/sysdeps/powerpc/longjmp.c6
-rw-r--r--libc/sysdeps/powerpc/nofpu/Makefile (renamed from libc/ports/sysdeps/powerpc/nofpu/Makefile)6
-rw-r--r--libc/sysdeps/powerpc/nofpu/Subdirs (renamed from libc/ports/sysdeps/powerpc/nofpu/Subdirs)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/Versions (renamed from libc/ports/sysdeps/powerpc/nofpu/Versions)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fclrexcpt.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fedisblxcpt.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fedisblxcpt.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/feenablxcpt.c (renamed from libc/ports/sysdeps/powerpc/nofpu/feenablxcpt.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fegetenv.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fegetenv.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fegetexcept.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fegetexcept.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fegetround.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fegetround.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/feholdexcpt.c (renamed from libc/ports/sysdeps/powerpc/nofpu/feholdexcpt.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fenv_const.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fenv_const.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fenv_libc.h (renamed from libc/ports/sysdeps/powerpc/nofpu/fenv_libc.h)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fesetenv.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fesetenv.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fesetround.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fesetround.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/feupdateenv.c (renamed from libc/ports/sysdeps/powerpc/nofpu/feupdateenv.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fgetexcptflg.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fgetexcptflg.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fraiseexcpt.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fraiseexcpt.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/fsetexcptflg.c (renamed from libc/ports/sysdeps/powerpc/nofpu/fsetexcptflg.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/ftestexcept.c (renamed from libc/ports/sysdeps/powerpc/nofpu/ftestexcept.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/get-rounding-mode.h (renamed from libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/libm-test-ulps (renamed from libc/ports/sysdeps/powerpc/nofpu/libm-test-ulps)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/shlib-versions (renamed from libc/ports/sysdeps/powerpc/nofpu/shlib-versions)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/sim-full.c (renamed from libc/ports/sysdeps/powerpc/nofpu/sim-full.c)0
-rw-r--r--libc/sysdeps/powerpc/nofpu/soft-supp.h (renamed from libc/ports/sysdeps/powerpc/nofpu/soft-supp.h)9
-rw-r--r--libc/sysdeps/powerpc/novmx-longjmp.c12
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/memcmp.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/memcmp.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/memcpy.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/memcpy.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/memset.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/memset.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/strcmp.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/strcmp.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/strcpy.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/strcpy.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/strlen.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/strlen.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/405/strncmp.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/405/strncmp.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/440/Implies (renamed from libc/ports/sysdeps/powerpc/powerpc32/440/Implies)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/464/Implies (renamed from libc/ports/sysdeps/powerpc/powerpc32/464/Implies)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/476/Implies (renamed from libc/ports/sysdeps/powerpc/powerpc32/476/Implies)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/476/memset.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/476/memset.S)0
-rw-r--r--libc/sysdeps/powerpc/powerpc32/Makefile10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/__longjmp-common.S42
-rw-r--r--libc/sysdeps/powerpc/powerpc32/bsd-_setjmp.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/bsd-setjmp.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/dl-machine.c14
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c)10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c39
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c)47
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c)45
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c)9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c)16
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c)3
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c)23
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c)23
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h)36
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c)9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c)3
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c)27
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c42
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c41
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c42
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c41
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fgetexcptflg.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c)8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/fraiseexcept-soft.c)4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c40
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/fsetexcptflg.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c)16
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/ftestexcept.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c)5
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S)9
-rw-r--r--libc/sysdeps/powerpc/powerpc32/e500/nofpu/spe-raise.c (renamed from libc/ports/sysdeps/powerpc/powerpc32/e500/spe-raise.c)47
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/__longjmp.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_copysign.S2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S3
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S73
-rw-r--r--libc/sysdeps/powerpc/powerpc32/fpu/setjmp.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/mcount.c2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S20
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/hp-timing.h21
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/memcmp.S1064
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/memcpy.S58
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/memset.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/strncmp.S56
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/memcpy.S81
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power6/memset.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S5
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S7
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memchr.S185
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memcmp.S1626
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memcpy.S24
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S28
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memrchr.S187
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/memset.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/rawmemchr.S17
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strchr.S51
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strchrnul.S27
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strlen.S17
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strncmp.S55
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/strnlen.S106
-rw-r--r--libc/sysdeps/powerpc/powerpc32/setjmp-common.S41
-rw-r--r--libc/sysdeps/powerpc/powerpc32/setjmp.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc32/stackguard-macros.h10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/stpcpy.S18
-rw-r--r--libc/sysdeps/powerpc/powerpc32/strchr.S71
-rw-r--r--libc/sysdeps/powerpc/powerpc32/strcmp.S42
-rw-r--r--libc/sysdeps/powerpc/powerpc32/strcpy.S18
-rw-r--r--libc/sysdeps/powerpc/powerpc32/strlen.S69
-rw-r--r--libc/sysdeps/powerpc/powerpc32/strncmp.S56
-rw-r--r--libc/sysdeps/powerpc/powerpc64/__longjmp-common.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/dl-machine.h28
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_floorf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_rintf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_roundf.S6
-rw-r--r--libc/sysdeps/powerpc/powerpc64/fpu/s_truncf.S4
-rw-r--r--libc/sysdeps/powerpc/powerpc64/memcpy.S27
-rw-r--r--libc/sysdeps/powerpc/powerpc64/memset.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power4/memcmp.S1041
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power4/memcpy.S61
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power4/memset.S30
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power4/strncmp.S63
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power6/memcpy.S329
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power6/memset.S10
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S6
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S5
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memchr.S188
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memcmp.S1613
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memcpy.S704
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S26
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memrchr.S192
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/memset.S6
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/rawmemchr.S17
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strchr.S43
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strchrnul.S19
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strlen.S17
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strncmp.S61
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power7/strnlen.S111
-rw-r--r--libc/sysdeps/powerpc/powerpc64/setjmp-common.S72
-rw-r--r--libc/sysdeps/powerpc/powerpc64/setjmp.S12
-rw-r--r--libc/sysdeps/powerpc/powerpc64/stackguard-macros.h10
-rw-r--r--libc/sysdeps/powerpc/powerpc64/stpcpy.S18
-rw-r--r--libc/sysdeps/powerpc/powerpc64/strchr.S75
-rw-r--r--libc/sysdeps/powerpc/powerpc64/strcmp.S65
-rw-r--r--libc/sysdeps/powerpc/powerpc64/strcpy.S27
-rw-r--r--libc/sysdeps/powerpc/powerpc64/strlen.S75
-rw-r--r--libc/sysdeps/powerpc/powerpc64/strncmp.S63
-rw-r--r--libc/sysdeps/powerpc/preconfigure11
-rw-r--r--libc/sysdeps/powerpc/soft-fp/sfp-machine.h (renamed from libc/ports/sysdeps/powerpc/soft-fp/sfp-machine.h)64
-rw-r--r--libc/sysdeps/powerpc/sysdep.h15
-rw-r--r--libc/sysdeps/s390/ffs.c1
-rw-r--r--libc/sysdeps/s390/s390-32/stackguard-macros.h11
-rw-r--r--libc/sysdeps/s390/s390-64/stackguard-macros.h14
-rw-r--r--libc/sysdeps/sh/stackguard-macros.h6
-rw-r--r--libc/sysdeps/sparc/fpu/libm-test-ulps125
-rw-r--r--libc/sysdeps/sparc/sparc32/soft-fp/q_neg.c7
-rw-r--r--libc/sysdeps/sparc/sparc32/stackguard-macros.h3
-rw-r--r--libc/sysdeps/sparc/sparc64/stackguard-macros.h3
-rw-r--r--libc/sysdeps/unix/Makefile6
-rw-r--r--libc/sysdeps/unix/make-syscalls.sh2
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/configure2
-rw-r--r--libc/sysdeps/unix/sysv/linux/configure.in2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h54
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies3
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S12
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S8
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext-extra.S)62
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S)2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/c++-types.data)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/ld.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libBrokenLocale.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libanl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libcrypt.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libdl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libnsl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libpthread.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libresolv.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/librt.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libthread_db.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libutil.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data)2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S)2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S (renamed from libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S)2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S12
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S24
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S6
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h1
-rw-r--r--libc/sysdeps/unix/sysv/linux/tst-fanotify.c17
-rw-r--r--libc/sysdeps/x86_64/ffs.c1
-rw-r--r--libc/sysdeps/x86_64/fpu/printf_fphex.c9
-rw-r--r--libc/sysdeps/x86_64/memset.S10
-rw-r--r--libc/sysdeps/x86_64/multiarch/Makefile4
-rw-r--r--libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c7
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcmp-sse4.S84
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcmp-ssse3.S126
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S10
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S86
-rw-r--r--libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S254
-rw-r--r--libc/sysdeps/x86_64/multiarch/strchr.S127
-rw-r--r--libc/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S9
-rw-r--r--libc/sysdeps/x86_64/multiarch/strend-sse4.S48
-rw-r--r--libc/sysdeps/x86_64/multiarch/strrchr-sse2-no-bsf.S555
-rw-r--r--libc/sysdeps/x86_64/multiarch/strrchr.S288
-rw-r--r--libc/sysdeps/x86_64/stackguard-macros.h5
-rw-r--r--libc/sysdeps/x86_64/strchr.S188
-rw-r--r--libc/sysdeps/x86_64/strchrnul.S41
-rw-r--r--libc/sysdeps/x86_64/strrchr.S238
974 files changed, 27963 insertions, 25692 deletions
diff --git a/libc/COPYING b/libc/COPYING
index 5b6e7c66c..d159169d1 100644
--- a/libc/COPYING
+++ b/libc/COPYING
@@ -1,12 +1,12 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
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 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
-
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
+library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
diff --git a/libc/COPYING.LIB b/libc/COPYING.LIB
index cf9b6b997..4362b4915 100644
--- a/libc/COPYING.LIB
+++ b/libc/COPYING.LIB
@@ -1,9 +1,8 @@
-
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -23,8 +22,7 @@ specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
+strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
@@ -57,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
-^L
+
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@@ -89,9 +87,9 @@ libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
@@ -113,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
-^L
+
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -138,8 +136,8 @@ included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
@@ -218,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-^L
+
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -269,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-^L
+
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@@ -305,10 +303,10 @@ of these things:
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
@@ -331,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-^L
+
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -372,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
-^L
+
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -386,10 +384,9 @@ all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
@@ -407,11 +404,11 @@ be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
@@ -425,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-^L
+
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -459,21 +456,19 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-^L
+
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
@@ -490,21 +485,18 @@ notice is found.
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
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
-
-
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 81615fb44..cb3651ac8 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,1855 @@
+2013-10-18 Joseph Myers <joseph@codesourcery.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ * sysdeps/powerpc/powerpc32/e500/nofpu/Makefile: New file.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fgetexcptflg.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fsetexcptflg.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/ftestexcept.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/spe-raise.c: Likewise.
+ * sysdeps/powerpc/preconfigure: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies:
+ Likewise.
+ * sysdeps/powerpc/nofpu/soft-supp.h [__NO_FPRS__ && !_SOFT_FLOAT]:
+ Replace contents of file by #include of <fenv_libc.h>.
+ * sysdeps/powerpc/soft-fp/sfp-machine.h
+ [__NO_FPRS__ && !_SOFT_FLOAT]: Include <fenv_libc.h>, <sysdep.h>
+ and <sys/prctl.h>.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (__feraiseexcept_soft): Declare.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_INEXACT): Define macro.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_INVALID): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_DIVZERO): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_UNDERFLOW): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_OVERFLOW): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FP_DECL_EX): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_INIT_ROUNDMODE): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_INIT_EXCEPTIONS): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_HANDLE_EXCEPTIONS): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_ROUNDMODE): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (FP_TRAPPING_EXCEPTIONS): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data:
+ Allow copysignl PLT reference to be missing.
+
+2013-10-18 Richard Sandiford <richard@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com
+
+ [BZ #15948]
+ * locale/programs/ld-collate.c (new_element): Handle <U0000> as a
+ single character.
+ (add_to_tablewc): Assert sequence of wide characters is nonempty.
+
+2013-10-18 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * elf/tst-tls-dlinfo.c: Don't include tls.h.
+ * elf/tst-tls1.c: Likewise.
+ * elf/tst-tls10.h: Likewise.
+ * elf/tst-tls14.c: Likewise.
+ * elf/tst-tls2.c: Likewise.
+ * elf/tst-tls3.c: Likewise.
+ * elf/tst-tls4.c: Likewise.
+ * elf/tst-tls5.c: Likewise.
+ * elf/tst-tls6.c: Likewise.
+ * elf/tst-tls7.c: Likewise.
+ * elf/tst-tls8.c: Likewise.
+ * elf/tst-tls9.c: Likewise.
+ * elf/tst-tlsmod1.c: Likewise.
+ * elf/tst-tlsmod13.c: Likewise.
+ * elf/tst-tlsmod13a.c: Likewise.
+ * elf/tst-tlsmod14a.c: Likewise.
+ * elf/tst-tlsmod16a.c: Likewise.
+ * elf/tst-tlsmod16b.c: Likewise.
+ * elf/tst-tlsmod2.c: Likewise.
+ * elf/tst-tlsmod3.c: Likewise.
+ * elf/tst-tlsmod4.c: Likewise.
+ * elf/tst-tlsmod5.c: Likewise.
+ * elf/tst-tlsmod6.c: Likewise.
+
+2013-10-18 Ondřej Bílka <neleai@seznam.cz>
+
+ [BZ #12486]
+ * malloc/malloc.c: remove checks for statistics.
+
+2013-10-17 Ondřej Bílka <neleai@seznam.cz>
+
+ [BZ #15277]
+ * inet/inet_net.c (inet_network): Detect additional invalid strings.
+ * inet/tst-network.c: Add testcase.
+
+2013-10-17 Andreas Schwab <schwab@suse.de>
+
+ [BZ #15218]
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use gethostbyaddr
+ to determine canonical name.
+
+2013-10-17 Ondřej Bílka <neleai@seznam.cz>
+
+ * sysdeps/ieee754/dbl-64/dbl2mpn.c: Fix formatting.
+ * sysdeps/ieee754/dbl-64/dla.h: Likewise.
+ * sysdeps/ieee754/dbl-64/dosincos.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_acosh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_fmod.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_hypot.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_ilogb.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_j0.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log10.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_rem_pio2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
+ * sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
+ * sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/MathLib.h: Likewise.
+ * sysdeps/ieee754/dbl-64/mpa-arch.h: Likewise.
+ * sysdeps/ieee754/dbl-64/mpa.c: Likewise.
+ * sysdeps/ieee754/dbl-64/mpatan.c: Likewise.
+ * sysdeps/ieee754/dbl-64/mpn2dbl.c: Likewise.
+ * sysdeps/ieee754/dbl-64/mptan.c: Likewise.
+ * sysdeps/ieee754/dbl-64/mydefs.h: Likewise.
+ * sysdeps/ieee754/dbl-64/s_asinh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_cbrt.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_ceil.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_copysign.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_expm1.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_fabs.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_finite.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_floor.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_frexp.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_isinf.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_isinf_ns.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_isnan.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_log1p.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_logb.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_modf.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_remquo.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_rint.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_scalbln.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_scalbn.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_tanh.c: Likewise.
+
+2013-10-17 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #16041]
+ * soft-fp/op-common.h (FP_EXTEND): When input is a signaling NaN,
+ make result into a quiet NaN.
+
+2013-10-16 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/adddf3.c: Fix horizontal whitespace.
+ * soft-fp/addsf3.c: Likewise.
+ * soft-fp/addtf3.c: Likewise.
+ * soft-fp/divdf3.c: Likewise.
+ * soft-fp/divsf3.c: Likewise.
+ * soft-fp/divtf3.c: Likewise.
+ * soft-fp/double.h: Likewise.
+ * soft-fp/eqdf2.c: Likewise.
+ * soft-fp/eqsf2.c: Likewise.
+ * soft-fp/eqtf2.c: Likewise.
+ * soft-fp/extenddftf2.c: Likewise.
+ * soft-fp/extended.h: Likewise.
+ * soft-fp/extendsfdf2.c: Likewise.
+ * soft-fp/extendsftf2.c: Likewise.
+ * soft-fp/extendxftf2.c: Likewise.
+ * soft-fp/fixdfdi.c: Likewise.
+ * soft-fp/fixdfsi.c: Likewise.
+ * soft-fp/fixdfti.c: Likewise.
+ * soft-fp/fixsfdi.c: Likewise.
+ * soft-fp/fixsfsi.c: Likewise.
+ * soft-fp/fixsfti.c: Likewise.
+ * soft-fp/fixtfdi.c: Likewise.
+ * soft-fp/fixtfsi.c: Likewise.
+ * soft-fp/fixtfti.c: Likewise.
+ * soft-fp/fixunsdfdi.c: Likewise.
+ * soft-fp/fixunsdfsi.c: Likewise.
+ * soft-fp/fixunsdfti.c: Likewise.
+ * soft-fp/fixunssfdi.c: Likewise.
+ * soft-fp/fixunssfsi.c: Likewise.
+ * soft-fp/fixunssfti.c: Likewise.
+ * soft-fp/fixunstfdi.c: Likewise.
+ * soft-fp/fixunstfsi.c: Likewise.
+ * soft-fp/fixunstfti.c: Likewise.
+ * soft-fp/floatdidf.c: Likewise.
+ * soft-fp/floatdisf.c: Likewise.
+ * soft-fp/floatditf.c: Likewise.
+ * soft-fp/floatsidf.c: Likewise.
+ * soft-fp/floatsisf.c: Likewise.
+ * soft-fp/floatsitf.c: Likewise.
+ * soft-fp/floattidf.c: Likewise.
+ * soft-fp/floattisf.c: Likewise.
+ * soft-fp/floattitf.c: Likewise.
+ * soft-fp/floatundidf.c: Likewise.
+ * soft-fp/floatundisf.c: Likewise.
+ * soft-fp/floatunditf.c: Likewise.
+ * soft-fp/floatunsidf.c: Likewise.
+ * soft-fp/floatunsisf.c: Likewise.
+ * soft-fp/floatunsitf.c: Likewise.
+ * soft-fp/floatuntidf.c: Likewise.
+ * soft-fp/floatuntisf.c: Likewise.
+ * soft-fp/floatuntitf.c: Likewise.
+ * soft-fp/fmadf4.c: Likewise.
+ * soft-fp/fmasf4.c: Likewise.
+ * soft-fp/fmatf4.c: Likewise.
+ * soft-fp/gedf2.c: Likewise.
+ * soft-fp/gesf2.c: Likewise.
+ * soft-fp/getf2.c: Likewise.
+ * soft-fp/ledf2.c: Likewise.
+ * soft-fp/lesf2.c: Likewise.
+ * soft-fp/letf2.c: Likewise.
+ * soft-fp/muldf3.c: Likewise.
+ * soft-fp/mulsf3.c: Likewise.
+ * soft-fp/multf3.c: Likewise.
+ * soft-fp/negdf2.c: Likewise.
+ * soft-fp/negsf2.c: Likewise.
+ * soft-fp/negtf2.c: Likewise.
+ * soft-fp/op-1.h: Likewise.
+ * soft-fp/op-2.h: Likewise.
+ * soft-fp/op-4.h: Likewise.
+ * soft-fp/op-8.h: Likewise.
+ * soft-fp/op-common.h: Likewise.
+ * soft-fp/quad.h: Likewise.
+ * soft-fp/single.h: Likewise.
+ * soft-fp/soft-fp.h: Likewise.
+ * soft-fp/sqrtdf2.c: Likewise.
+ * soft-fp/sqrtsf2.c: Likewise.
+ * soft-fp/sqrttf2.c: Likewise.
+ * soft-fp/subdf3.c: Likewise.
+ * soft-fp/subsf3.c: Likewise.
+ * soft-fp/subtf3.c: Likewise.
+ * soft-fp/truncdfsf2.c: Likewise.
+ * soft-fp/trunctfdf2.c: Likewise.
+ * soft-fp/trunctfsf2.c: Likewise.
+ * soft-fp/trunctfxf2.c: Likewise.
+ * soft-fp/unorddf2.c: Likewise.
+ * soft-fp/unordsf2.c: Likewise.
+ * soft-fp/unordtf2.c: Likewise.
+
+2013-10-15 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/op-2.h (_FP_DIV_MEAT_2_gmp): Remove macro.
+ * soft-fp/soft-fp.h (FP_UNSET_EXCEPTION): Likewise.
+
+2013-10-15 Ondřej Bílka <neleai@seznam.cz>
+
+ * elf/dl-libc.c: Clear initfini list after freeing.
+
+2013-10-14 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/adddf3.c: Fix vertical whitespace and indentation.
+ * soft-fp/addsf3.c: Likewise.
+ * soft-fp/addtf3.c: Likewise.
+ * soft-fp/divdf3.c: Likewise.
+ * soft-fp/divsf3.c: Likewise.
+ * soft-fp/divtf3.c: Likewise.
+ * soft-fp/double.h: Likewise.
+ * soft-fp/eqdf2.c: Likewise.
+ * soft-fp/eqsf2.c: Likewise.
+ * soft-fp/eqtf2.c: Likewise.
+ * soft-fp/extenddftf2.c: Likewise.
+ * soft-fp/extended.h: Likewise.
+ * soft-fp/extendsfdf2.c: Likewise.
+ * soft-fp/extendsftf2.c: Likewise.
+ * soft-fp/extendxftf2.c: Likewise.
+ * soft-fp/fixdfdi.c: Likewise.
+ * soft-fp/fixdfsi.c: Likewise.
+ * soft-fp/fixdfti.c: Likewise.
+ * soft-fp/fixsfdi.c: Likewise.
+ * soft-fp/fixsfsi.c: Likewise.
+ * soft-fp/fixsfti.c: Likewise.
+ * soft-fp/fixtfdi.c: Likewise.
+ * soft-fp/fixtfsi.c: Likewise.
+ * soft-fp/fixtfti.c: Likewise.
+ * soft-fp/fixunsdfdi.c: Likewise.
+ * soft-fp/fixunsdfsi.c: Likewise.
+ * soft-fp/fixunsdfti.c: Likewise.
+ * soft-fp/fixunssfdi.c: Likewise.
+ * soft-fp/fixunssfsi.c: Likewise.
+ * soft-fp/fixunssfti.c: Likewise.
+ * soft-fp/fixunstfdi.c: Likewise.
+ * soft-fp/fixunstfsi.c: Likewise.
+ * soft-fp/fixunstfti.c: Likewise.
+ * soft-fp/floatdidf.c: Likewise.
+ * soft-fp/floatdisf.c: Likewise.
+ * soft-fp/floatditf.c: Likewise.
+ * soft-fp/floatsidf.c: Likewise.
+ * soft-fp/floatsisf.c: Likewise.
+ * soft-fp/floatsitf.c: Likewise.
+ * soft-fp/floattidf.c: Likewise.
+ * soft-fp/floattisf.c: Likewise.
+ * soft-fp/floattitf.c: Likewise.
+ * soft-fp/floatundidf.c: Likewise.
+ * soft-fp/floatundisf.c: Likewise.
+ * soft-fp/floatunsidf.c: Likewise.
+ * soft-fp/floatunsisf.c: Likewise.
+ * soft-fp/floatuntidf.c: Likewise.
+ * soft-fp/floatuntisf.c: Likewise.
+ * soft-fp/floatuntitf.c: Likewise.
+ * soft-fp/fmadf4.c: Likewise.
+ * soft-fp/fmasf4.c: Likewise.
+ * soft-fp/fmatf4.c: Likewise.
+ * soft-fp/gedf2.c: Likewise.
+ * soft-fp/gesf2.c: Likewise.
+ * soft-fp/getf2.c: Likewise.
+ * soft-fp/ledf2.c: Likewise.
+ * soft-fp/lesf2.c: Likewise.
+ * soft-fp/letf2.c: Likewise.
+ * soft-fp/muldf3.c: Likewise.
+ * soft-fp/mulsf3.c: Likewise.
+ * soft-fp/multf3.c: Likewise.
+ * soft-fp/negdf2.c: Likewise.
+ * soft-fp/negsf2.c: Likewise.
+ * soft-fp/negtf2.c: Likewise.
+ * soft-fp/op-1.h: Likewise.
+ * soft-fp/op-2.h: Likewise.
+ * soft-fp/op-4.h: Likewise.
+ * soft-fp/op-8.h: Likewise.
+ * soft-fp/op-common.h: Likewise.
+ * soft-fp/quad.h: Likewise.
+ * soft-fp/single.h: Likewise.
+ * soft-fp/soft-fp.h: Likewise.
+ * soft-fp/sqrtdf2.c: Likewise.
+ * soft-fp/sqrtsf2.c: Likewise.
+ * soft-fp/sqrttf2.c: Likewise.
+ * soft-fp/subdf3.c: Likewise.
+ * soft-fp/subsf3.c: Likewise.
+ * soft-fp/subtf3.c: Likewise.
+ * soft-fp/truncdfsf2.c: Likewise.
+ * soft-fp/trunctfdf2.c: Likewise.
+ * soft-fp/trunctfsf2.c: Likewise.
+ * soft-fp/trunctfxf2.c: Likewise.
+ * soft-fp/unorddf2.c: Likewise.
+ * soft-fp/unordsf2.c: Likewise.
+ * soft-fp/unordtf2.c: Likewise.
+
+2013-10-14 Ondřej Bílka <neleai@seznam.cz>
+
+ [BZ #15672]
+ * misc/error.c (error_tail): Fix possible buffer overflow.
+
+2013-10-14 Aurelien Jarno <aurelien@aurel32.net>
+
+ [BZ #13028]
+ * res_send.c(__libc_res_nsend): Correctly copy the nameserver
+ address.
+
+2013-10-14 P. J. McDermott <pj@pehjota.net>
+
+ [BZ #832]
+ * elf/ldd.bash.in (try_trace): New function. Delete previous code
+ testing pipefail option.
+
+2013-10-12 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/double.h: Indent preprocessor directives inside #if.
+ * soft-fp/extended.h: Likewise.
+ * soft-fp/op-2.h: Likewise.
+ * soft-fp/op-4.h: Likewise.
+ * soft-fp/op-common.h: Likewise.
+ * soft-fp/quad.h: Likewise.
+ * soft-fp/single.h: Likewise.
+ * soft-fp/soft-fp.h: Likewise.
+
+2013-10-12 Yuri Chornoivan <yurchor@ukr.net>
+
+ * iconv/iconv_prog.c: Fix typos.
+ * stdio-common/psiginfo-data.h: Likewise.
+
+2013-10-12 Reuben Thomas <rrt@sc3d.org>
+
+ [BZ #15764]
+ * locale/setlocale.c: Fix typo.
+
+2013-10-12 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #16036]
+ * soft-fp/unorddf2.c (__unorddf2): Raise "invalid" exception for
+ signaling NaN arguments.
+ * soft-fp/unordsf2.c (__unordsf2): Likewise.
+ * soft-fp/unordtf2.c (__unordtf2): Likewise.
+
+ [BZ #14910]
+ * soft-fp/gedf2.c (__gedf2): Raise "invalid" exception for all
+ unordered operands.
+ * soft-fp/gesf2.c (__gesf2): Likewise.
+ * soft-fp/getf2.c (__getf2): Likewise.
+ * soft-fp/ledf2.c (__ledf2): Likewise.
+ * soft-fp/lesf2.c (__lesf2): Likewise.
+ * soft-fp/letf2.c (__letf2): Likewise.
+
+ * soft-fp/eqdf2.c (__eqdf2): Use FP_INIT_EXCEPTIONS.
+ * soft-fp/eqsf2.c (__eqsf2): Likewise.
+ * soft-fp/eqtf2.c (__eqtf2): Likewise.
+ * soft-fp/fixdfdi.c (__fixdfdi): Likewise.
+ * soft-fp/fixdfsi.c (__fixdfsi): Likewise.
+ * soft-fp/fixdfti.c (__fixdfti): Likewise.
+ * soft-fp/fixsfdi.c (__fixsfdi): Likewise.
+ * soft-fp/fixsfsi.c (__fixsfsi): Likewise.
+ * soft-fp/fixsfti.c (__fixsfti): Likewise.
+ * soft-fp/fixtfdi.c (__fixtfdi): Likewise.
+ * soft-fp/fixtfsi.c (__fixtfsi): Likewise.
+ * soft-fp/fixtfti.c (__fixtfti): Likewise.
+ * soft-fp/fixunsdfdi.c (__fixunsdfdi): Likewise.
+ * soft-fp/fixunsdfsi.c (__fixunsdfsi): Likewise.
+ * soft-fp/fixunsdfti.c (__fixunsdfti): Likewise.
+ * soft-fp/fixunssfdi.c (__fixunssfdi): Likewise.
+ * soft-fp/fixunssfsi.c (__fixunssfsi): Likewise.
+ * soft-fp/fixunssfti.c (__fixunssfti): Likewise.
+ * soft-fp/fixunstfdi.c (__fixunstfdi): Likewise.
+ * soft-fp/fixunstfsi.c (__fixunstfsi): Likewise.
+ * soft-fp/fixunstfti.c (__fixunstfti): Likewise.
+ * soft-fp/floatdidf.c (__floatdidf): Use FP_INIT_ROUNDMODE.
+ * soft-fp/floatdisf.c (__floatdisf): Likewise.
+ * soft-fp/floatsisf.c (__floatsisf): Likewise.
+ * soft-fp/floattidf.c (__floattidf): Likewise.
+ * soft-fp/floattisf.c (__floattisf): Likewise.
+ * soft-fp/floattitf.c (__floattitf): Likewise.
+ * soft-fp/floatundidf.c (__floatundidf): Likewise.
+ * soft-fp/floatundisf.c (__floatundisf): Likewise.
+ * soft-fp/floatunsisf.c (__floatunsisf): Likewise.
+ * soft-fp/floatuntidf.c (__floatuntidf): Likewise.
+ * soft-fp/floatuntisf.c (__floatuntisf): Likewise.
+ * soft-fp/floatuntitf.c (__floatuntitf): Likewise.
+ * soft-fp/gedf2.c (__gedf2): Use FP_INIT_EXCEPTIONS.
+ * soft-fp/gesf2.c (__gesf2): Likewise.
+ * soft-fp/getf2.c (__getf2): Likewise.
+ * soft-fp/ledf2.c (__ledf2): Likewise.
+ * soft-fp/lesf2.c (__lesf2): Likewise.
+ * soft-fp/letf2.c (__letf2): Likewise.
+
+ * soft-fp/soft-fp.h [FP_NO_EXCEPTIONS] (FP_SET_EXCEPTION):
+ Undefine and redefine.
+ [FP_NO_EXCEPTIONS] (FP_CUR_EXCEPTIONS): Likewise.
+ [FP_NO_EXCEPTIONS] (FP_TRAPPING_EXCEPTIONS): Likewise.
+ [FP_NO_EXCEPTIONS] (FP_ROUNDMODE): Likewise.
+ * soft-fp/floatditf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatditf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+ * soft-fp/floatsidf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatsidf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+ * soft-fp/floatsitf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatsitf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+ * soft-fp/floatunditf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatunditf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+ * soft-fp/floatunsidf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatunsidf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+ * soft-fp/floatunsitf.c (FP_NO_EXCEPTIONS): Define macro.
+ (__floatunsitf): Don't use FP_DECL_EX or FP_HANDLE_EXCEPTIONS.
+
+ [BZ #16032]
+ * soft-fp/op-2.h (_FP_DIV_MEAT_2_udiv): Shift numerator right
+ without decrementing exponent if mantissa >= that for the
+ denominator, not >.
+ (_FP_DIV_MEAT_2_gmp): Test numerator mantissa >= that for the
+ denominator, not >. Decrement exponent in < case instead of
+ incrementing in >= case.
+ * soft-fp/op-4.h (_FP_DIV_MEAT_4_udiv): Shift numerator right
+ without decrementing exponent if mantissa >= that for the
+ denominator, not >.
+
+ * soft-fp/op-common.h (_FP_TO_INT): Reverse test of sign for
+ computing saturated result for unsigned overflow.
+
+2013-10-11 Siddhesh Poyarekar <siddhesh@redhat.com>
+ Jeff Law <law@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/e_atan2.c: Include stap-probe.h.
+ (atan2Mp): Add systemtap probe marker.
+ * sysdeps/ieee754/dbl-64/e_log.c: include stap-probe.h.
+ (__ieee754_log): Add systemtap probe marker.
+ * sysdeps/ieee754/dbl-64/s_atan.c: Include stap-probe.h.
+ (atanMp): Add systemtap probe marker.
+ * sysdeps/ieee754/dbl-64/s_tan.c: Include stap-probe.h.
+ (tanMp): Add systemtap probe marker.
+ * sysdeps/ieee754/dbl-64/slowexp.c: Include stap-probe.h.
+ (__slowexp): Add systemtap probe marker.
+ * sysdeps/ieee754/dbl-64/slowpow.c: Include stap-probe.h.
+ (__slowpow): Add systemtap probe marker.
+ * manual/probes.texi: Document probes.
+
+2013-10-11 Eric Biggers <ebiggers3@gmail.com>
+
+ [BZ #15362]
+ * libio/fileops.c (_IO_new_file_write): Return count of bytes
+ written.
+ (_IO_new_file_xsputn): Don't return EOF if nothing has been
+ written.
+ * libio/iofwrite.c (_IO_fwrite): Return count if bytes were
+ written to buffer but not flushed.
+ * libio/iofwrite_u.c: Likewise.
+ * libio/iopadn.c: Return bytes returned even if EOF was
+ encountered.
+ * libio/iowpadn.c: Likewise.
+ * stdio-common/vfprintf.c [COMPILE_WPRINTF] (PAD): Return error
+ if _IO_padn does not write the whole buffer.
+ [!COMPILE_WPRINTF] (PAD): Likewise.
+
+2013-10-10 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/posix/dirstream.h (struct __dirstream): Fix alignment of
+ directory block.
+
+2013-10-10 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/extendxftf2.c: Use copyright year range. Use URL
+ instead of FSF address.
+ * soft-fp/fixdfti.c: Likewise.
+ * soft-fp/fixsfti.c: Likewise.
+ * soft-fp/fixtfti.c: Likewise.
+ * soft-fp/fixunsdfti.c: Likewise.
+ * soft-fp/fixunssfti.c: Likewise.
+ * soft-fp/fixunstfti.c: Likewise.
+ * soft-fp/floattidf.c: Likewise.
+ * soft-fp/floattisf.c: Likewise.
+ * soft-fp/floattitf.c: Likewise.
+ * soft-fp/floatuntidf.c: Likewise.
+ * soft-fp/floatuntisf.c: Likewise.
+ * soft-fp/floatuntitf.c: Likewise.
+ * soft-fp/trunctfxf2.c: Likewise.
+
+ * soft-fp/extendxftf2.c: New file. Copied from libgcc.
+ * soft-fp/fixdfti.c: Likewise.
+ * soft-fp/fixsfti.c: Likewise.
+ * soft-fp/fixtfti.c: Likewise.
+ * soft-fp/fixunsdfti.c: Likewise.
+ * soft-fp/fixunssfti.c: Likewise.
+ * soft-fp/fixunstfti.c: Likewise.
+ * soft-fp/floattidf.c: Likewise.
+ * soft-fp/floattisf.c: Likewise.
+ * soft-fp/floattitf.c: Likewise.
+ * soft-fp/floatuntidf.c: Likewise.
+ * soft-fp/floatuntisf.c: Likewise.
+ * soft-fp/floatuntitf.c: Likewise.
+ * soft-fp/trunctfxf2.c: Likewise.
+
+2013-10-10 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/fpu/libm-test-ulps: Update.
+
+2013-10-10 Joseph Myers <joseph@codsourcery.com>
+
+ * sysdeps/powerpc/nofpu/Makefile [$(subdir) = math]
+ (CFLAGS-e_hypotl.c): Add -fno-builtin-fabsl.
+ [$(subdir) = math] (CFLAGS-w_acosl.c): Likewise.
+ [$(subdir) = math] (CFLAGS-w_asinl.c): Likewise.
+ [$(subdir) = math] (CFLAGS-w_atanhl.c): Likewise.
+ [$(subdir) = math] (CFLAGS-w_j0l.c): Likewise.
+ [$(subdir) = math] (CFLAGS-w_j1l.c): Likewise.
+
+ * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Check
+ for NaNs before doing comparisons on argument.
+ * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl):
+ Likewise.
+
+2013-10-10 Will Newton <will.newton@linaro.org>
+
+ * malloc/hooks.c (memalign_check): Ensure the value of bytes
+ passed to _int_memalign does not overflow.
+
+2013-10-10 Torvald Riegel <triegel@redhat.com>
+
+ * scripts/bench.pl: Add include-sources directive.
+ * benchtests/README: Update documentation.
+
+2013-10-10 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/soft-fp.h (FP_INIT_EXCEPTIONS): New macro.
+ * soft-fp/extenddftf2.c (__extenddftf2): Use FP_INIT_EXCEPTIONS
+ instead of FP_INIT_ROUNDMODE.
+ * soft-fp/extendsfdf2.c (__extendsfdf2): Likewise.
+ * soft-fp/extendsftf2.c (__extendsftf2): Likewise.
+
+ [BZ #16034]
+ * soft-fp/op-common.h (_FP_NEG): Document input as raw. Do not
+ copy class of input value.
+ * soft-fp/negdf2.c (__negdf2): Use raw unpacking and packing. Do
+ not handle exceptions.
+ * soft-fp/negsf2.c (__negsf2): Likewise.
+ * soft-fp/negtf2.c (__negtf2): Likewise.
+ * sysdeps/sparc/sparc32/soft-fp/q_neg.c (_Q_neg): Likewise.
+
+2013-10-09 Joseph Myers <joseph@codesourcery.com>
+
+ * soft-fp/op-4.h (_FP_FRAC_DISASSEMBLE_4): Remove trailing
+ semicolon. From Linux kernel.
+
+2013-10-09 Adam Buchbinder <adam.buchbinder@gmail.com>
+
+ * soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Fix typo in comment.
+
+2013-10-08 Yogesh Chaudhari <mr.yogesh@gmail.com>
+
+ [BZ #156]
+ * manual/socket.texi: Added statement about buffer
+ for gethostbyname2_r.
+
+2013-10-08 Ondřej Bílka <neleai@seznam.cz>
+
+ * sysdeps/x86_64/memset.S (ALIGN): Macro removed.
+ Use .p2align directive instead, throughout.
+ * sysdeps/x86_64/multiarch/memcmp-sse4.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcmp-ssse3.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
+ * sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: Likewise.
+ * sysdeps/x86_64/strchr.S: Likewise.
+ * sysdeps/x86_64/strrchr.S: Likewise.
+
+2013-10-08 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/e_pow.c: Fix code formatting.
+
+ * sysdeps/ieee754/dbl-64/e_exp.c: Fix code formatting.
+
+ * sysdeps/generic/math_private.h (__mpsin1): Remove
+ declaration.
+ (__mpcos1): Likewise.
+ (__mpsin): New argument __range_reduce.
+ (__mpcos): Likewise.
+ * sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
+ (slow): Use __mpsin and __mpcos.
+ (slow1): Likewise.
+ (slow2): Likewise.
+ (sloww): Likewise.
+ (sloww1): Likewise.
+ (sloww2): Likewise.
+ (bsloww): Likewise.
+ (bsloww1): Likewise.
+ (bsloww2): Likewise.
+ (cslow2): Likewise.
+ (csloww): Likewise.
+ (csloww1): Likewise.
+ (csloww2): Likewise.
+ * sysdeps/ieee754/dbl-64/sincos32.c (__mpsin): Add argument
+ range_reduce. Merge in __mpsin1.
+ (__mpcos): Likewise.
+ (__mpsin1): Remove.
+ (__mpcos1): Likewise.
+
+2013-10-07 Joseph Myers <joseph@codesourcery.com>
+
+ * locale/loadlocale.c (_nl_intern_locale_data): Use
+ LOCFILE_ALIGNED_P.
+ * locale/programs/3level.h (CONCAT(add_locale_,TABLE)): Use
+ LOCFILE_ALIGN_UP and LOCFILE_ALIGN.
+ * locale/programs/ld-collate.c (obstack_int32_grow): Assert that
+ obstack data is appropriately aligned.
+ (obstack_int32_grow_fast): Likewise.
+ * locale/programs/ld-ctype.c (ctype_output): Use LOCFILE_ALIGN.
+ * locale/programs/locfile.c (add_locale_uint32): Likewise.
+ (add_locale_uint32_array): Likewise.
+
+2013-10-07 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * benchtests/Makefile: Remove ARGLIST and RET variables.
+ ($(objpfx)bench-%.c): Pass only function name to the script.
+ * benchtests/README: Update documentation.
+ * benchtests/acos-inputs: Add new directives.
+ * benchtests/acosh-inputs: Likewise.
+ * benchtests/asin-inputs: Likewise.
+ * benchtests/asinh-inputs: Likewise.
+ * benchtests/atan-inputs: Likewise.
+ * benchtests/atanh-inputs: Likewise.
+ * benchtests/cos-inputs: Likewise.
+ * benchtests/cosh-inputs: Likewise.
+ * benchtests/exp-inputs: Likewise.
+ * benchtests/log-inputs: Likewise.
+ * benchtests/pow-inputs: Likewise.
+ * benchtests/rint-inputs: Likewise.
+ * benchtests/sin-inputs: Likewise.
+ * benchtests/sinh-inputs: Likewise.
+ * benchtests/tan-inputs: Likewise.
+ * benchtests/tanh-inputs: Likewise.
+ * scripts/bench.pl: Add support for new directives.
+
+2013-10-07 Alan Modra <amodra@gmail.com>
+
+ * README: Fix careless merge.
+
+2013-10-05 Alan Modra <amodra@gmail.com>
+
+ * NEWS: Mention powerpc64le support and bugs fixed.
+ * README: Both big-endian and little-endian powerpc64 supported.
+
+2013-10-04 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * sysdeps/mach/hurd/fork.c (_hurd_atfork_prepare_hook,
+ _hurd_atfork_child_hook, _hurd_atfork_parent_hook): New hooks.
+ (__fork): Call _hurd_atfork_prepare_hook hooks before all locking, call
+ _hurd_atfork_parent_hook or _hurd_atfork_child_hook after all unlocking.
+
+2013-10-04 Ryan S. Arnold <ryan.arnold@linaro.org>
+
+ * misc/swapon.c (swapon): Update definition, adding FLAGS parameter to
+ match prototype.
+
+2013-10-04 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/powerpc32/Makefile [$(with-fp) = yes] (+cflags):
+ Move -mhard-float appending from
+ ports/sysdeps/powerpc/powerpc32/Makefile.
+ [$(with-fp) = yes] (ASFLAGS): Likewise.
+ [$(with-fp) = yes] (sysdep-LDFLAGS): Likewise.
+ * sysdeps/powerpc/nofpu: Move directory from
+ ports/sysdeps/powerpc/nofpu.
+ * sysdeps/powerpc/soft-fp: Move directory from
+ ports/sysdeps/powerpc/soft-fp.
+ * sysdeps/powerpc/powerpc32/405: Move directory from
+ ports/sysdeps/powerpc/powerpc32/405.
+ * sysdeps/powerpc/powerpc32/440: Move directory from
+ ports/sysdeps/powerpc/powerpc32/440.
+ * sysdeps/powerpc/powerpc32/464: Move directory from
+ ports/sysdeps/powerpc/powerpc32/464.
+ * sysdeps/powerpc/powerpc32/476: Move directory from
+ ports/sysdeps/powerpc/powerpc32/476.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu: Move directory
+ from ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/405: Move directory
+ from ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/405.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/440: Move directory
+ from ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/440.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/464: Move directory
+ from ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/464.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/476: Move directory
+ from ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/476.
+ * README: Update for powerpc-*-linux-gnu software floating point
+ support in libc.
+
+ * sysdeps/unix/sysv/linux/configure.in (powerpc/powerpc32): Change
+ case to powerpc/powerpc32*.
+ * sysdeps/unix/sysv/linux/configure: Regenerated.
+
+ * sysdeps/powerpc/fpu_control.h [__NO_FPRS__ && !_SOFT_FLOAT]
+ (_FPU_MASK_OM): Define as 0x04.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_UM): Define as 0x08.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RESERVED): Define as
+ 0x00c10080.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_DEFAULT): Define as
+ 0x0000003c.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_IEEE): Define as _FPU_DEFAULT.
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
+ (__CONTEXT_FUNC_NAME) [__CONTEXT_ENABLE_E500]: Use
+ getcontext_e500.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+ (__CONTEXT_FUNC_NAME) [__CONTEXT_ENABLE_E500]: Use
+ setcontext_e500.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+ (__CONTEXT_FUNC_NAME) [__CONTEXT_ENABLE_E500]: Use getcontext_e500
+ and setcontext_e500.
+
+2013-10-04 Chris Leonard <cjl@sugarlabs,.org>
+
+ * locale/iso-3166.def: Update iso-1366.def and related occurrences
+
+2013-10-04 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * manual/threads.texi (Default Thread Attributes): Fix typo.
+
+2013-10-04 Will Newton <will.newton@linaro.org>
+
+ * malloc/Makefile: Add tst-memalign.
+ * malloc/tst-memalign.c: New file.
+
+ * malloc/tst-posix_memalign.c: Add comments.
+ (do_test): Add comments and call free on all potentially
+ allocated pointers. Add space after cast.
+
+ * malloc/tst-pvalloc.c: Add comments.
+ (do_test): Add comments and call free on all potentially
+ allocated pointers. Remove duplicate check for NULL pointer.
+ Add space after cast.
+
+ * malloc/tst-valloc.c: Add comments.
+ (do_test): Add comments and call free on all potentially
+ allocated pointers. Remove duplicate check for NULL pointer.
+ Add space after cast.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc32/dl-machine.c (__process_machine_rela):
+ Use stdint types in rather than __attribute__((mode())).
+ * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc32/dl-machine.c (__process_machine_rela):
+ Correct handling of unaligned relocs for little-endian.
+ * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * configure.in: Map powerpc64le and powerpcle to base_machine/machine.
+ * configure: Regenerate.
+ * nptl/shlib-versions: Powerpc*le starts at 2.18.
+ * shlib-versions: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * string/tester.c (test_memrchr): Increment reported test cycle.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * string/test-memcpy.c (do_one_test): When reporting errors, print
+ string address and don't overrun end of string.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/memchr.S: Replace rlwimi with
+ insrdi. Make better use of reg selection to speed exit slightly.
+ Schedule entry path a little better. Remove useless "are we done"
+ checks on entry to main loop. Handle wrapping around zero address.
+ Correct main loop count. Handle single left-over word from main
+ loop inline rather than by using loop_small. Remove extra word
+ case in loop_small caused by wrong loop count. Add little-endian
+ support.
+ * sysdeps/powerpc/powerpc32/power7/memchr.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise. Use proper
+ cache hint.
+ * sysdeps/powerpc/powerpc32/power7/memrchr.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Add little-endian
+ support. Avoid rlwimi.
+ * sysdeps/powerpc/powerpc32/power7/rawmemchr.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/memset.S: Replace rlwimi with
+ insrdi. Formatting.
+ * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/memset.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power6/memset.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/memset.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc32/power4/memcpy.S: Add little endian support.
+ * sysdeps/powerpc/powerpc32/power6/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/mempcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise. Make better
+ use of regs. Use power7 mtocrf. Tidy function tails.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/memcmp.S: Add little-endian support.
+ Formatting. Consistently use rXXX register defines or rN defines.
+ Use early exit labels that avoid restoring unused non-volatile regs.
+ Make cr field use more consistent with rWORDn compares. Rename
+ regs used as shift registers for unaligned loop, using rN defines
+ for short lifetime/multiple use regs.
+ * sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/memcmp.S: Likewise. Exit with
+ addi 1,1,64 to pop stack frame. Simplify return value code.
+ * sysdeps/powerpc/powerpc32/power4/memcmp.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/strchr.S (strchr): Add little-endian
+ support. Correct typos, formatting. Optimize tail. Use insrdi
+ rather than rlwimi.
+ * sysdeps/powerpc/powerpc32/power7/strchr.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/strchrnul.S (__strchrnul): Add
+ little-endian support. Correct typos.
+ * sysdeps/powerpc/powerpc32/power7/strchrnul.S: Likewise. Use insrdi
+ rather than rlwimi.
+ * sysdeps/powerpc/powerpc64/strchr.S (rTMP4, rTMP5): Define. Use
+ in loop and entry code to keep "and." results.
+ (strchr): Add little-endian support. Comment. Move cntlzd
+ earlier in tail.
+ * sysdeps/powerpc/powerpc32/strchr.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/strcpy.S: Add little-endian support:
+ * sysdeps/powerpc/powerpc32/strcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
+ * sysdeps/powerpc/powerpc32/stpcpy.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/strcmp.S (rTMP2): Define as r0.
+ (rTMP): Define as r11.
+ (strcmp): Add little-endian support. Optimise tail.
+ * sysdeps/powerpc/powerpc32/strcmp.S: Similarly.
+ * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/strnlen.S (strnlen): Add
+ little-endian support. Remove unnecessary "are we done" tests.
+ Handle "s" wrapping around zero and extremely large "size".
+ Correct main loop count. Handle single left-over word from main
+ loop inline rather than by using small_loop. Correct comments.
+ Delete "zero" tail, use "end_max" instead.
+ * sysdeps/powerpc/powerpc32/power7/strnlen.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/strlen.S (strlen): Add little-endian
+ support. Don't branch over align.
+ * sysdeps/powerpc/powerpc32/power7/strlen.S: Likewise.
+ * sysdeps/powerpc/powerpc64/strlen.S (strlen): Add little-endian
+ support. Rearrange tmp reg use to suit. Comment.
+ * sysdeps/powerpc/powerpc32/strlen.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h: New file.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use
+ conditional form of branch and link when obtaining pc.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Use
+ HIWORD/LOWORD.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Ditto.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Ditto.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/longjmp.c: Use proper symbol versioning macros.
+ * sysdeps/powerpc/novmx-longjmp.c: Likewise.
+ * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/bsd-setjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/setjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/mcount.c: Likewise.
+ * sysdeps/powerpc/powerpc32/setjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc64/setjmp.S: Likewise.
+ * nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c: Likewise.
+
+2013-10-04 Anton Blanchard <anton@au1.ibm.com>
+ Alistair Popple <alistair@ozlabs.au.ibm.com>
+ Alan Modra <amodra@gmail.com>
+
+ [BZ #15723]
+ * sysdeps/powerpc/jmpbuf-offsets.h: Comment fix.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Correct
+ _dl_hwcap access for little-endian.
+ * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise. Don't
+ destroy vmx regs when saving unaligned.
+ * sysdeps/powerpc/powerpc64/__longjmp-common.S: Correct CR load.
+ * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise CR save. Don't
+ destroy vmx regs when saving unaligned.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_NOW):
+ Don't use a union to pack hi/low value.
+
+2013-10-04 Anton Blanchard <anton@au1.ibm.com>
+
+ * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Correct float constants
+ for little-endian.
+ * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Increase alignment of
+ constants to usual value for .cst8 section, and remove redundant
+ high address load.
+ * sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Use float
+ constant for 0x1p52. Load little-endian words of double from
+ correct stack offsets.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define.
+ * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian
+ words of double from correct stack offsets.
+ * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/s_lround.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT.
+ * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Rewrite using
+ 64-bit int/double union.
+ (_FPU_SETCW): Likewise.
+ * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise.
+ (_SET_DI_FPSCR, _GET_SI_FPSCR, _SET_SI_FPSCR): Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/fpu/s_llround.c (__llround): Rewrite.
+ * sysdeps/powerpc/fpu/s_llroundf.c (__llroundf): Rewrite.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/fpu/s_float_bitwise.h (__float_and_test28): Don't
+ use vector int constants.
+ (__float_and_test24, __float_and8, __float_get_exp): Likewise.
+
+2013-10-04 Anton Blanchard <anton@au1.ibm.com>
+
+ * sysdeps/powerpc/fpu/fenv_libc.h (fenv_union_t): Replace int
+ array with long long.
+ * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Adjust.
+ * sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Adjust.
+ * sysdeps/powerpc/fpu/fclrexcpt.c (__feclearexcept): Adjust.
+ * sysdeps/powerpc/fpu/fedisblxcpt.c (fedisableexcept): Adjust.
+ * sysdeps/powerpc/fpu/feenablxcpt.c (feenableexcept): Adjust.
+ * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Adjust.
+ * sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Adjust.
+ * sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Adjust.
+ * sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Adjust.
+ * sysdeps/powerpc/fpu/fgetexcptflg.c (__fegetexceptflag): Adjust.
+ * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Adjust.
+ * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Adjust.
+ * sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Adjust.
+
+2013-10-04 Anton Blanchard <anton@au1.ibm.com>
+
+ * sysdeps/powerpc/bits/mathinline.h (__signbitf): Use builtin.
+ (__signbit): Likewise. Correct for little-endian.
+ (__signbitl): Call __signbit.
+ (lrint): Correct for little-endian.
+ (lrintf): Call lrint.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (mynumber): Replace
+ union 32-bit int array member with 64-bit int array.
+ (t515, tm256): Double rather than long double.
+ (__ieee754_sqrtl): Rewrite using 64-bit arithmetic.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ieee754/ldbl-128ibm/ieee754.h (union ieee854_long_double):
+ Delete.
+ (IEEE854_LONG_DOUBLE_BIAS): Delete.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Don't include ieee854
+ version of math_ldbl.h.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ [BZ #15734], [BZ #15735]
+ * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite
+ all uses of ieee875 long double macros and unions. Simplify test
+ for 0.0L. Correct |x|<|y| and |x|=|y| test. Use
+ ldbl_extract_mantissa value for ix,iy exponents. Properly
+ normalize after ldbl_extract_mantissa, and don't add hidden bit
+ already handled. Don't treat low word of ieee854 mantissa like
+ low word of IBM long double and mask off bit when testing for
+ zero.
+ * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Rewrite
+ all uses of ieee875 long double macros and unions. Simplify tests
+ for 0.0L and inf. Correct double adjustment of k. Delete dead code
+ adjusting ha,hb. Simplify code setting kld. Delete two600 and
+ two1022, instead use their values. Recognise that tests for large
+ "a" and small "b" are mutually exclusive. Rename vars. Comment.
+ * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl):
+ Rewrite all uses of ieee875 long double macros and unions. Simplify
+ test for 0.0L and nan. Correct negation.
+ * sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Rewrite all uses of
+ ieee875 long double macros and unions. Correct output for large
+ magnitude x. Correct absolute value calculation.
+ (__erfcl): Likewise.
+ * math/libm-test.inc: Add tests for errors discovered in IBM long
+ double versions of fmodl, remainderl, erfl and erfcl.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ieee754/ldbl-128ibm/e_atan2l.c (__ieee754_atan2l): Rewrite
+ all uses of ieee854 long double macros and unions. Simplify tests
+ for long doubles that are fully specified by the high double.
+ * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl): Likewise.
+ Remove dead code too.
+ * sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
+ (__ieee754_ynl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
+ Remove dead code too.
+ * sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c (__isinf_nsl): Likewise.
+ Simplify.
+ * sysdeps/ieee754/ldbl-128ibm/s_isinfl.c (___isinfl): Likewise.
+ Simplify.
+ * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Likewise.
+ Comment on variable precision.
+ * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c (__scalblnl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (__scalbnl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise.
+ * sysdeps/powerpc/fpu/libm-test-ulps: Adjust tan_towardzero ulps.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_high): Define.
+ * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Rewrite
+ all uses of ieee854 long double macros and unions.
+ * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_coshl.c (__ieee754_coshl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise.
+ Simplify sign and nan test too.
+ * sysdeps/ieee754/ldbl-128ibm/s_cosl.c (__cosl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_finitel.c (___finitel): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_isnanl.c (___isnanl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c (__issignalingl):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c (___signbitl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_sincosl.c (__sincosl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_sinl.c (__sinl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_tanl.c (__tanl): Likewise.
+ * sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c (__logbl): Likewise.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * stdio-common/printf_size.c (__printf_size): Don't use
+ union ieee854_long_double in fpnum union.
+ * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use
+ signbit macro to retrieve sign from long double.
+ * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to
+ retrieve sign from long double.
+ * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change.
+ * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
+ * sysdeps/x86_64/fpu/printf_fphex.c: Likewise.
+ * math/test-misc.c (main): Don't use union ieee854_long_double.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ [BZ #15680]
+ * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix.
+ * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
+ (PRINT_FPHEX_LONG_DOUBLE): Tidy code by moving -53 into ediff
+ calculation. Remove unnecessary test for denormal exponent.
+ * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c (__mpn_extract_long_double):
+ Correct handling of denormals. Avoid undefined shift behaviour.
+ Correct normalisation of low mantissa when low double is denormal.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
+ (ldbl_extract_mantissa): Likewise. Comment. Use uint64_t* for hi64.
+ (ldbl_insert_mantissa): Make both hi64 and lo64 parms uint64_t.
+ Correct normalisation of low mantissa. Test for overflow of high
+ mantissa and normalise.
+ (ldbl_nearbyint): Use more readable constant for two52.
+ * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
+ (__mpn_construct_long_double): Fix test for overflow of high
+ mantissa and correct normalisation. Avoid undefined shift.
+
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ieee754/ldbl-128ibm/ieee754.h
+ (union ibm_extended_long_double): Define as an array of ieee754_double.
+ (IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
+ * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references
+ to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS.
+ * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
+
+2013-10-03 Joseph Myers <joseph@codesourcery.com>
+
+ * locale/programs/locarchive.c (add_locale): Use constant 4096 for
+ page size instead of calling getpagesize.
+
+ * locale/localeinfo.h (LOCFILE_ALIGN): New macro.
+ (LOCFILE_ALIGN_MASK): Likewise.
+ (LOCFILE_ALIGN_UP): Likewise.
+ (LOCFILE_ALIGNED_P): Likewise.
+ * locale/programs/ld-collate.c (collate_output): Use the new
+ macros instead of __alignof__ (int32_t).
+ * locale/weight.h (findidx): Likewise.
+
+2013-10-03 Ondřej Bílka <neleai@seznam.cz>
+
+ [BZ #431]
+ * manual/string.texi: Fix strncat and wcsncat.
+
+2013-10-03 Brooks Moses <bmoses@google.com>
+
+ [BZ #15915]
+ * Makefile (linkobj/libc_pic.a, linkobj/libc.so): Move rules to...
+ * Makerules: ...here, and adjust associated comments.
+
+2013-10-02 Will Newton <will.newton@linaro.org>
+
+ * malloc/Makefile: Add tst-pvalloc.
+ * malloc/tst-pvalloc.c: New file.
+
+2013-10-02 Will Newton <will.newton@linaro.org>
+
+ * malloc/tst-valloc.c: Rewrite to use test-skeleton.c and
+ improve test coverage.
+
+2013-10-02 Will Newton <will.newton@linaro.org>
+
+ * malloc/Makefile: Add tst-posix_memalign.
+ * malloc/tst-posix_memalign.c: New file.
+
+2013-10-01 Eric Blake <eblake@redhat.com>
+
+ * posix/glob.c (next_brace_sub, prefix_array, collated_compare):
+ Use __THROWNL rather than __THROW on static functions.
+
+2013-09-30 Petr Machata <pmachata@redhat.com>
+
+ * elf/elf.h (R_AARCH64_ABS16): New macro.
+ (R_AARCH64_PREL64, R_AARCH64_PREL32): Likewise.
+ (R_AARCH64_PREL16, R_AARCH64_MOVW_UABS_G0): Likewise.
+ (R_AARCH64_MOVW_UABS_G0_NC, R_AARCH64_MOVW_UABS_G1): Likewise.
+ (R_AARCH64_MOVW_UABS_G1_NC, R_AARCH64_MOVW_UABS_G2): Likewise.
+ (R_AARCH64_MOVW_UABS_G2_NC, R_AARCH64_MOVW_UABS_G3): Likewise.
+ (R_AARCH64_MOVW_SABS_G0, R_AARCH64_MOVW_SABS_G1): Likewise.
+ (R_AARCH64_MOVW_SABS_G2, R_AARCH64_LD_PREL_LO19): Likewise.
+ (R_AARCH64_ADR_PREL_LO21, R_AARCH64_ADR_PREL_PG_HI21): Likewise.
+ (R_AARCH64_ADR_PREL_PG_HI21_NC, R_AARCH64_ADD_ABS_LO12_NC): Likewise.
+ (R_AARCH64_LDST8_ABS_LO12_NC, R_AARCH64_LDST16_ABS_LO12_NC): Likewise.
+ (R_AARCH64_LDST32_ABS_LO12_NC, R_AARCH64_LDST64_ABS_LO12_NC): Likewise.
+ (R_AARCH64_LDST128_ABS_LO12_NC, R_AARCH64_TSTBR14): Likewise.
+ (R_AARCH64_CONDBR19, R_AARCH64_JUMP26, R_AARCH64_CALL26): Likewise.
+ (R_AARCH64_MOVW_PREL_G0, R_AARCH64_MOVW_PREL_G0_NC): Likewise.
+ (R_AARCH64_MOVW_PREL_G1, R_AARCH64_MOVW_PREL_G1_NC): Likewise.
+ (R_AARCH64_MOVW_PREL_G2, R_AARCH64_MOVW_PREL_G2_NC): Likewise.
+ (R_AARCH64_MOVW_PREL_G3, R_AARCH64_MOVW_GOTOFF_G0): Likewise.
+ (R_AARCH64_MOVW_GOTOFF_G0_NC, R_AARCH64_MOVW_GOTOFF_G1): Likewise.
+ (R_AARCH64_MOVW_GOTOFF_G1_NC, R_AARCH64_MOVW_GOTOFF_G2): Likewise.
+ (R_AARCH64_MOVW_GOTOFF_G2_NC, R_AARCH64_MOVW_GOTOFF_G3): Likewise.
+ (R_AARCH64_GOTREL64, R_AARCH64_GOTREL32): Likewise.
+ (R_AARCH64_GOT_LD_PREL19, R_AARCH64_LD64_GOTOFF_LO15): Likewise.
+ (R_AARCH64_ADR_GOT_PAGE, R_AARCH64_LD64_GOT_LO12_NC): Likewise.
+ (R_AARCH64_LD64_GOTPAGE_LO15, R_AARCH64_TLSGD_ADR_PREL21): Likewise.
+ (R_AARCH64_TLSGD_ADR_PAGE21, R_AARCH64_TLSGD_ADD_LO12_NC): Likewise.
+ (R_AARCH64_TLSGD_MOVW_G1, R_AARCH64_TLSGD_MOVW_G0_NC): Likewise.
+ (R_AARCH64_TLSLD_ADR_PREL21, R_AARCH64_TLSLD_ADR_PAGE21): Likewise.
+ (R_AARCH64_TLSLD_ADD_LO12_NC, R_AARCH64_TLSLD_MOVW_G1): Likewise.
+ (R_AARCH64_TLSLD_MOVW_G0_NC, R_AARCH64_TLSLD_LD_PREL19): Likewise.
+ (R_AARCH64_TLSLD_MOVW_DTPREL_G2): Likewise.
+ (R_AARCH64_TLSLD_MOVW_DTPREL_G1): Likewise.
+ (R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC): Likewise.
+ (R_AARCH64_TLSLD_MOVW_DTPREL_G0): Likewise.
+ (R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC): Likewise.
+ (R_AARCH64_TLSLD_ADD_DTPREL_HI12): Likewise.
+ (R_AARCH64_TLSLD_ADD_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLD_LDST8_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLD_LDST16_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLD_LDST32_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLD_LDST64_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLD_LDST128_DTPREL_LO12): Likewise.
+ (R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSIE_MOVW_GOTTPREL_G1): Likewise.
+ (R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC): Likewise.
+ (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21): Likewise.
+ (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSIE_LD_GOTTPREL_PREL19): Likewise.
+ (R_AARCH64_TLSLE_MOVW_TPREL_G2): Likewise.
+ (R_AARCH64_TLSLE_MOVW_TPREL_G1): Likewise.
+ (R_AARCH64_TLSLE_MOVW_TPREL_G1_NC): Likewise.
+ (R_AARCH64_TLSLE_MOVW_TPREL_G0): Likewise.
+ (R_AARCH64_TLSLE_MOVW_TPREL_G0_NC): Likewise.
+ (R_AARCH64_TLSLE_ADD_TPREL_HI12): Likewise.
+ (R_AARCH64_TLSLE_ADD_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLE_LDST8_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLE_LDST16_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLE_LDST32_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLE_LDST64_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSLE_LDST128_TPREL_LO12): Likewise.
+ (R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC): Likewise.
+ (R_AARCH64_TLSDESC_LD_PREL19): Likewise.
+ (R_AARCH64_TLSDESC_ADR_PREL21): Likewise.
+ (R_AARCH64_TLSDESC_ADR_PAGE21): Likewise.
+ (R_AARCH64_TLSDESC_LD64_LO12): Likewise.
+ (R_AARCH64_TLSDESC_ADD_LO12): Likewise.
+ (R_AARCH64_TLSDESC_OFF_G1): Likewise.
+ (R_AARCH64_TLSDESC_OFF_G0_NC): Likewise.
+ (R_AARCH64_TLSDESC_LDR): Likewise.
+ (R_AARCH64_TLSDESC_ADD): Likewise.
+ (R_AARCH64_TLSDESC_CALL): Likewise.
+
+2013-09-30 Andreas Schwab <schwab@suse.de>
+
+ [BZ #15048]
+ * nscd/aicache.c (addhstaiX): Properly use the cache variable for
+ the nss database lookup.
+ * nscd/initgrcache.c (addinitgroupsX): Likewise.
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
+
+2013-09-28 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/tst-fanotify.c (do_test): Fix style.
+
+2013-09-28 P. J. McDermott <pj@pehjota.net>
+
+ * sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Don't use
+ ${Bash-specific parameter/pattern/string} parameter expansion.
+ * sysdeps/unix/make-syscalls.sh: Likewise.
+
+2013-09-27 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/sh/stackguard-macros.h: New file.
+
+2013-09-26 Ondřej Bílka <neleai@seznam.cz>
+
+ * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Update.
+ * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Remove strrchr ifunc.
+ * sysdeps/x86_64/multiarch/strend-sse4.S Remove.
+ * sysdeps/x86_64/multiarch/strrchr-sse2-no-bsf.S Likewise.
+ * sysdeps/x86_64/multiarch/strrchr.S: Likewise.
+ * sysdeps/x86_64/strrchr.S (strrchr): Use optimized implementation.
+
+2013-09-25 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/powerpc64/stackguard-macros.h (POINTER_CHK_GUARD:
+ Fix thread ID register.
+
+2013-09-25 Joseph Myers <joseph@codesourcery.com>
+
+ * conform/data/sched.h-data [XPG3 || XPG4]: Disable whole file.
+ [POSIX || UNIX98]: Require rather than permitting all symbols from
+ <time.h>.
+ [POSIX || UNIX98] (sched_ss_low_priority): Do not specify optional
+ element of struct sched_param.
+ [POSIX || UNIX98] (sched_ss_repl_period): Likewise.
+ [POSIX || UNIX98] (sched_ss_init_budget): Likewise.
+ [POSIX || UNIX98] (sched_ss_max_repl): Likewise.
+ [POSIX || UNIX98] (SCHED_SPORADIC): Do not specify optional
+ constant.
+
+2013-09-24 Olivier Langlois <olivier@olivierlanglois.net>
+
+ * stdio-common/tst-long-dbl-fphex.c (do_test): Fix swprintf length
+ argument calculation.
+
+2013-09-24 Joseph Myers <joseph@codesourcery.com>
+
+ * conform/data/pthread.h-data [POSIX] (PTHREAD_MUTEX_INITIALIZER):
+ Expect macro.
+ [POSIX] (pthread_attr_t): Do not require type.
+ [POSIX] (pthread_cond_t): Likewise.
+ [POSIX] (pthread_condattr_t): Likewise.
+ [POSIX] (pthread_key_t): Likewise.
+ [POSIX] (pthread_mutex_t): Likewise.
+ [POSIX] (pthread_mutexattr_t): Likewise.
+ [POSIX] (pthread_once_t): Likewise.
+ [POSIX] (pthread_t): Likewise.
+ [POSIX-based standards] (pthread_atfork): Expect function.
+
+2013-09-24 Joseph Myers <joseph@codesourcery.com>
+ Richard Sandiford <richard@codesourcery.com>
+
+ * locale/programs/locfile.h: Include <byteswap.h> and <stdbool.h>.
+ (swap_endianness_p): New extern variable.
+ (set_big_endian): New inline function.
+ (maybe_swap_uint32): Likewise.
+ (maybe_swap_uint32_array): Likewise.
+ (maybe_swap_uint32_obstack): Likewise.
+ * locale/programs/locfile.c: Include <stdbool.h>.
+ (swap_endianness_p): New variable.
+ (add_locale_uint32): Call maybe_swap_uint32.
+ (add_locale_uint32_array): Call maybe_swap_uint32_obstack.
+ (write_locale_data): Call maybe_swap_uint32_array.
+ * locale/programs/ld-collate.c (obstack_int32_grow): Call
+ maybe_swap_uint32.
+ (obstack_int32_grow_fast): Likewise.
+ (output_weightwc): Call maybe_swap_uint32_obstack.
+ (collate_output): Likewise.
+ * locale/programs/localedef.c (OPT_LITTLE_ENDIAN): New macro.
+ (OPT_LITTLE_ENDIAN): Likewise.
+ (options): Add --little-endian and --big-endian options.
+ (parse_opt): Handle OPT_LITTLE_ENDIAN and OPT_BIG_ENDIAN.
+ * locale/programs/locarchive.c: Include "locfile.h".
+ (GET): New macro.
+ (SET): Likewise.
+ (INC): Likewise.
+ (create_archive): Use the new macros to access fields of
+ structures directly mapped from or written to locale archives.
+ (oldlocrecentcmp): Likewise.
+ (enlarge_archive): Likewise.
+ (insert_name): Likewise.
+ (add_alias): Likewise.
+ (add_locale): Likewise.
+ (delete_locales_from_archive): Likewise.
+ (show_archive_content): Likewise.
+ (add_locale_to_archive): Likewise. Use maybe_swap_uint32 on
+ locale data.
+
+2013-09-24 Roland McGrath <roland@hack.frob.com>
+
+ * manual/freemanuals.texi: Updated from (newly) canonical copy at
+ http://www.gnu.org/doc/freemanuals.texi.
+ * manual/libc.texinfo (Free Manuals): Put the @appendix line here.
+
+2013-09-24 Will Newton <will.newton@linaro.org>
+
+ * sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
+ macro.
+
+2013-09-23 Joseph Myers <joseph@codesourcery.com>
+
+ * locale/hashval.h (compute_hashval): Interpret bytes of key as
+ unsigned char.
+
+2013-09-23 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * manual/threads.texi (POSIX Threads): Fix a typo.
+
+2013-09-23 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #14547]
+ * string/tst-strcoll-overflow.c: New test case.
+ * string/Makefile (xtests): Add tst-strcoll-overflow.
+ * string/strcoll_l.c (STRCOLL): Skip allocating memory for
+ cache if string sizes may cause integer overflow.
+
+ [BZ #14547]
+ * string/strcoll_l.c (coll_seq): New members rule, idx,
+ save_idx and back_us.
+ (get_next_seq_nocache): New function.
+ (do_compare_nocache): New function.
+ (STRCOLL): Use get_next_seq_nocache and do_compare_nocache
+ when malloc fails.
+
+2013-09-23 Carlos O'Donell <carlos@redhat.com>
+
+ [BZ #15754]
+ * sysdeps/generic/stackguard-macros.h: If PTRGUARD_LOCAL use
+ __pointer_chk_guard_local, otherwise __pointer_chk_guard.
+ * elf/Makefile: Define CFLAGS-tst-ptrguard1-static.c.
+
+ [BZ #15754]
+ * elf/Makefile (tests): Add tst-ptrguard1.
+ (tests-static): Add tst-ptrguard1-static.
+ (tst-ptrguard1-ARGS): Define.
+ (tst-ptrguard1-static-ARGS): Define.
+ * elf/tst-ptrguard1.c: New file.
+ * elf/tst-ptrguard1-static.c: New file.
+ * sysdeps/x86_64/stackguard-macros.h: Define POINTER_CHK_GUARD.
+ * sysdeps/i386/stackguard-macros.h: Likewise.
+ * sysdeps/powerpc/powerpc32/stackguard-macros.h: Likewise.
+ * sysdeps/powerpc/powerpc64/stackguard-macros.h: Likewise.
+ * sysdeps/s390/s390-32/stackguard-macros.h: Likewise.
+ * sysdeps/s390/s390-64/stackguard-macros.h: Likewise.
+ * sysdeps/sparc/sparc32/stackguard-macros.h: Likewise.
+ * sysdeps/sparc/sparc64/stackguard-macros.h: Likewise.
+
+2013-09-23 Hector Marco <hecmargi@upv.es>
+ Ismael Ripoll <iripoll@disca.upv.es>
+ Carlos O'Donell <carlos@redhat.com>
+
+ [BZ #15754]
+ * sysdeps/generic/stackguard-macros.h: Define
+ __pointer_chk_guard_local and POINTER_CHK_GUARD.
+ * csu/libc-start.c [!SHARED && !THREAD_SET_POINTER_GUARD]:
+ Define __pointer_chk_guard_local.
+ (LIBC_START_MAIN) [!SHARED]: Call _dl_setup_pointer_guard.
+ Use THREAD_SET_POINTER_GUARD or set __pointer_chk_guard_local.
+
+2013-09-15 Vinitha Vijayan <vinitha.vijayann@gmail.com>
+
+ [BZ #15859]
+ * elf/dl-deps.c (_dl_map_object_deps): Remove duplicate declaration.
+
+2013-09-20 Andreas Schwab <schwab@linux-m68k.org>
+
+ * include/string.h (__ffs): Declare as hidden.
+ * string/ffs.c (__ffs): Define as hidden.
+ * sysdeps/i386/ffs.c (__ffs): Likewise.
+ * sysdeps/i386/i686/ffs.c (__ffs): Likewise.
+ * sysdeps/powerpc/ffs.c (__ffs): Likewise.
+ * sysdeps/s390/ffs.c (__ffs): Likewise.
+ * sysdeps/x86_64/ffs.c (__ffs): Likewise.
+
+2013-09-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * NEWS: Mention malloc probes.
+
+ * malloc/arena.c (new_heap): New memory_heap_new probe.
+ (grow_heap): New memory_heap_more probe.
+ (shrink_heap): New memory_heap_less probe.
+ (heap_trim): New memory_heap_free probe.
+ * malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
+ (systrim): New memory_sbrk_less probe.
+ * manual/probes.texi: Document them.
+
+ * malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
+ * manual/probes.texi: Document it.
+
+ * malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
+ (__libc_realloc): Add memory_realloc_retry probe.
+ (__libc_memalign): Add memory_memalign_retry probe.
+ (__libc_valloc): Add memory_valloc_retry probe.
+ (__libc_pvalloc): Add memory_pvalloc_retry probe.
+ (__libc_calloc): Add memory_calloc_retry probe.
+ * manual/probes.texi: Document them.
+
+ * malloc/arena.c (get_free_list): Add probe
+ memory_arena_reuse_free_list.
+ (reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
+ and memory_arena_reuse.
+ (arena_get2) [!PER_THREAD]: Likewise.
+ * malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
+ memory_arena_reuse_realloc.
+ * manual/probes.texi: Document them.
+
+ * malloc/malloc.c (__libc_free): Add
+ memory_mallopt_free_dyn_thresholds probe.
+ (__libc_mallopt): Add multiple memory_mallopt probes.
+ * manual/probes.texi: Document them.
+
+ * malloc/malloc.c: Include stap-probe.h.
+ (__libc_mallopt): Add memory_mallopt probe.
+ * malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
+ * manual/probes.texi: New.
+ * manual/Makefile (chapters): Add probes.
+ * manual/threads.texi: Set next node.
+
+2013-09-19 Wei-Lun Chao <bluebat@member.fsf.org>
+
+ [BZ #15963, #13985]
+ * locale/iso-639.def: Add Chiga (cgg) and Chinese (gan, hak,
+ czh, cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
+ Add `Chinese' to `nan' entry name.
+
+2013-09-19 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (POLYNOMIAL2): New macro.
+ (POLYNOMIAL): Likewise.
+ (TAYLOR_SINCOS): Likewise.
+ (TAYLOR_SLOW): Likewise.
+ (__sin): Use TAYLOR_SINCOS.
+ (__cos): Likewise.
+ (slow): Use TAYLOR_SLOW.
+ (sloww): Likewise.
+ (bsloww): Likewise.
+ (csloww): Likewise.
+
+2013-09-19 Liubov Dmitrieva <liubov.dmitrieva@intel.com>
+
+ * stdlib/strtod_l.c: Fix buffer overrun.
+
+2013-09-19 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * benchtests/Makefile (bench): Add sincos.
+ * benchtests/bench-sincos.c: New file.
+
+ * math/libm-test.inc (cos_test_data): New test inputs.
+ (sin_test_data): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (SINCOS_TABLE_LOOKUP): New
+ macro.
+ (__sin): Use it.
+ (__cos): Likewise.
+ (slow1): Likewise.
+ (slow2): Likewise.
+ (sloww1): Likewise.
+ (sloww2): Likewise.
+ (bsloww1): Likewise.
+ (bsloww2): Likewise.
+ (cslow2): Likewise.
+ (csloww1): Likewise.
+ (csloww2): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute): New
+ function.
+ (__sin): Use it.
+ (__cos): Likewise.
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (__sin): Remove redundant
+ gotos.
+ (__cos): Likewise.
+
+2013-09-18 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config.h.in (HAVE_MIPS_NAN2008): New macro.
+ * elf/elf.h (EF_MIPS_NAN2008): Likewise.
+ * sysdeps/generic/ldconfig.h (FLAG_MIPS_LIB32_NAN2008): Likewise.
+ (FLAG_MIPS64_LIBN32_NAN2008): Likewise.
+ (FLAG_MIPS64_LIBN64_NAN2008): Likewise.
+ * elf/cache.c (print_entry): Handle the new cache flags.
+
+2013-09-18 Joseph Myers <joseph@codesourcery.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ * sysdeps/powerpc/fpu_control.h [_SOFT_FLOAT || __NO_FPRS__]:
+ Change condition to [_SOFT_FLOAT].
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_NEAREST): New macro.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_DOWN): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_UP): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RC_ZERO): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_ZM): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_OM): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_UM): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_XM): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_IM): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RESERVED): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_DEFAULT): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_IEEE): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (fpu_control_t): New typedef.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_GETCW): New macro.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_SETCW): Likewise.
+ [__NO_FPRS__ && !_SOFT_FLOAT] (__fpu_control): New variable
+ declaration.
+
+2013-09-18 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/powerpc32/__longjmp-common.S (LOAD_GP): Define
+ macro conditional on [__SPE__ || (__NO_FPRS__ && !_SOFT_FLOAT)].
+ (__longjmp): Use LOAD_GP to load saved GPRs.
+ * sysdeps/powerpc/powerpc32/setjmp-common.S (SAVE_GP): Define
+ macro conditional on [__SPE__ || (__NO_FPRS__ && !_SOFT_FLOAT)].
+ (__sigsetjmp): Use SAVE_GP to save GPRs.
+
+ * sysdeps/powerpc/powerpc32/Makefile [$(with-fp) = no] (+cflags):
+ Do not append -msoft-float.
+ [$(with-fp) = no] (sysdep-LDFLAGS): Likewise.
+
+2013-09-18 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/sincos32.c: Fix code formatting.
+
+2013-09-17 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #15966]
+ * sysdeps/powerpc/fpu_control.h [!_SOFT_FLOAT && !__NO_FPRS__]
+ (_FPU_GETCW): Use initial "__" on variable and field names but not
+ on macro parameter name.
+ [!_SOFT_FLOAT && !__NO_FPRS__] (_FPU_SETCW): Likewise. Use
+ parentheses around reference to macro parameter.
+
+2013-09-13 Richard Sandiford <richard@codesourcery.com>
+
+ * locale/programs/ld-ctype.c (find_idx): Use uint32_t in
+ prototype.
+ (ctype_startup): Use uint32_t in cast and sizeof for
+ ctype->charnames.
+
+2013-09-11 Jia Liu <proljc@gmail.com>
+
+ * sunrpc/rpc/types.h [__APPLE_CC__]: Define __u_char_defined and
+ __daddr_t_defined.
+ [__FreeBSD__]: Likewise.
+
+2013-09-11 Ondřej Bílka <neleai@seznam.cz>
+
+ * sysdeps/x86_64/multiarch/ifunc-impl-list.c
+ (__libc_ifunc_impl_list): Remove: __strchr_sse42.
+ * sysdeps/x86_64/multiarch/strchr.S (__strchr_sse42): Remove.
+ (strchr): Remove __strchr_sse42 ifunc selection.
+ * sysdeps/x86_64/strchr.S (strchr): Use optimized implementation.
+ * sysdeps/x86_64/strchrnul.S: Include sysdeps/x86_64/strchr.S.
+
+2013-09-11 Will Newton <will.newton@linaro.org>
+
+ * benchtests/bench-timing.h (TIMING_INIT): Rename ITERS
+ parameter to RES. Remove hardcoded 1000 value.
+ * benchtests/bench-skeleton.c (main): Pass RES parameter
+ to TIMING_INIT and multiply result by 1000.
+
+2013-09-10 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/fpu/libm-test-ulps: Update.
+
+2013-09-11 Andreas Schwab <schwab@suse.de>
+
+ * sysdeps/unix/sysv/linux/bits/fcntl-linux.h (__O_TMPFILE): Define
+ if not defined.
+ (O_TMPFILE) [__USE_GNU]: Define.
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (__O_TMPFILE):
+ Define.
+
+2013-09-11 Will Newton <will.newton@linaro.org>
+
+ [BZ #15857]
+ * malloc/malloc.c (__libc_memalign): Check the value of bytes
+ does not overflow.
+
+2013-09-11 Will Newton <will.newton@linaro.org>
+
+ [BZ #15856]
+ * malloc/malloc.c (__libc_valloc): Check the value of bytes
+ does not overflow.
+
+2013-09-11 Will Newton <will.newton@linaro.org>
+
+ [BZ #15855]
+ * malloc/malloc.c (__libc_pvalloc): Check the value of bytes
+ does not overflow.
+
+2013-09-10 Ondřej Bílka <neleai@seznam.cz>
+
+ * sysdeps/ieee754/dbl-64/e_j0.c: Remove DO_NOT_USE_THIS conditionals.
+ * sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_expm1.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_log1p.c: Likewise.
+
+2013-09-10 Allan McRae <allan@archlinux.org>
+
+ [BZ #15748]
+ * manual/arith.texi (Parsing of Floats): Clarify
+ cross-reference.
+
+ [BZ #15849]
+ * manual/install.texi (Running make install): Mention
+ --enable-pt-chown.
+ * INSTALL: Regenerated.
+
+2013-09-09 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * csu/init-first.c (_init): Remove the !SHARED condition around
+ FPU control word initialization.
+ * elf/dl-support.c (_dl_fpu_control): New variable.
+ (_dl_aux_init) <AT_FPUCW>: Initialize it.
+ * math/test-fpucw.c [!FPU_CONTROL] (FPU_CONTROL): New macro.
+ (main): Replace _FPU_DEFAULT with FPU_CONTROL throughout.
+ * math/test-fpucw-static.c: New file.
+ * math/test-fpucw-ieee.c: New file.
+ * math/test-fpucw-ieee-static.c: New file.
+ * math/Makefile (tests): Add `test-fpucw-ieee' and
+ `$(tests-static)'.
+ (tests-static): New variable.
+ [($(build-shared),yes)] ($(addprefix $(objpfx),$(tests))): Move
+ dependency to...
+ [($(build-shared),yes)]
+ ($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
+ ... this.
+ [($(build-shared),yes)] ($(addprefix $(objpfx),$(tests-static))):
+ New dependency.
+
+2013-09-09 Allan McRae <allan@archlinux.org>
+
+ [BZ #15939]
+ * manual/string.texi (Collation Functions): Fix typo in
+ strcoll example.
+ Reported by Suren Karapetyan <me@suren.karapetyan.name>.
+
+ [BZ #15893]
+ * stdlib/isomac.c (get_null_defines): Fix memory leak.
+
+ [BZ #15892]
+ * libio/memstream.c (open_memstream): Fix memory leak.
+ * libio/wmemstream.c (open_wmemstream): Likewise.
+
+ [BZ #15895]
+ * nscd/netgroupcache.c: Fix nesting of ifdefs.
+
+2013-09-09 Will Newton <will.newton@linaro.org>
+
+ * malloc/Makefile: Add tst-realloc to tests.
+ * malloc/tst-realloc.c: New file.
+
+2013-09-09 Allan McRae <allan@archlinux.org>
+
+ [BZ #15844]
+ * COPYING: Update from GNU website to fix FSF address.
+ * COPYING.LIB: Likewise.
+
+2013-09-06 David S. Miller <davem@davemloft.net>
+
+ * po/zh_TW.po: Update Chinese (traditional) translation from
+ translation project.
+
2013-09-06 Richard Sandiford <richard@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
@@ -132,7 +1984,7 @@
2013-09-04 Chris Leonard <cjl@sugarlabs,.org>
- [BZ #15923]
+ [BZ #15923]
* locale/iso-4217.def: Update iso-1427.def and related occurrences.
2013-09-04 Joseph Myers <joseph@codesourcery.com>
diff --git a/libc/INSTALL b/libc/INSTALL
index efbdd7bac..9d55fccca 100644
--- a/libc/INSTALL
+++ b/libc/INSTALL
@@ -297,14 +297,11 @@ dramatically improve performance with NIS+, and may help with DNS as
well.
One auxiliary program, `/usr/libexec/pt_chown', is installed setuid
-`root'. This program is invoked by the `grantpt' function; it sets the
-permissions on a pseudoterminal so it can be used by the calling
-process. This means programs like `xterm' and `screen' do not have to
-be setuid to get a pty. (There may be other reasons why they need
-privileges.) If you are using a Linux kernel with the `devptsfs' or
-`devfs' filesystems providing pty slaves, you don't need this program;
-otherwise you do. The source for `pt_chown' is in
-`login/programs/pt_chown.c'.
+`root' if the `--enable-pt_chown' configuration option is used. This
+program is invoked by the `grantpt' function; it sets the permissions
+on a pseudoterminal so it can be used by the calling process. If you
+are using a Linux kernel with the `devpts' filesystem enabled and
+mounted at `/dev/pts', you don't need this program.
After installation you might want to configure the timezone and
locale installation of your system. The GNU C Library comes with a
diff --git a/libc/Makefile b/libc/Makefile
index ff821e677..1ff2a785b 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -132,36 +132,7 @@ lib-noranlib: subdir_lib
ifeq (yes,$(build-shared))
# Build the shared object from the PIC object library.
-lib: $(common-objpfx)libc.so
-
-lib: $(common-objpfx)linkobj/libc.so
-
-# Do not filter ld.so out of libc.so link.
-$(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
-
-$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
- $(common-objpfx)linkobj/libc_pic.a \
- $(elfobjdir)/sofini.os \
- $(elfobjdir)/interp.os \
- $(elfobjdir)/ld.so \
- $(shlib-lds)
- $(build-shlib)
-
-ifeq (,$(filter sunrpc,$(subdirs)))
-$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
- $(make-target-directory)
- ln -f $< $@
-else
-$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
- $(common-objpfx)sunrpc/librpc_compat_pic.a
- $(make-target-directory)
- (cd $(common-objpfx)linkobj; \
- $(AR) x ../libc_pic.a; \
- rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
- $(AR) x ../sunrpc/librpc_compat_pic.a; \
- $(AR) cr libc_pic.a *.os; \
- rm *.os)
-endif # $(subdirs) contains sunrpc
+lib: $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so
endif # $(build-shared)
diff --git a/libc/Makerules b/libc/Makerules
index be6f4b886..edc0312e2 100644
--- a/libc/Makerules
+++ b/libc/Makerules
@@ -584,16 +584,47 @@ generated += libc_pic.opts libc_pic.os.clean
libc_pic_clean := .clean
endif
-# Do not filter ld.so out of libc.so link.
+# Build a possibly-modified version of libc_pic.a for use in building
+# linkobj/libc.so.
+ifeq (,$(filter sunrpc,$(subdirs)))
+$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
+ $(make-target-directory)
+ ln -f $< $@
+else
+$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
+ $(common-objpfx)sunrpc/librpc_compat_pic.a
+ $(make-target-directory)
+ (cd $(common-objpfx)linkobj; \
+ $(AR) x ../libc_pic.a; \
+ rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
+ $(AR) x ../sunrpc/librpc_compat_pic.a; \
+ $(AR) cr libc_pic.a *.os; \
+ rm *.os)
+endif # $(subdirs) contains sunrpc
+
+# Clear link-libc-deps for the libc.so libraries so build-shlibs does not
+# filter ld.so out of the list of linked objects.
$(common-objpfx)libc.so: link-libc-deps = # empty
+$(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
-# Use our own special initializer and finalizer files for libc.so.
+# Use our own special initializer and finalizer files for the libc.so
+# libraries.
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
$(common-objpfx)libc_pic.os$(libc_pic_clean) \
$(elfobjdir)/sofini.os \
- $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
+ $(elfobjdir)/interp.os \
+ $(elfobjdir)/ld.so \
+ $(shlib-lds)
+ $(build-shlib)
+
+$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
+ $(common-objpfx)linkobj/libc_pic.a \
+ $(elfobjdir)/sofini.os \
+ $(elfobjdir)/interp.os \
+ $(elfobjdir)/ld.so \
$(shlib-lds)
$(build-shlib)
+
ifeq ($(build-shared),yes)
$(common-objpfx)libc.so: $(common-objpfx)libc.map
endif
diff --git a/libc/NEWS b/libc/NEWS
index eceea11b9..9e32ba5e2 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -9,19 +9,66 @@ Version 2.19
* The following bugs are resolved with this release:
- 14155, 14699, 15427, 15522, 15531, 15532, 15736, 15749, 15797, 15867,
- 15886, 15887, 15890, 15897, 15905, 15909, 15921.
+ 156, 431, 832, 13028, 13982, 13985, 14155, 14547, 14699, 14910, 15048,
+ 15218, 15277, 15308, 15362, 15400, 15427, 15522, 15531, 15532, 15608,
+ 15609, 15610, 15632, 15640, 15672, 15680, 15681, 15723, 15734, 15735,
+ 15736, 15748, 15749, 15754, 15760, 15764, 15797, 15844, 15847, 15849,
+ 15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893,
+ 15895, 15897, 15905, 15909, 15919, 15921, 15923, 15939, 15948, 15963,
+ 15966, 15988, 16032, 16034, 16036, 16041.
+
+* CVE-2012-4412 The strcoll implementation caches indices and rules for
+ large collation sequences to optimize multiple passes. This cache
+ computation may overflow for large collation sequences and may cause a
+ stack or buffer overflow. This is now fixed to use a slower algorithm
+ which does not use a cache if there is an integer overflow.
+
+* CVE-2012-4424 The strcoll implementation uses malloc to cache indices and
+ rules for large collation sequences to optimize multiple passes and falls
+ back to alloca if malloc fails, resulting in a possible stack overflow.
+ The implementation now falls back to an uncached collation sequence lookup
+ if malloc fails.
+
+* CVE-2013-4788 The pointer guard used for pointer mangling was not
+ initialized for static applications resulting in the security feature
+ being disabled. The pointer guard is now correctly initialized to a
+ random value for static applications. Existing static applications need
+ to be recompiled to take advantage of the fix (bug 15754).
* CVE-2013-4237 The readdir_r function could write more than NAME_MAX bytes
to the d_name member of struct dirent, or omit the terminating NUL
character. (Bugzilla #14699).
-* New locales: quz_PE.
+* CVE-2013-4332 The pvalloc, valloc, memalign, posix_memalign and
+ aligned_alloc functions could allocate too few bytes or corrupt the
+ heap when passed very large allocation size values (Bugzilla #15855,
+ #15856, #15857).
-* Add country_car field to LC_ADDRESS, many locales.
+* New locales: ak_GH, cmn_TW, hak_TW, lzh_TW, nan_TW, quz_PE, pap_AW, pap_CW,
+ ar_SS.
-* Update iso-1427.def and related occurrences.
+* Substantially revised locales: gd_GB, ht_HT
+* The LC_ADDRESS field was updated to support country_car for almost all
+ supported locales.
+
+* ISO 1427 definitions were updated.
+
+* ISO 3166 definitions were updated.
+
+* The localedef utility now supports --big-endian and --little-endian
+ command-line options to generate locales for a different system from that
+ for which the C library was built.
+
+* The configure option --disable-versioning has been removed. Builds with
+ --disable-versioning had not worked for several years.
+
+* ISO 639 definitions were updated for Chiga (cgg) and Chinese (gan, hak, czh,
+ cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
+
+* SystemTap probes for malloc have been introduced.
+
+* Support for powerpc64le has been added.
Version 2.18
diff --git a/libc/README b/libc/README
index dfbd13253..f6c61dc40 100644
--- a/libc/README
+++ b/libc/README
@@ -54,8 +54,8 @@ The GNU C Library supports these configurations for using Linux kernels:
i[4567]86-*-linux-gnu
x86_64-*-linux-gnu Can build either x86_64 or x32
- powerpc-*-linux-gnu Hardware floating point required
- powerpc64-*-linux-gnu
+ powerpc-*-linux-gnu Hardware or software floating point, BE only.
+ powerpc64*-*-linux-gnu Big-endian and little-endian.
s390-*-linux-gnu
s390x-*-linux-gnu
sh[34]-*-linux-gnu
@@ -75,7 +75,6 @@ located in the `ports' subdirectory of the source tree.
m68k-*-linux-gnu
mips-*-linux-gnu
mips64-*-linux-gnu
- powerpc-*-linux-gnu Software floating point (--without-fp)
tilegx-*-linux-gnu
tilepro-*-linux-gnu
diff --git a/libc/benchtests/Makefile b/libc/benchtests/Makefile
index 9cb4ff900..aec395a81 100644
--- a/libc/benchtests/Makefile
+++ b/libc/benchtests/Makefile
@@ -21,7 +21,7 @@
subdir := benchtests
bench := acos acosh asin asinh atan atanh cos cosh exp log modf pow rint sin \
- sinh tan tanh
+ sincos sinh tan tanh
# String function benchmarks.
string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
@@ -34,69 +34,23 @@ string-bench-all := $(string-bench) $(string-bench-ifunc)
benchset := $(string-bench-all)
-acos-ARGLIST = double
-acos-RET = double
LDLIBS-bench-acos = -lm
-
-acosh-ARGLIST = double
-acosh-RET = double
LDLIBS-bench-acosh = -lm
-
-asin-ARGLIST = double
-asin-RET = double
LDLIBS-bench-asin = -lm
-
-asinh-ARGLIST = double
-asinh-RET = double
LDLIBS-bench-asinh = -lm
-
-atan-ARGLIST = double
-atan-RET = double
LDLIBS-bench-atan = -lm
-
-atanh-ARGLIST = double
-atanh-RET = double
LDLIBS-bench-atanh = -lm
-
-cos-ARGLIST = double
-cos-RET = double
LDLIBS-bench-cos = -lm
-
-cosh-ARGLIST = double
-cosh-RET = double
LDLIBS-bench-cosh = -lm
-
-exp-ARGLIST = double
-exp-RET = double
LDLIBS-bench-exp = -lm
-
-log-ARGLIST = double
-log-RET = double
LDLIBS-bench-log = -lm
-
-pow-ARGLIST = double:double
-pow-RET = double
LDLIBS-bench-pow = -lm
-
-rint-ARGLIST = double
-rint-RET = double
LDLIBS-bench-rint = -lm
-
-sin-ARGLIST = double
-sin-RET = double
LDLIBS-bench-sin = -lm
-
-sinh-ARGLIST = double
-sinh-RET = double
LDLIBS-bench-sinh = -lm
-
-tan-ARGLIST = double
-tan-RET = double
LDLIBS-bench-tan = -lm
-
-tanh-ARGLIST = double
-tanh-RET = double
LDLIBS-bench-tanh = -lm
+LDLIBS-bench-sincos = -lm
@@ -169,6 +123,5 @@ $(objpfx)bench-%.c: %-inputs $(bench-deps)
{ if [ -n "$($*-INCLUDE)" ]; then \
cat $($*-INCLUDE); \
fi; \
- $(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
- $($*-ARGLIST) $($*-RET); } > $@-tmp
+ $(..)scripts/bench.pl $(patsubst %-inputs,%,$<); } > $@-tmp
mv -f $@-tmp $@
diff --git a/libc/benchtests/README b/libc/benchtests/README
index 045b7a673..0c643a659 100644
--- a/libc/benchtests/README
+++ b/libc/benchtests/README
@@ -40,23 +40,27 @@ one to add `foo' to the bench tests:
- Append the function name to the bench variable in the Makefile.
-- Define foo-ARGLIST as a colon separated list of types of the input
- arguments. Use `void' if function does not take any inputs. Put in quotes
- if the input argument is a pointer, e.g.:
-
- malloc-ARGLIST: "void *"
-
-- Define foo-RET as the type the function returns. Skip if the function
- returns void. One could even skip foo-ARGLIST if the function does not
- take any inputs AND the function returns void.
-
-- Make a file called `foo-inputs` with one input value per line, an input
- being a comma separated list of arguments to be passed into the function.
- See pow-inputs for an example.
-
- The script that parses the -inputs file treats lines beginning with a single
- `#' as comments. Lines beginning with two hashes `##' are treated specially
- as `directives'.
+- Make a file called `foo-inputs` to provide the definition and input for the
+ function. The file should have some directives telling the parser script
+ about the function and then one input per line. Directives are lines that
+ have a special meaning for the parser and they begin with two hashes '##'.
+ The following directives are recognized:
+
+ - args: This should be assigned a colon separated list of types of the input
+ arguments. This directive may be skipped if the function does not take any
+ inputs.
+ - ret: This should be assigned the type that the function returns. This
+ directive may be skipped if the function does not return a value.
+ - includes: This should be assigned a comma-separated list of headers that
+ need to be included to provide declarations for the function and types it
+ may need (specifically, this includes using "#include <header>").
+ - include-sources: This should be assigned a comma-separated list of source
+ files that need to be included to provide definitions of global variables
+ and functions (specifically, this includes using "#include "source").
+ - name: See following section for instructions on how to use this directive.
+
+ Lines beginning with a single hash '#' are treated as comments. See
+ pow-inputs for an example of an input file.
Multiple execution units per function:
=====================================
diff --git a/libc/benchtests/acos-inputs b/libc/benchtests/acos-inputs
index b527af35e..080a4e916 100644
--- a/libc/benchtests/acos-inputs
+++ b/libc/benchtests/acos-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.5
0.1
0.2
diff --git a/libc/benchtests/acosh-inputs b/libc/benchtests/acosh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/acosh-inputs
+++ b/libc/benchtests/acosh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/benchtests/asin-inputs b/libc/benchtests/asin-inputs
index b527af35e..080a4e916 100644
--- a/libc/benchtests/asin-inputs
+++ b/libc/benchtests/asin-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.5
0.1
0.2
diff --git a/libc/benchtests/asinh-inputs b/libc/benchtests/asinh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/asinh-inputs
+++ b/libc/benchtests/asinh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/benchtests/atan-inputs b/libc/benchtests/atan-inputs
index 4a2cf3aca..e88e38434 100644
--- a/libc/benchtests/atan-inputs
+++ b/libc/benchtests/atan-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0x1.000000c5cba86p0
0x1.000001883003ap0
0x1.00000dfb2b674p0
diff --git a/libc/benchtests/atanh-inputs b/libc/benchtests/atanh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/atanh-inputs
+++ b/libc/benchtests/atanh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/benchtests/bench-sincos.c b/libc/benchtests/bench-sincos.c
new file mode 100644
index 000000000..7662dde04
--- /dev/null
+++ b/libc/benchtests/bench-sincos.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+extern void sincos (double, double *, double *);
+
+#define CALL_BENCH_FUNC(v, i, j, k) sincos ( variants[v].in[i].arg0, &j, &k);
+
+struct args
+{
+ volatile double arg0;
+};
+
+struct args in0[12] =
+{
+ { 0.9 },
+ { 2.3 },
+ { 3.7 },
+ { 3.9 },
+ { 4.0 },
+ { 4.7 },
+ { 5.9 },
+
+ { 0x1.000000cf4a2a1p0 },
+ { 0x1.0000010b239a8p0 },
+ { 0x1.00000162a932ap0 },
+ { 0x1.000002d452a11p0 },
+ { 0x1.000005bc7d86cp0 }
+};
+
+struct args in1[12] =
+{
+ { 0.93340582292648832662962377071381 },
+ { 2.3328432680770916363144351635128 },
+ { 3.7439477503636453548097051680088 },
+ { 3.9225160069792437411706487182528 },
+ { 4.0711651639931289992091478779912 },
+ { 4.7858438478542097982426639646292 },
+ { 5.9840767662578002727968851104379 },
+
+ { 0x1.000000cf4a2a2p0 },
+ { 0x1.0000010b239a9p0 },
+ { 0x1.00000162a932bp0 },
+ { 0x1.000002d452a10p0 },
+ { 0x1.000005bc7d86dp0 }
+};
+
+struct _variants
+{
+ const char *name;
+ int count;
+ struct args *in;
+};
+
+struct _variants variants[2] =
+ {
+ {"sincos()", 12, in0},
+ {"sincos(768bits)", 12, in1},
+ };
+
+#define NUM_VARIANTS 2
+#define NUM_SAMPLES(i) (variants[i].count)
+#define VARIANT(i) (variants[i].name)
+
+#define BENCH_FUNC(v, j) \
+({ \
+ volatile double iptr; \
+ volatile double iptr2; \
+ CALL_BENCH_FUNC (v, j, iptr, iptr2); \
+})
+
+#define FUNCNAME "sincos"
+#include "bench-skeleton.c"
diff --git a/libc/benchtests/bench-skeleton.c b/libc/benchtests/bench-skeleton.c
index 4e3a50704..05edc69c5 100644
--- a/libc/benchtests/bench-skeleton.c
+++ b/libc/benchtests/bench-skeleton.c
@@ -53,9 +53,11 @@ main (int argc, char **argv)
memset (&runtime, 0, sizeof (runtime));
- unsigned long iters;
+ unsigned long iters, res;
- TIMING_INIT (iters);
+ TIMING_INIT (res);
+
+ iters = 1000 * res;
for (int v = 0; v < NUM_VARIANTS; v++)
{
diff --git a/libc/benchtests/bench-timing.h b/libc/benchtests/bench-timing.h
index 009813bb8..48a85210a 100644
--- a/libc/benchtests/bench-timing.h
+++ b/libc/benchtests/bench-timing.h
@@ -25,10 +25,10 @@
hp_timing_t _dl_hp_timing_overhead;
typedef hp_timing_t timing_t;
-# define TIMING_INIT(iters) \
+# define TIMING_INIT(res) \
({ \
HP_TIMING_DIFF_INIT(); \
- (iters) = 1000; \
+ (res) = 1; \
})
# define TIMING_NOW(var) HP_TIMING_NOW (var)
@@ -43,15 +43,13 @@ typedef hp_timing_t timing_t;
#else
typedef uint64_t timing_t;
-/* Measure 1000 times the resolution of the clock. So for a 1ns
- resolution clock, we measure 1000 iterations of the function call at a
- time. Measurements close to the minimum clock resolution won't make
- much sense, but it's better than having nothing at all. */
-# define TIMING_INIT(iters) \
+/* Measure the resolution of the clock so we can scale the number of
+ benchmark iterations by this value. */
+# define TIMING_INIT(res) \
({ \
struct timespec start; \
clock_getres (CLOCK_PROCESS_CPUTIME_ID, &start); \
- (iters) = 1000 * start.tv_nsec; \
+ (res) = start.tv_nsec; \
})
# define TIMING_NOW(var) \
diff --git a/libc/benchtests/cos-inputs b/libc/benchtests/cos-inputs
index 82a40609c..c7bbaad15 100644
--- a/libc/benchtests/cos-inputs
+++ b/libc/benchtests/cos-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0x1.000000cf4a2a1p0
0x1.0000010b239a8p0
0x1.00000162a932ap0
diff --git a/libc/benchtests/cosh-inputs b/libc/benchtests/cosh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/cosh-inputs
+++ b/libc/benchtests/cosh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/benchtests/exp-inputs b/libc/benchtests/exp-inputs
index e9d33a3d1..593ad7c74 100644
--- a/libc/benchtests/exp-inputs
+++ b/libc/benchtests/exp-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
42
# Slowest path with computation in 768 bit precision.
# Implemented in: sysdeps/ieee754/dbl-64/mpexp.c
diff --git a/libc/benchtests/log-inputs b/libc/benchtests/log-inputs
index 713c2229f..c92d78ce6 100644
--- a/libc/benchtests/log-inputs
+++ b/libc/benchtests/log-inputs
@@ -1 +1,4 @@
+## args: double
+## ret: double
+## includes: math.h
42.0
diff --git a/libc/benchtests/pow-inputs b/libc/benchtests/pow-inputs
index dad65059a..96b1b6c2a 100644
--- a/libc/benchtests/pow-inputs
+++ b/libc/benchtests/pow-inputs
@@ -1,3 +1,6 @@
+## args: double:double
+## ret: double
+## includes: math.h
42.0, 42.0
# pow slowest path at 768 bits
# Implemented in sysdeps/ieee754/dbl-64/slowpow.c
diff --git a/libc/benchtests/rint-inputs b/libc/benchtests/rint-inputs
index a5f83dc8f..e9001f92e 100644
--- a/libc/benchtests/rint-inputs
+++ b/libc/benchtests/rint-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
78.5
-78.5
4503599627370497.0
diff --git a/libc/benchtests/sin-inputs b/libc/benchtests/sin-inputs
index 08192d8f0..ae452a82d 100644
--- a/libc/benchtests/sin-inputs
+++ b/libc/benchtests/sin-inputs
@@ -1,3 +1,6 @@
+## includes: math.h
+## args: double
+## ret: double
0.9
2.3
3.7
diff --git a/libc/benchtests/sinh-inputs b/libc/benchtests/sinh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/sinh-inputs
+++ b/libc/benchtests/sinh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/benchtests/tan-inputs b/libc/benchtests/tan-inputs
index 629414fc7..f489ddde8 100644
--- a/libc/benchtests/tan-inputs
+++ b/libc/benchtests/tan-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0x1.dffffffffff1ep-22
# tan slowest path at 768 bits
# Implemented in sysdeps/ieee754/dbl-64/mptan.c
diff --git a/libc/benchtests/tanh-inputs b/libc/benchtests/tanh-inputs
index 3c8c546f0..84a603dc3 100644
--- a/libc/benchtests/tanh-inputs
+++ b/libc/benchtests/tanh-inputs
@@ -1,3 +1,6 @@
+## args: double
+## ret: double
+## includes: math.h
0.1
0.2
0.3
diff --git a/libc/config.h.in b/libc/config.h.in
index 30568e3af..0ee1ec6f5 100644
--- a/libc/config.h.in
+++ b/libc/config.h.in
@@ -238,4 +238,8 @@
/* The pt_chown binary is being built and used by grantpt. */
#undef HAVE_PT_CHOWN
+/* ports/sysdeps/mips/configure.in */
+/* Define if using the IEEE 754-2008 NaN encoding on the MIPS target. */
+#undef HAVE_MIPS_NAN2008
+
#endif
diff --git a/libc/configure b/libc/configure
index 3eb345cb5..deab3950b 100755
--- a/libc/configure
+++ b/libc/configure
@@ -3958,8 +3958,8 @@ fi
# base_machine, we don't change it.
test -n "$base_machine" || case "$machine" in
i[4567]86) base_machine=i386 machine=i386/$machine ;;
-powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
-powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
+powerpc64*) base_machine=powerpc machine=powerpc/powerpc64 ;;
+powerpc*) base_machine=powerpc machine=powerpc/powerpc32 ;;
s390) base_machine=s390 machine=s390/s390-32 ;;
s390x) base_machine=s390 machine=s390/s390-64 ;;
sh3*) base_machine=sh machine=sh/sh3 ;;
diff --git a/libc/configure.in b/libc/configure.in
index b8a797e67..ffc8490a1 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -582,8 +582,8 @@ changequote(,)dnl
# base_machine, we don't change it.
test -n "$base_machine" || case "$machine" in
i[4567]86) base_machine=i386 machine=i386/$machine ;;
-powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
-powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
+powerpc64*) base_machine=powerpc machine=powerpc/powerpc64 ;;
+powerpc*) base_machine=powerpc machine=powerpc/powerpc32 ;;
s390) base_machine=s390 machine=s390/s390-32 ;;
s390x) base_machine=s390 machine=s390/s390-64 ;;
sh3*) base_machine=sh machine=sh/sh3 ;;
diff --git a/libc/conform/data/pthread.h-data b/libc/conform/data/pthread.h-data
index 292b12520..c1e32c8d0 100644
--- a/libc/conform/data/pthread.h-data
+++ b/libc/conform/data/pthread.h-data
@@ -17,11 +17,11 @@ constant PTHREAD_PROCESS_SHARED
constant PTHREAD_PROCESS_PRIVATE
constant PTHREAD_SCOPE_PROCESS
constant PTHREAD_SCOPE_SYSTEM
+macro PTHREAD_MUTEX_INITIALIZER
# ifndef POSIX
constant PTHREAD_MUTEX_DEFAULT
constant PTHREAD_MUTEX_ERRORCHECK
constant PTHREAD_MUTEX_NORMAL
-macro PTHREAD_MUTEX_INITIALIZER
constant PTHREAD_MUTEX_RECURSIVE
macro PTHREAD_RWLOCK_INITIALIZER
# endif
@@ -30,26 +30,27 @@ constant PTHREAD_MUTEX_ROBUST
constant PTHREAD_MUTEX_STALLED
# endif
+# ifndef POSIX
type pthread_attr_t
-# if !defined POSIX && !defined UNIX98
+# ifndef UNIX98
type pthread_barrier_t
type pthread_barrierattr_t
-# endif
+# endif
type pthread_cond_t
type pthread_condattr_t
type pthread_key_t
type pthread_mutex_t
type pthread_mutexattr_t
type pthread_once_t
-# if !defined POSIX
type pthread_rwlock_t
type pthread_rwlockattr_t
-# endif
-# if !defined POSIX && !defined UNIX98
+# ifndef UNIX98
type pthread_spinlock_t
-# endif
+# endif
type pthread_t
+# endif
+function int pthread_atfork (void (*) (void), void (*) (void), void (*) (void))
function int pthread_attr_destroy (pthread_attr_t*)
function int pthread_attr_getdetachstate (const pthread_attr_t*, int*)
# ifndef POSIX
diff --git a/libc/conform/data/sched.h-data b/libc/conform/data/sched.h-data
index 78eb2e4d7..610406d96 100644
--- a/libc/conform/data/sched.h-data
+++ b/libc/conform/data/sched.h-data
@@ -1,10 +1,18 @@
-#if !defined ISO && !defined ISO99 && !defined ISO11
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG3 && !defined XPG4
+# if defined POSIX || defined UNIX98
+# include "time.h-data"
+# else
+allow-header time.h
+# endif
+
type {struct sched_param}
element {struct sched_param} int sched_priority
+# if !defined POSIX && !defined UNIX98
optional-element {struct sched_param} int sched_ss_low_priority
optional-element {struct sched_param} {struct timespec} sched_ss_repl_period
optional-element {struct sched_param} {struct timespec} sched_ss_init_budget
optional-element {struct sched_param} int sched_ss_max_repl
+# endif
# if defined XOPEN2K8 || defined POSIX2008
type pid_t
@@ -14,7 +22,9 @@ type {struct timespec}
constant SCHED_FIFO
constant SCHED_RR
+# if !defined POSIX && !defined UNIX98
optional-constant SCHED_SPORADIC
+# endif
constant SCHED_OTHER
function int sched_get_priority_max (int)
@@ -26,8 +36,6 @@ function int sched_setparam (pid_t, const struct sched_param*)
function int sched_setscheduler (pid_t, int, const struct sched_param*)
function int sched_yield (void)
-allow-header time.h
-
allow sched_*
allow SCHED_*
allow *_t
diff --git a/libc/csu/init-first.c b/libc/csu/init-first.c
index f0ebc94b8..b4d22ce6a 100644
--- a/libc/csu/init-first.c
+++ b/libc/csu/init-first.c
@@ -61,11 +61,8 @@ _init (int argc, char **argv, char **envp)
if (!__libc_multiple_libcs)
{
/* Set the FPU control word to the proper default value if the
- kernel would use a different value. (In a static program we
- don't have this information.) */
-#ifdef SHARED
+ kernel would use a different value. */
if (__fpu_control != GLRO(dl_fpu_control))
-#endif
__setfpucw (__fpu_control);
}
diff --git a/libc/csu/libc-start.c b/libc/csu/libc-start.c
index 5d92a32a4..bc693a522 100644
--- a/libc/csu/libc-start.c
+++ b/libc/csu/libc-start.c
@@ -37,6 +37,12 @@ extern void __pthread_initialize_minimal (void);
in thread local area. */
uintptr_t __stack_chk_guard attribute_relro;
# endif
+# ifndef THREAD_SET_POINTER_GUARD
+/* Only exported for architectures that don't store the pointer guard
+ value in thread local area. */
+uintptr_t __pointer_chk_guard_local
+ attribute_relro attribute_hidden __attribute__ ((nocommon));
+# endif
#endif
#ifdef HAVE_PTR_NTHREADS
@@ -195,6 +201,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
# else
__stack_chk_guard = stack_chk_guard;
# endif
+
+ /* Set up the pointer guard value. */
+ uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
+ stack_chk_guard);
+# ifdef THREAD_SET_POINTER_GUARD
+ THREAD_SET_POINTER_GUARD (pointer_chk_guard);
+# else
+ __pointer_chk_guard_local = pointer_chk_guard;
+# endif
+
#endif
/* Register the destructor of the dynamic linker if there is any. */
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index aaa9534b2..27d249b2f 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -121,7 +121,8 @@ endif
tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
- tst-leaks1-static tst-array1-static tst-array5-static
+ tst-leaks1-static tst-array1-static tst-array5-static \
+ tst-ptrguard1-static
ifeq (yes,$(build-shared))
tests-static += tst-tls9-static
tst-tls9-static-ENV = \
@@ -145,7 +146,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-audit1 tst-audit2 tst-audit8 \
tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
- tst-initorder tst-initorder2 tst-relsort1 tst-null-argv
+ tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
+ tst-ptrguard1
# reldep9
test-srcs = tst-pathopt
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -1016,6 +1018,12 @@ LDFLAGS-order2mod2.so = $(no-as-needed)
tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
+tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
+# When built statically, the pointer guard interface uses
+# __pointer_chk_guard_local.
+CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
+tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
+
$(objpfx)tst-leaks1: $(libdl)
$(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
diff --git a/libc/elf/cache.c b/libc/elf/cache.c
index 9bf261cd2..1a43dd776 100644
--- a/libc/elf/cache.c
+++ b/libc/elf/cache.c
@@ -105,6 +105,15 @@ print_entry (const char *lib, int flag, unsigned int osversion,
case FLAG_ARM_LIBSF:
fputs (",soft-float", stdout);
break;
+ case FLAG_MIPS_LIB32_NAN2008:
+ fputs (",nan2008", stdout);
+ break;
+ case FLAG_MIPS64_LIBN32_NAN2008:
+ fputs (",N32,nan2008", stdout);
+ break;
+ case FLAG_MIPS64_LIBN64_NAN2008:
+ fputs (",64bit,nan2008", stdout);
+ break;
case 0:
break;
default:
diff --git a/libc/elf/dl-deps.c b/libc/elf/dl-deps.c
index 6cdb3b8e5..6e7bb962e 100644
--- a/libc/elf/dl-deps.c
+++ b/libc/elf/dl-deps.c
@@ -595,7 +595,6 @@ Filters not supported with LD_TRACE_PRELINKING"));
if (list[i]->l_reserved)
{
/* Need to allocate new array of relocation dependencies. */
- struct link_map_reldeps *l_reldeps;
l_reldeps = malloc (sizeof (*l_reldeps)
+ map->l_reldepsmax
* sizeof (struct link_map *));
diff --git a/libc/elf/dl-libc.c b/libc/elf/dl-libc.c
index aba0d1af1..397d89899 100644
--- a/libc/elf/dl-libc.c
+++ b/libc/elf/dl-libc.c
@@ -286,6 +286,7 @@ libc_freeres_fn (free_mem)
/* Free the initfini dependency list. */
if (l->l_free_initfini)
free (l->l_initfini);
+ l->l_initfini = NULL;
}
if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
diff --git a/libc/elf/dl-support.c b/libc/elf/dl-support.c
index fe5804fe3..5d19b29cc 100644
--- a/libc/elf/dl-support.c
+++ b/libc/elf/dl-support.c
@@ -170,6 +170,9 @@ size_t _dl_phnum;
uint64_t _dl_hwcap __attribute__ ((nocommon));
uint64_t _dl_hwcap2 __attribute__ ((nocommon));
+/* The value of the FPU control word the kernel will preset in hardware. */
+fpu_control_t _dl_fpu_control = _FPU_DEFAULT;
+
/* This is not initialized to HWCAP_IMPORTANT, matching the definition
of _dl_important_hwcaps, below, where no hwcap strings are ever
used. This mask is still used to mediate the lookups in the cache
@@ -256,6 +259,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
case AT_HWCAP2:
GLRO(dl_hwcap2) = (unsigned long int) 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:
GL(dl_sysinfo) = av->a_un.a_val;
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index fe55c928c..a05ea3b64 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -1383,6 +1383,7 @@ typedef struct
#define EF_MIPS_64BIT_WHIRL 16
#define EF_MIPS_ABI2 32
#define EF_MIPS_ABI_ON32 64
+#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */
#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
/* Legal values for MIPS architecture level. */
@@ -2335,6 +2336,117 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_AARCH64_NONE 0 /* No relocation. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
+#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
+#define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */
+#define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */
+#define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */
+#define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */
+#define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */
+#define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */
+#define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */
+#define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */
+#define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */
+#define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */
+#define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */
+#define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */
+#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */
+#define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */
+#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */
+#define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */
+#define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */
+#define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */
+#define R_AARCH64_CALL26 283 /* Likewise for CALL. */
+#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */
+#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */
+#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */
+#define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */
+#define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */
+#define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */
+#define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */
+#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */
+#define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */
+#define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */
+#define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */
+#define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */
+#define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */
+#define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */
+#define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */
+#define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */
+#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */
+#define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */
+#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */
+#define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */
+#define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */
+#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */
+#define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */
+#define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */
+#define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */
+#define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */
+#define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */
+#define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */
+#define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */
+#define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */
+#define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */
+#define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */
+#define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */
+#define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */
#define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */
#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
@@ -2343,6 +2455,7 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */
#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
+#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* ARM relocs. */
diff --git a/libc/elf/ldd.bash.in b/libc/elf/ldd.bash.in
index 73e35662d..c4a1a1513 100644
--- a/libc/elf/ldd.bash.in
+++ b/libc/elf/ldd.bash.in
@@ -44,7 +44,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
exit 0
;;
--h | --he | --hel | --help)
- printf $"Usage: ldd [OPTION]... FILE...
+ echo $"Usage: ldd [OPTION]... FILE...
--help print this help and exit
--version print version information and exit
-d, --data-relocs process data relocations
@@ -106,19 +106,18 @@ if test "$unused" = yes; then
add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\""
fi
-# The following use of cat is needed to make ldd work in SELinux
-# environments where the executed program might not have permissions
-# to write to the console/tty. But only bash 3.x supports the pipefail
-# option, and we don't bother to handle the case for older bash versions.
-if x=`set -o` && test "$x" != "${x#*pipefail}" && set -o pipefail ; then
- try_trace() {
- eval $add_env '"$@"' | cat
- }
-else
- try_trace() {
- eval $add_env '"$@"'
- }
-fi
+# The following command substitution is needed to make ldd work in SELinux
+# environments where the RTLD might not have permission to write to the
+# terminal. The extra "x" character prevents the shell from trimming trailing
+# newlines from command substitution results. This function is defined as a
+# subshell compound list (using "(...)") to prevent parameter assignments from
+# affecting the calling shell execution environment.
+try_trace() (
+ output=$(eval $add_env '"$@"' 2>&1; rc=$?; printf 'x'; exit $rc)
+ rc=$?
+ printf '%s' "${output%x}"
+ return $rc
+)
case $# in
0)
diff --git a/libc/elf/tst-ptrguard1-static.c b/libc/elf/tst-ptrguard1-static.c
new file mode 100644
index 000000000..7aff3b7b5
--- /dev/null
+++ b/libc/elf/tst-ptrguard1-static.c
@@ -0,0 +1 @@
+#include "tst-ptrguard1.c"
diff --git a/libc/elf/tst-ptrguard1.c b/libc/elf/tst-ptrguard1.c
new file mode 100644
index 000000000..c344a04db
--- /dev/null
+++ b/libc/elf/tst-ptrguard1.c
@@ -0,0 +1,202 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <stackguard-macros.h>
+#include <tls.h>
+#include <unistd.h>
+
+#ifndef POINTER_CHK_GUARD
+extern uintptr_t __pointer_chk_guard;
+# define POINTER_CHK_GUARD __pointer_chk_guard
+#endif
+
+static const char *command;
+static bool child;
+static uintptr_t ptr_chk_guard_copy;
+static bool ptr_chk_guard_copy_set;
+static int fds[2];
+
+static void __attribute__ ((constructor))
+con (void)
+{
+ ptr_chk_guard_copy = POINTER_CHK_GUARD;
+ ptr_chk_guard_copy_set = true;
+}
+
+static int
+uintptr_t_cmp (const void *a, const void *b)
+{
+ if (*(uintptr_t *) a < *(uintptr_t *) b)
+ return 1;
+ if (*(uintptr_t *) a > *(uintptr_t *) b)
+ return -1;
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ if (!ptr_chk_guard_copy_set)
+ {
+ puts ("constructor has not been run");
+ return 1;
+ }
+
+ if (ptr_chk_guard_copy != POINTER_CHK_GUARD)
+ {
+ puts ("POINTER_CHK_GUARD changed between constructor and do_test");
+ return 1;
+ }
+
+ if (child)
+ {
+ write (2, &ptr_chk_guard_copy, sizeof (ptr_chk_guard_copy));
+ return 0;
+ }
+
+ if (command == NULL)
+ {
+ puts ("missing --command or --child argument");
+ return 1;
+ }
+
+#define N 16
+ uintptr_t child_ptr_chk_guards[N + 1];
+ child_ptr_chk_guards[N] = ptr_chk_guard_copy;
+ int i;
+ for (i = 0; i < N; ++i)
+ {
+ if (pipe (fds) < 0)
+ {
+ printf ("couldn't create pipe: %m\n");
+ return 1;
+ }
+
+ pid_t pid = fork ();
+ if (pid < 0)
+ {
+ printf ("fork failed: %m\n");
+ return 1;
+ }
+
+ if (!pid)
+ {
+ if (ptr_chk_guard_copy != POINTER_CHK_GUARD)
+ {
+ puts ("POINTER_CHK_GUARD changed after fork");
+ exit (1);
+ }
+
+ close (fds[0]);
+ close (2);
+ dup2 (fds[1], 2);
+ close (fds[1]);
+
+ system (command);
+ exit (0);
+ }
+
+ close (fds[1]);
+
+ if (TEMP_FAILURE_RETRY (read (fds[0], &child_ptr_chk_guards[i],
+ sizeof (uintptr_t))) != sizeof (uintptr_t))
+ {
+ puts ("could not read ptr_chk_guard value from child");
+ return 1;
+ }
+
+ close (fds[0]);
+
+ pid_t termpid;
+ int status;
+ termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
+ if (termpid == -1)
+ {
+ printf ("waitpid failed: %m\n");
+ return 1;
+ }
+ else if (termpid != pid)
+ {
+ printf ("waitpid returned %ld != %ld\n",
+ (long int) termpid, (long int) pid);
+ return 1;
+ }
+ else if (!WIFEXITED (status) || WEXITSTATUS (status))
+ {
+ puts ("child hasn't exited with exit status 0");
+ return 1;
+ }
+ }
+
+ qsort (child_ptr_chk_guards, N + 1, sizeof (uintptr_t), uintptr_t_cmp);
+
+ /* The default pointer guard is the same as the default stack guard.
+ They are only set to default if dl_random is NULL. */
+ uintptr_t default_guard = 0;
+ unsigned char *p = (unsigned char *) &default_guard;
+ p[sizeof (uintptr_t) - 1] = 255;
+ p[sizeof (uintptr_t) - 2] = '\n';
+ p[0] = 0;
+
+ /* Test if the pointer guard canaries are either randomized,
+ or equal to the default pointer guard value.
+ Even with randomized pointer guards it might happen
+ that the random number generator generates the same
+ values, but if that happens in more than half from
+ the 16 runs, something is very wrong. */
+ int ndifferences = 0;
+ int ndefaults = 0;
+ for (i = 0; i < N; ++i)
+ {
+ if (child_ptr_chk_guards[i] != child_ptr_chk_guards[i+1])
+ ndifferences++;
+ else if (child_ptr_chk_guards[i] == default_guard)
+ ndefaults++;
+ }
+
+ printf ("differences %d defaults %d\n", ndifferences, ndefaults);
+
+ if (ndifferences < N / 2 && ndefaults < N / 2)
+ {
+ puts ("pointer guard values are not randomized enough");
+ puts ("nor equal to the default value");
+ return 1;
+ }
+
+ return 0;
+}
+
+#define OPT_COMMAND 10000
+#define OPT_CHILD 10001
+#define CMDLINE_OPTIONS \
+ { "command", required_argument, NULL, OPT_COMMAND }, \
+ { "child", no_argument, NULL, OPT_CHILD },
+#define CMDLINE_PROCESS \
+ case OPT_COMMAND: \
+ command = optarg; \
+ break; \
+ case OPT_CHILD: \
+ child = true; \
+ break;
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/elf/tst-tls-dlinfo.c b/libc/elf/tst-tls-dlinfo.c
index 26c281117..28661b19c 100644
--- a/libc/elf/tst-tls-dlinfo.c
+++ b/libc/elf/tst-tls-dlinfo.c
@@ -2,8 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <tls.h>
-
#define TEST_FUNCTION do_test ()
static int
diff --git a/libc/elf/tst-tls1.c b/libc/elf/tst-tls1.c
index 3b9b10f9a..bec0a2ff2 100644
--- a/libc/elf/tst-tls1.c
+++ b/libc/elf/tst-tls1.c
@@ -1,8 +1,6 @@
/* glibc test for TLS in ld.so. */
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tls10.h b/libc/elf/tst-tls10.h
index 2b5709af7..7c8c6a639 100644
--- a/libc/elf/tst-tls10.h
+++ b/libc/elf/tst-tls10.h
@@ -1,4 +1,3 @@
-#include <tls.h>
#include <stdlib.h>
struct A
diff --git a/libc/elf/tst-tls14.c b/libc/elf/tst-tls14.c
index ffd31e97b..6bacb599d 100644
--- a/libc/elf/tst-tls14.c
+++ b/libc/elf/tst-tls14.c
@@ -4,8 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <tls.h>
-
#define AL 4096
struct foo
{
diff --git a/libc/elf/tst-tls2.c b/libc/elf/tst-tls2.c
index 3d13272c0..d0b6d5140 100644
--- a/libc/elf/tst-tls2.c
+++ b/libc/elf/tst-tls2.c
@@ -1,8 +1,6 @@
/* glibc test for TLS in ld.so. */
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tls3.c b/libc/elf/tst-tls3.c
index c5e501eb4..ca96c6a07 100644
--- a/libc/elf/tst-tls3.c
+++ b/libc/elf/tst-tls3.c
@@ -1,8 +1,6 @@
/* glibc test for TLS in ld.so. */
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tls4.c b/libc/elf/tst-tls4.c
index 4ae33db24..63170c347 100644
--- a/libc/elf/tst-tls4.c
+++ b/libc/elf/tst-tls4.c
@@ -2,8 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <tls.h>
-
#define TEST_FUNCTION do_test ()
static int
diff --git a/libc/elf/tst-tls5.c b/libc/elf/tst-tls5.c
index 27b18294f..76905c56d 100644
--- a/libc/elf/tst-tls5.c
+++ b/libc/elf/tst-tls5.c
@@ -2,8 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <tls.h>
-
#define TEST_FUNCTION do_test ()
static int
diff --git a/libc/elf/tst-tls6.c b/libc/elf/tst-tls6.c
index 021622d9c..9e6235f1d 100644
--- a/libc/elf/tst-tls6.c
+++ b/libc/elf/tst-tls6.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <link.h>
-#include <tls.h>
#define TEST_FUNCTION do_test ()
diff --git a/libc/elf/tst-tls7.c b/libc/elf/tst-tls7.c
index 1edc2b635..23a16e448 100644
--- a/libc/elf/tst-tls7.c
+++ b/libc/elf/tst-tls7.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <link.h>
-#include <tls.h>
#define TEST_FUNCTION do_test ()
diff --git a/libc/elf/tst-tls8.c b/libc/elf/tst-tls8.c
index 36b1baca6..4bf3e3ffb 100644
--- a/libc/elf/tst-tls8.c
+++ b/libc/elf/tst-tls8.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <link.h>
-#include <tls.h>
#define TEST_FUNCTION do_test ()
diff --git a/libc/elf/tst-tls9.c b/libc/elf/tst-tls9.c
index 12078518f..6306fb565 100644
--- a/libc/elf/tst-tls9.c
+++ b/libc/elf/tst-tls9.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <link.h>
-#include <tls.h>
#define TEST_FUNCTION do_test ()
static int
diff --git a/libc/elf/tst-tlsmod1.c b/libc/elf/tst-tlsmod1.c
index 4d966c947..8d9156791 100644
--- a/libc/elf/tst-tlsmod1.c
+++ b/libc/elf/tst-tlsmod1.c
@@ -1,7 +1,5 @@
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tlsmod13.c b/libc/elf/tst-tlsmod13.c
index 76da630a0..7712d8b8c 100644
--- a/libc/elf/tst-tlsmod13.c
+++ b/libc/elf/tst-tlsmod13.c
@@ -1,5 +1,3 @@
-#include <tls.h>
-
__thread int a[2] __attribute__ ((tls_model ("initial-exec")));
int
diff --git a/libc/elf/tst-tlsmod13a.c b/libc/elf/tst-tlsmod13a.c
index d5515d4a1..ca4eaccbf 100644
--- a/libc/elf/tst-tlsmod13a.c
+++ b/libc/elf/tst-tlsmod13a.c
@@ -1,5 +1,3 @@
-#include <tls.h>
-
__thread int b[2] __attribute__ ((tls_model ("initial-exec")));
extern int foo (void);
diff --git a/libc/elf/tst-tlsmod14a.c b/libc/elf/tst-tlsmod14a.c
index 6806d3403..824c06d1f 100644
--- a/libc/elf/tst-tlsmod14a.c
+++ b/libc/elf/tst-tlsmod14a.c
@@ -1,8 +1,6 @@
#include <stdint.h>
#include <stdio.h>
-#include <tls.h>
-
#define AL 4096
struct foo
{
diff --git a/libc/elf/tst-tlsmod16a.c b/libc/elf/tst-tlsmod16a.c
index c16e603c8..4ec6a6c37 100644
--- a/libc/elf/tst-tlsmod16a.c
+++ b/libc/elf/tst-tlsmod16a.c
@@ -1,3 +1 @@
-#include <tls.h>
-
int __thread tlsvar;
diff --git a/libc/elf/tst-tlsmod16b.c b/libc/elf/tst-tlsmod16b.c
index 7268c56bc..1ecba26db 100644
--- a/libc/elf/tst-tlsmod16b.c
+++ b/libc/elf/tst-tlsmod16b.c
@@ -1,5 +1,3 @@
-#include <tls.h>
-
extern __thread int tlsvar __attribute__((tls_model("initial-exec")));
void *
diff --git a/libc/elf/tst-tlsmod2.c b/libc/elf/tst-tlsmod2.c
index 981923313..40eb1407f 100644
--- a/libc/elf/tst-tlsmod2.c
+++ b/libc/elf/tst-tlsmod2.c
@@ -1,7 +1,5 @@
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tlsmod3.c b/libc/elf/tst-tlsmod3.c
index 5c456ee2d..6d186c47e 100644
--- a/libc/elf/tst-tlsmod3.c
+++ b/libc/elf/tst-tlsmod3.c
@@ -1,7 +1,5 @@
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
extern int in_dso (int n, int *caller_foop);
diff --git a/libc/elf/tst-tlsmod4.c b/libc/elf/tst-tlsmod4.c
index dd9548661..86889aac7 100644
--- a/libc/elf/tst-tlsmod4.c
+++ b/libc/elf/tst-tlsmod4.c
@@ -1,7 +1,5 @@
#include <stdio.h>
-#include <tls.h>
-
#include "tls-macros.h"
diff --git a/libc/elf/tst-tlsmod5.c b/libc/elf/tst-tlsmod5.c
index 00d3a9d92..a97c7e5e0 100644
--- a/libc/elf/tst-tlsmod5.c
+++ b/libc/elf/tst-tlsmod5.c
@@ -1,5 +1,3 @@
-#include <tls.h>
-
#include "tls-macros.h"
COMMON_INT_DEF(foo);
diff --git a/libc/elf/tst-tlsmod6.c b/libc/elf/tst-tlsmod6.c
index 244d9ae48..e968596dd 100644
--- a/libc/elf/tst-tlsmod6.c
+++ b/libc/elf/tst-tlsmod6.c
@@ -1,5 +1,3 @@
-#include <tls.h>
-
#include "tls-macros.h"
COMMON_INT_DEF(bar);
diff --git a/libc/iconv/iconv_prog.c b/libc/iconv/iconv_prog.c
index 2ce2c8f82..cd1410ae7 100644
--- a/libc/iconv/iconv_prog.c
+++ b/libc/iconv/iconv_prog.c
@@ -797,7 +797,7 @@ print_known_names (void)
if (human_readable)
fputs (_("\
-The following list contain all the coded character sets known. This does\n\
+The following list contains all the coded character sets known. This does\n\
not necessarily mean that all combinations of these names can be used for\n\
the FROM and TO command line parameters. One coded character set can be\n\
listed with several different names (aliases).\n\n "), stdout);
diff --git a/libc/include/string.h b/libc/include/string.h
index d6d859491..832341224 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -90,6 +90,7 @@ extern char *__strsep_g (char **__stringp, const char *__delim);
libc_hidden_proto (__strsep_g)
libc_hidden_proto (strnlen)
libc_hidden_proto (memmem)
+libc_hidden_proto (__ffs)
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
diff --git a/libc/inet/inet_net.c b/libc/inet/inet_net.c
index 68e232f3d..5d61c7582 100644
--- a/libc/inet/inet_net.c
+++ b/libc/inet/inet_net.c
@@ -27,6 +27,24 @@
* SUCH DAMAGE.
*/
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
@@ -81,7 +99,9 @@ again:
*pp++ = val, cp++;
goto again;
}
- if (*cp && !isspace(*cp))
+ while (isspace(*cp))
+ cp++;
+ if (*cp)
return (INADDR_NONE);
if (pp >= parts + 4 || val > 0xff)
return (INADDR_NONE);
diff --git a/libc/inet/tst-network.c b/libc/inet/tst-network.c
index 6b79e62df..2eefb0c04 100644
--- a/libc/inet/tst-network.c
+++ b/libc/inet/tst-network.c
@@ -38,6 +38,7 @@ struct
{"0x0", 0},
/* Now some invalid addresses. */
{"0x", INADDR_NONE},
+ {"1 bar", INADDR_NONE}, /* Bug 15277. */
{"141.30.225.2800", INADDR_NONE},
{"141.76.1.1.1", INADDR_NONE},
{"141.76.1.11.", INADDR_NONE},
diff --git a/libc/libio/fileops.c b/libc/libio/fileops.c
index 588bb6390..a5134503f 100644
--- a/libc/libio/fileops.c
+++ b/libc/libio/fileops.c
@@ -1253,13 +1253,12 @@ _IO_new_file_write (f, data, n)
_IO_ssize_t n;
{
_IO_ssize_t to_do = n;
- _IO_ssize_t count = 0;
while (to_do > 0)
{
- count = (__builtin_expect (f->_flags2
- & _IO_FLAGS2_NOTCANCEL, 0)
- ? write_not_cancel (f->_fileno, data, to_do)
- : write (f->_fileno, data, to_do));
+ _IO_ssize_t count = (__builtin_expect (f->_flags2
+ & _IO_FLAGS2_NOTCANCEL, 0)
+ ? write_not_cancel (f->_fileno, data, to_do)
+ : write (f->_fileno, data, to_do));
if (count < 0)
{
f->_flags |= _IO_ERR_SEEN;
@@ -1271,7 +1270,7 @@ _IO_new_file_write (f, data, n)
n -= to_do;
if (f->_offset >= 0)
f->_offset += n;
- return count < 0 ? count : n;
+ return n;
}
_IO_size_t
@@ -1331,13 +1330,11 @@ _IO_new_file_xsputn (f, data, n)
_IO_size_t block_size, do_write;
/* Next flush the (full) buffer. */
if (_IO_OVERFLOW (f, EOF) == EOF)
- /* If nothing else has to be written or nothing has been written, we
- must not signal the caller that the call was even partially
- successful. */
- return (to_do == 0 || to_do == n) ? EOF : n - to_do;
+ /* If nothing else has to be written we must not signal the
+ caller that everything has been written. */
+ return to_do == 0 ? EOF : n - to_do;
- /* Try to maintain alignment: write a whole number of blocks.
- dont_write is what gets left over. */
+ /* Try to maintain alignment: write a whole number of blocks. */
block_size = f->_IO_buf_end - f->_IO_buf_base;
do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
diff --git a/libc/libio/iofwrite.c b/libc/libio/iofwrite.c
index 81596a64c..66542eaea 100644
--- a/libc/libio/iofwrite.c
+++ b/libc/libio/iofwrite.c
@@ -42,12 +42,12 @@ _IO_fwrite (buf, size, count, fp)
if (_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1)
written = _IO_sputn (fp, (const char *) buf, request);
_IO_release_lock (fp);
- /* We are guaranteed to have written all of the input, none of it, or
- some of it. */
- if (written == request)
+ /* We have written all of the input in case the return value indicates
+ this or EOF is returned. The latter is a special case where we
+ simply did not manage to flush the buffer. But the data is in the
+ buffer and therefore written as far as fwrite is concerned. */
+ if (written == request || written == EOF)
return count;
- else if (written == EOF)
- return 0;
else
return written / size;
}
diff --git a/libc/libio/iofwrite_u.c b/libc/libio/iofwrite_u.c
index 4a9d6caa0..18dc6d032 100644
--- a/libc/libio/iofwrite_u.c
+++ b/libc/libio/iofwrite_u.c
@@ -44,12 +44,12 @@ fwrite_unlocked (buf, size, count, fp)
if (_IO_fwide (fp, -1) == -1)
{
written = _IO_sputn (fp, (const char *) buf, request);
- /* We are guaranteed to have written all of the input, none of it, or
- some of it. */
- if (written == request)
+ /* We have written all of the input in case the return value indicates
+ this or EOF is returned. The latter is a special case where we
+ simply did not manage to flush the buffer. But the data is in the
+ buffer and therefore written as far as fwrite is concerned. */
+ if (written == request || written == EOF)
return count;
- else if (written == EOF)
- return 0;
}
return written / size;
diff --git a/libc/libio/iopadn.c b/libc/libio/iopadn.c
index cc93c0f7a..5ebbcf455 100644
--- a/libc/libio/iopadn.c
+++ b/libc/libio/iopadn.c
@@ -59,7 +59,7 @@ _IO_padn (fp, pad, count)
w = _IO_sputn (fp, padptr, PADSIZE);
written += w;
if (w != PADSIZE)
- return w == EOF ? w : written;
+ return written;
}
if (i > 0)
diff --git a/libc/libio/iowpadn.c b/libc/libio/iowpadn.c
index d94db71f2..5600f3711 100644
--- a/libc/libio/iowpadn.c
+++ b/libc/libio/iowpadn.c
@@ -65,7 +65,7 @@ _IO_wpadn (fp, pad, count)
w = _IO_sputn (fp, (char *) padptr, PADSIZE);
written += w;
if (w != PADSIZE)
- return w == EOF ? w : written;
+ return written;
}
if (i > 0)
diff --git a/libc/libio/memstream.c b/libc/libio/memstream.c
index 34534e2f9..3cb1bd705 100644
--- a/libc/libio/memstream.c
+++ b/libc/libio/memstream.c
@@ -84,7 +84,10 @@ open_memstream (bufloc, sizeloc)
buf = calloc (1, _IO_BUFSIZ);
if (buf == NULL)
- return NULL;
+ {
+ free (new_f);
+ return NULL;
+ }
_IO_init (&new_f->fp._sf._sbf._f, 0);
_IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf) = &_IO_mem_jumps;
_IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf);
diff --git a/libc/libio/wmemstream.c b/libc/libio/wmemstream.c
index 65738d4d7..fd7fe44c4 100644
--- a/libc/libio/wmemstream.c
+++ b/libc/libio/wmemstream.c
@@ -85,8 +85,10 @@ open_wmemstream (bufloc, sizeloc)
buf = calloc (1, _IO_BUFSIZ);
if (buf == NULL)
- return NULL;
-
+ {
+ free (new_f);
+ return NULL;
+ }
_IO_no_init (&new_f->fp._sf._sbf._f, 0, 0, &new_f->wd, &_IO_wmem_jumps);
_IO_fwide (&new_f->fp._sf._sbf._f, 1);
_IO_wstr_init_static (&new_f->fp._sf._sbf._f, buf,
diff --git a/libc/locale/hashval.h b/libc/locale/hashval.h
index 737162f6b..88e783938 100644
--- a/libc/locale/hashval.h
+++ b/libc/locale/hashval.h
@@ -37,7 +37,7 @@ compute_hashval (const void *key, size_t keylen)
while (cnt < keylen)
{
hval = (hval << 9) | (hval >> (sizeof hval * CHAR_BIT - 9));
- hval += (hashval_t) *(((char *) key) + cnt++);
+ hval += (hashval_t) ((const unsigned char *) key)[cnt++];
}
return hval != 0 ? hval : ~((hashval_t) 0);
}
diff --git a/libc/locale/iso-3166.def b/libc/locale/iso-3166.def
index a9e1422cb..52997b4bf 100644
--- a/libc/locale/iso-3166.def
+++ b/libc/locale/iso-3166.def
@@ -33,6 +33,7 @@ DEFINE_COUNTRY_CODE ("BENIN", BJ, BEN, 204)
DEFINE_COUNTRY_CODE ("BERMUDA", BM, BMU, 60)
DEFINE_COUNTRY_CODE ("BHUTAN", BT, BTN, 64)
DEFINE_COUNTRY_CODE ("BOLIVIA", BO, BOL, 68)
+DEFINE_COUNTRY_CODE ("BONAIRE, SINT EUSTATIUS AND SABA", BQ, BES, 535)
DEFINE_COUNTRY_CODE ("BOSNIA AND HERZEGOVINA", BA, BIH, 70)
DEFINE_COUNTRY_CODE ("BOTSWANA", BW, BWA, 72)
DEFINE_COUNTRY_CODE ("BOUVET ISLAND", BV, BVT, 74)
@@ -62,13 +63,13 @@ DEFINE_COUNTRY_CODE ("COSTA RICA", CR, CRI, 188)
DEFINE_COUNTRY_CODE ("COTE D'IVOIRE", CI, CIV, 384)
DEFINE_COUNTRY_CODE ("CROATIA", HR, HRV, 191)
DEFINE_COUNTRY_CODE ("CUBA", CU, CUB, 192)
+DEFINE_COUNTRY_CODE ("CURACAO", CW, CUW, 531)
DEFINE_COUNTRY_CODE ("CYPRUS", CY, CYP, 196)
DEFINE_COUNTRY_CODE ("CZECH REPUBLIC", CZ, CZE, 203)
DEFINE_COUNTRY_CODE ("DENMARK", DK, DNK, 208)
DEFINE_COUNTRY_CODE ("DJIBOUTI", DJ, DJI, 262)
DEFINE_COUNTRY_CODE ("DOMINICA", DM, DMA, 212)
DEFINE_COUNTRY_CODE ("DOMINICAN REPUBLIC", DO, DOM, 214)
-DEFINE_COUNTRY_CODE ("EAST TIMOR", TP, TMP, 626)
DEFINE_COUNTRY_CODE ("ECUADOR", EC, ECU, 218)
DEFINE_COUNTRY_CODE ("EGYPT", EG, EGY, 818)
DEFINE_COUNTRY_CODE ("EL SALVADOR", SV, SLV, 222)
@@ -175,7 +176,7 @@ DEFINE_COUNTRY_CODE ("NORWAY", NO, NOR, 578)
DEFINE_COUNTRY_CODE ("OMAN", OM, OMN, 512)
DEFINE_COUNTRY_CODE ("PAKISTAN", PK, PAK, 586)
DEFINE_COUNTRY_CODE ("PALAU", PW, PLW, 585)
-DEFINE_COUNTRY_CODE ("PALESTINIAN TERRITORY, OCCUPIED", PS, PSE, 275)
+DEFINE_COUNTRY_CODE ("PALESTINE, STATE OF", PS, PSE, 275)
DEFINE_COUNTRY_CODE ("PANAMA", PA, PAN, 591)
DEFINE_COUNTRY_CODE ("PAPUA NEW GUINEA", PG, PNG, 598)
DEFINE_COUNTRY_CODE ("PARAGUAY", PY, PRY, 600)
@@ -190,9 +191,11 @@ DEFINE_COUNTRY_CODE ("REUNION", RE, REU, 638)
DEFINE_COUNTRY_CODE ("ROMANIA", RO, ROU, 642)
DEFINE_COUNTRY_CODE ("RUSSIAN FEDERATION", RU, RUS, 643)
DEFINE_COUNTRY_CODE ("RWANDA", RW, RWA, 646)
+DEFINE_COUNTRY_CODE ("SAINT BARTHELEMY", BL, BLM, 652)
DEFINE_COUNTRY_CODE ("SAINT HELENA", SH, SHN, 654)
DEFINE_COUNTRY_CODE ("SAINT KITTS AND NEVIS", KN, KNA, 659)
DEFINE_COUNTRY_CODE ("SAINT LUCIA", LC, LCA, 662)
+DEFINE_COUNTRY_CODE ("SAINT MARTIN (FRENCH PART)", MF, MAF, 663)
DEFINE_COUNTRY_CODE ("SAINT PIERRE AND MIQUELON", PM, SPM, 666)
DEFINE_COUNTRY_CODE ("SAINT VINCENT AND THE GRENADINES", VC, VCT, 670)
DEFINE_COUNTRY_CODE ("SAMOA", WS, WSM, 882)
@@ -204,15 +207,17 @@ DEFINE_COUNTRY_CODE ("SERBIA", RS, SRB, 688)
DEFINE_COUNTRY_CODE ("SEYCHELLES", SC, SYC, 690)
DEFINE_COUNTRY_CODE ("SIERRA LEONE", SL, SLE, 694)
DEFINE_COUNTRY_CODE ("SINGAPORE", SG, SGP, 702)
+DEFINE_COUNTRY_CODE ("SINT MAARTEN (DUTCH PART)", SX, SXM, 534)
DEFINE_COUNTRY_CODE ("SLOVAKIA", SK, SVK, 703)
DEFINE_COUNTRY_CODE ("SLOVENIA", SI, SVN, 705)
DEFINE_COUNTRY_CODE ("SOLOMON ISLANDS", SB, SLB, 90)
DEFINE_COUNTRY_CODE ("SOMALIA", SO, SOM, 706)
DEFINE_COUNTRY_CODE ("SOUTH AFRICA", ZA, ZAF, 710)
DEFINE_COUNTRY_CODE ("SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS", GS, SGS, 239)
+DEFINE_COUNTRY_CODE ("SOUTH SUDAN", SS, SSD, 728)
DEFINE_COUNTRY_CODE ("SPAIN", ES, ESP, 724)
DEFINE_COUNTRY_CODE ("SRI LANKA", LK, LKA, 144)
-DEFINE_COUNTRY_CODE ("SUDAN", SD, SDN, 736)
+DEFINE_COUNTRY_CODE ("SUDAN", SD, SDN, 729)
DEFINE_COUNTRY_CODE ("SURINAME", SR, SUR, 740)
DEFINE_COUNTRY_CODE ("SVALBARD AND JAN MAYEN", SJ, SJM, 744)
DEFINE_COUNTRY_CODE ("SWAZILAND", SZ, SWZ, 748)
@@ -223,6 +228,7 @@ DEFINE_COUNTRY_CODE ("TAIWAN, PROVINCE OF CHINA", TW, TWN, 158)
DEFINE_COUNTRY_CODE ("TAJIKISTAN", TJ, TJK, 762)
DEFINE_COUNTRY_CODE ("TANZANIA, UNITED REPUBLIC OF", TZ, TZA, 834)
DEFINE_COUNTRY_CODE ("THAILAND", TH, THA, 764)
+DEFINE_COUNTRY_CODE ("TIMOR-LESTE", TL, TLS, 626)
DEFINE_COUNTRY_CODE ("TOGO", TG, TGO, 768)
DEFINE_COUNTRY_CODE ("TOKELAU", TK, TKL, 772)
DEFINE_COUNTRY_CODE ("TONGA", TO, TON, 776)
diff --git a/libc/locale/iso-639.def b/libc/locale/iso-639.def
index 50b5a52f5..83cd7643a 100644
--- a/libc/locale/iso-639.def
+++ b/libc/locale/iso-639.def
@@ -46,6 +46,7 @@ DEFINE_LANGUAGE_CODE3 ("Austronesian (Other)", map, map)
DEFINE_LANGUAGE_CODE ("Avaric", av, ava, ava)
DEFINE_LANGUAGE_CODE ("Avestan", ae, ave, ave)
DEFINE_LANGUAGE_CODE3 ("Awadhi", awa, awa)
+DEFINE_LANGUAGE_CODE ("Aymara, Southern", ay, ayc, ayc)
DEFINE_LANGUAGE_CODE ("Aymara", ay, aym, aym)
DEFINE_LANGUAGE_CODE ("Azerbaijani", az, aze, aze)
DEFINE_LANGUAGE_CODE3 ("Balinese", ban, ban)
@@ -95,6 +96,7 @@ DEFINE_LANGUAGE_CODE3 ("Cheyenne", chy, chy)
DEFINE_LANGUAGE_CODE2 ("Chhattisgarhi", hne) /* ISO 639-3 */
DEFINE_LANGUAGE_CODE3 ("Chibcha", chb, chb)
DEFINE_LANGUAGE_CODE ("Chichewa; Chewa; Nyanja", ny, nya, nya)
+DEFINE_LANGUAGE_CODE3 ("Chiga", cgg, cgg)
DEFINE_LANGUAGE_CODE ("Chinese", zh, zho, chi)
DEFINE_LANGUAGE_CODE3 ("Chinook jargon", chn, chn)
DEFINE_LANGUAGE_CODE3 ("Chipewyan", chp, chp)
@@ -161,6 +163,7 @@ DEFINE_LANGUAGE_CODE3 ("Friulian", fur, fur)
DEFINE_LANGUAGE_CODE ("Fulah", ff, ful, ful)
DEFINE_LANGUAGE_CODE ("Gaelic; Scottish Gaelic", gd, gla, gla)
DEFINE_LANGUAGE_CODE ("Galician", gl, glg, glg)
+DEFINE_LANGUAGE_CODE3 ("Gan Chinese", gan, gan)
DEFINE_LANGUAGE_CODE ("Ganda", lg, lug, lug)
DEFINE_LANGUAGE_CODE3 ("Gayo", gay, gay)
DEFINE_LANGUAGE_CODE3 ("Ga", gaa, gaa)
@@ -184,6 +187,7 @@ DEFINE_LANGUAGE_CODE ("Gujarati", gu, guj, guj)
DEFINE_LANGUAGE_CODE3 ("Gwich´in", gwi, gwi)
DEFINE_LANGUAGE_CODE3 ("Haida", hai, hai)
DEFINE_LANGUAGE_CODE ("Haitian; Haitian Creole", ht, hat, hat)
+DEFINE_LANGUAGE_CODE3 ("Hakka Chinese", hak, hak)
DEFINE_LANGUAGE_CODE ("Hausa", ha, hau, hau)
DEFINE_LANGUAGE_CODE3 ("Hawaiian", haw, haw)
DEFINE_LANGUAGE_CODE ("Hebrew", he, heb, heb)
@@ -194,6 +198,7 @@ DEFINE_LANGUAGE_CODE ("Hindi", hi, hin, hin)
DEFINE_LANGUAGE_CODE ("Hiri Motu", ho, hmo, hmo)
DEFINE_LANGUAGE_CODE3 ("Hittite", hit, hit)
DEFINE_LANGUAGE_CODE3 ("Hmong", hmn, hmn)
+DEFINE_LANGUAGE_CODE3 ("Huizhou Chinese", czh, czh)
DEFINE_LANGUAGE_CODE ("Hungarian", hu, hun, hun)
DEFINE_LANGUAGE_CODE3 ("Hupa", hup, hup)
DEFINE_LANGUAGE_CODE3 ("Iban", iba, iba)
@@ -219,6 +224,7 @@ DEFINE_LANGUAGE_CODE3 ("Iroquoian languages", iro, iro)
DEFINE_LANGUAGE_CODE ("Italian", it, ita, ita)
DEFINE_LANGUAGE_CODE ("Japanese", ja, jpn, jpn)
DEFINE_LANGUAGE_CODE ("Javanese", jv, jav, jav)
+DEFINE_LANGUAGE_CODE3 ("Jinyu Chinese", cjy, cjy)
DEFINE_LANGUAGE_CODE3 ("Judeo-Arabic", jrb, jrb)
DEFINE_LANGUAGE_CODE3 ("Judeo-Persian", jpr, jpr)
DEFINE_LANGUAGE_CODE3 ("Kabardian", kbd, kbd)
@@ -267,6 +273,7 @@ DEFINE_LANGUAGE_CODE ("Latvian", lv, lav, lav)
DEFINE_LANGUAGE_CODE3 ("Lezghian", lez, lez)
DEFINE_LANGUAGE_CODE ("Limburgan; Limburger; Limburgish", li, lim, lim)
DEFINE_LANGUAGE_CODE ("Lingala", ln, lin, lin)
+DEFINE_LANGUAGE_CODE3 ("Literary Chinese", lzh, lzh)
DEFINE_LANGUAGE_CODE ("Lithuanian", lt, lit, lit)
DEFINE_LANGUAGE_CODE3 ("Lojban", jbo, jbo)
DEFINE_LANGUAGE_CODE3 ("Low German; Low Saxon; German, Low; Saxon, Low", nds, nds)
@@ -290,6 +297,7 @@ DEFINE_LANGUAGE_CODE ("Malayalam", ml, mal, mal)
DEFINE_LANGUAGE_CODE ("Malay", ms, msa, may)
DEFINE_LANGUAGE_CODE ("Maltese", mt, mlt, mlt)
DEFINE_LANGUAGE_CODE3 ("Manchu", mnc, mnc)
+DEFINE_LANGUAGE_CODE3 ("Mandarin Chinese", cmn, cmn)
DEFINE_LANGUAGE_CODE3 ("Mandar", mdr, mdr)
DEFINE_LANGUAGE_CODE3 ("Mandingo", man, man)
DEFINE_LANGUAGE_CODE3 ("Manipuri", mni, mni)
@@ -305,7 +313,10 @@ DEFINE_LANGUAGE_CODE3 ("Mayan languages", myn, myn)
DEFINE_LANGUAGE_CODE3 ("Mende", men, men)
DEFINE_LANGUAGE_CODE3 ("Mi'kmaq; Micmac", mic, mic)
DEFINE_LANGUAGE_CODE3 ("Minangkabau", min, min)
-DEFINE_LANGUAGE_CODE3 ("Min Nan", nan, nan)
+DEFINE_LANGUAGE_CODE3 ("Min Bei Chinese", mnp, mnp)
+DEFINE_LANGUAGE_CODE3 ("Min Dong Chinese", cdo, cdo)
+DEFINE_LANGUAGE_CODE3 ("Min Nan Chinese", nan, nan)
+DEFINE_LANGUAGE_CODE3 ("Min Zhong Chinese", czo, czo)
DEFINE_LANGUAGE_CODE3 ("Mirandese", mwl, mwl)
DEFINE_LANGUAGE_CODE3 ("Miscellaneous languages", mis, mis)
DEFINE_LANGUAGE_CODE3 ("Mohawk", moh, moh)
@@ -369,6 +380,7 @@ DEFINE_LANGUAGE_CODE ("Polish", pl, pol, pol)
DEFINE_LANGUAGE_CODE ("Portuguese", pt, por, por)
DEFINE_LANGUAGE_CODE3 ("Prakrit languages", pra, pra)
DEFINE_LANGUAGE_CODE3 ("Provençal, Old (to 1500)", pro, pro)
+DEFINE_LANGUAGE_CODE3 ("Pu-Xian Chinese", cpx, cpx)
DEFINE_LANGUAGE_CODE ("Pushto", ps, pus, pus)
DEFINE_LANGUAGE_CODE ("Quechua", qu, que, que)
DEFINE_LANGUAGE_CODE ("Raeto-Romance", rm, roh, roh)
@@ -486,12 +498,15 @@ DEFINE_LANGUAGE_CODE3 ("Waray", war, war)
DEFINE_LANGUAGE_CODE3 ("Washo", was, was)
DEFINE_LANGUAGE_CODE ("Welsh", cy, cym, wel)
DEFINE_LANGUAGE_CODE ("Wolof", wo, wol, wol)
+DEFINE_LANGUAGE_CODE3 ("Wu Chinese", wuu, wuu)
DEFINE_LANGUAGE_CODE ("Xhosa", xh, xho, xho)
+DEFINE_LANGUAGE_CODE3 ("Xiang Chinese", hsn, hsn)
DEFINE_LANGUAGE_CODE3 ("Yakut", sah, sah)
DEFINE_LANGUAGE_CODE3 ("Yao", yao, yao)
DEFINE_LANGUAGE_CODE3 ("Yapese", yap, yap)
DEFINE_LANGUAGE_CODE ("Yiddish", yi, yid, yid)
DEFINE_LANGUAGE_CODE ("Yoruba", yo, yor, yor)
+DEFINE_LANGUAGE_CODE3 ("Yue Chinese", yue, yue)
DEFINE_LANGUAGE_CODE3 ("Yupik languages", ypk, ypk)
DEFINE_LANGUAGE_CODE3 ("Zande", znd, znd)
DEFINE_LANGUAGE_CODE3 ("Zapotec", zap, zap)
diff --git a/libc/locale/loadlocale.c b/libc/locale/loadlocale.c
index de7e3d01d..45162f136 100644
--- a/libc/locale/loadlocale.c
+++ b/libc/locale/loadlocale.c
@@ -148,7 +148,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
newdata->values[cnt].string = newdata->filedata + idx;
else
{
- if (idx % __alignof__ (u_int32_t) != 0)
+ if (!LOCFILE_ALIGNED_P (idx))
goto puntdata;
newdata->values[cnt].word =
*((const u_int32_t *) (newdata->filedata + idx));
diff --git a/libc/locale/localeinfo.h b/libc/locale/localeinfo.h
index 0c40ebe78..b3e078535 100644
--- a/libc/locale/localeinfo.h
+++ b/libc/locale/localeinfo.h
@@ -87,6 +87,16 @@ struct __locale_data
values __flexarr; /* Items, usually pointers into `filedata'. */
};
+/* This alignment is used for 32-bit integers in locale files, both
+ those that are explicitly int32_t or uint32_t and those that are
+ wchar_t, regardless of the (possibly smaller) alignment required
+ for such integers on a particular host. */
+#define LOCFILE_ALIGN sizeof (int32_t)
+#define LOCFILE_ALIGN_MASK (LOCFILE_ALIGN - 1)
+#define LOCFILE_ALIGN_UP(x) (((x) + LOCFILE_ALIGN - 1) \
+ & ~LOCFILE_ALIGN_MASK)
+#define LOCFILE_ALIGNED_P(x) (((x) & LOCFILE_ALIGN_MASK) == 0)
+
/* We know three kinds of collation sorting rules. */
enum coll_sort_rule
{
diff --git a/libc/locale/programs/3level.h b/libc/locale/programs/3level.h
index b8d6ca023..c5f024fe3 100644
--- a/libc/locale/programs/3level.h
+++ b/libc/locale/programs/3level.h
@@ -270,7 +270,7 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t)
+ t->level1_size * sizeof (uint32_t)
+ (t->level2_size << t->q) * sizeof (uint32_t)
+ (t->level3_size << t->p) * sizeof (ELEMENT);
- t->result_size = (last_offset + 3) & ~3ul;
+ t->result_size = LOCFILE_ALIGN_UP (last_offset);
level2_offset =
5 * sizeof (uint32_t)
@@ -308,7 +308,7 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t)
t->level3_size << t->p);
else
abort ();
- align_locale_data (file, 4);
+ align_locale_data (file, LOCFILE_ALIGN);
end_locale_structure (file);
if (t->level1_alloc > 0)
diff --git a/libc/locale/programs/ld-collate.c b/libc/locale/programs/ld-collate.c
index 04f6e22cd..57742326f 100644
--- a/libc/locale/programs/ld-collate.c
+++ b/libc/locale/programs/ld-collate.c
@@ -44,9 +44,9 @@ static inline void
__attribute ((always_inline))
obstack_int32_grow (struct obstack *obstack, int32_t data)
{
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (obstack)));
data = maybe_swap_uint32 (data);
- if (sizeof (int32_t) == sizeof (int)
- && (obstack_object_size (obstack) & (__alignof__ (int) - 1)) == 0)
+ if (sizeof (int32_t) == sizeof (int))
obstack_int_grow (obstack, data);
else
obstack_grow (obstack, &data, sizeof (int32_t));
@@ -56,9 +56,9 @@ static inline void
__attribute ((always_inline))
obstack_int32_grow_fast (struct obstack *obstack, int32_t data)
{
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (obstack)));
data = maybe_swap_uint32 (data);
- if (sizeof (int32_t) == sizeof (int)
- && (obstack_object_size (obstack) & (__alignof__ (int) - 1)) == 0)
+ if (sizeof (int32_t) == sizeof (int))
obstack_int_grow_fast (obstack, data);
else
obstack_grow (obstack, &data, sizeof (int32_t));
@@ -2080,6 +2080,7 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
weightidx = output_weightwc (atwc.weightpool, atwc.collate,
runp);
+ assert (runp->nwcs > 0);
added = (1 + 1 + runp->nwcs - 1) * sizeof (int32_t);
if (sizeof (int) == sizeof (int32_t))
obstack_make_room (atwc.extrapool, added);
@@ -2157,6 +2158,12 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
obstack_1grow_fast (&weightpool, sect->rules[j]);
++i;
}
+ /* And align the output. */
+ i = (nrules * i) % LOCFILE_ALIGN;
+ if (i > 0)
+ do
+ obstack_1grow (&weightpool, '\0');
+ while (++i < LOCFILE_ALIGN);
add_locale_raw_obstack (&file, &weightpool);
@@ -2202,7 +2209,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
struct element_t *runp = collate->mbheads[ch];
struct element_t *lastp;
- assert ((obstack_object_size (&extrapool) & uint32_align_mask) == 0);
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)));
tablemb[ch] = -obstack_object_size (&extrapool);
@@ -2227,11 +2234,9 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
struct element_t *curp;
/* Compute how much space we will need. */
- added = ((sizeof (int32_t) + 1 + 2 * (runp->nmbs - 1)
- + uint32_align_mask)
- & ~uint32_align_mask);
- assert ((obstack_object_size (&extrapool)
- & uint32_align_mask) == 0);
+ added = LOCFILE_ALIGN_UP (sizeof (int32_t) + 1
+ + 2 * (runp->nmbs - 1));
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)));
obstack_make_room (&extrapool, added);
/* More than one consecutive entry. We mark this by having
@@ -2288,11 +2293,9 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
/* Output the weight info. */
weightidx = output_weight (&weightpool, collate, runp);
- added = ((sizeof (int32_t) + 1 + runp->nmbs - 1
- + uint32_align_mask)
- & ~uint32_align_mask);
- assert ((obstack_object_size (&extrapool)
- & uint32_align_mask) == 0);
+ added = LOCFILE_ALIGN_UP (sizeof (int32_t) + 1
+ + runp->nmbs - 1);
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)));
obstack_make_room (&extrapool, added);
obstack_int32_grow_fast (&extrapool, weightidx);
@@ -2304,7 +2307,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
}
/* Add alignment bytes if necessary. */
- while ((obstack_object_size (&extrapool) & uint32_align_mask) != 0)
+ while (!LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)))
obstack_1grow_fast (&extrapool, '\0');
/* Next entry. */
@@ -2313,14 +2316,13 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
}
while (runp != NULL);
- assert ((obstack_object_size (&extrapool) & uint32_align_mask) == 0);
+ assert (LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)));
/* If the final entry in the list is not a single character we
add an UNDEFINED entry here. */
if (lastp->nmbs != 1)
{
- int added = ((sizeof (int32_t) + 1 + 1 + uint32_align_mask)
- & ~uint32_align_mask);
+ int added = LOCFILE_ALIGN_UP (sizeof (int32_t) + 1 + 1);
obstack_make_room (&extrapool, added);
obstack_int32_grow_fast (&extrapool, 0);
@@ -2330,13 +2332,13 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
obstack_1grow_fast (&extrapool, 0);
/* Add alignment bytes if necessary. */
- while ((obstack_object_size (&extrapool) & uint32_align_mask) != 0)
+ while (!LOCFILE_ALIGNED_P (obstack_object_size (&extrapool)))
obstack_1grow_fast (&extrapool, '\0');
}
}
/* Add padding to the tables if necessary. */
- while ((obstack_object_size (&weightpool) & uint32_align_mask) != 0)
+ while (!LOCFILE_ALIGNED_P (obstack_object_size (&weightpool)))
obstack_1grow (&weightpool, 0);
/* Now add the four tables. */
diff --git a/libc/locale/programs/ld-ctype.c b/libc/locale/programs/ld-ctype.c
index cbedc78d8..91c5e78b2 100644
--- a/libc/locale/programs/ld-ctype.c
+++ b/libc/locale/programs/ld-ctype.c
@@ -1032,7 +1032,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
add_locale_string (&file, ctype->classnames[cnt]);
add_locale_char (&file, 0);
- align_locale_data (&file, 4);
+ align_locale_data (&file, LOCFILE_ALIGN);
end_locale_structure (&file);
break;
@@ -1042,7 +1042,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
add_locale_string (&file, ctype->mapnames[cnt]);
add_locale_char (&file, 0);
- align_locale_data (&file, 4);
+ align_locale_data (&file, LOCFILE_ALIGN);
end_locale_structure (&file);
break;
diff --git a/libc/locale/programs/localedef.c b/libc/locale/programs/localedef.c
index 7af399d7d..51927173a 100644
--- a/libc/locale/programs/localedef.c
+++ b/libc/locale/programs/localedef.c
@@ -149,7 +149,8 @@ static const struct argp_option options[] =
N_("locale.alias file to consult when making archive")},
{ "little-endian", OPT_LITTLE_ENDIAN, NULL, 0,
N_("Generate little-endian output") },
- { "big-endian", OPT_BIG_ENDIAN, NULL, 0, N_("Generate big-endian output") },
+ { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
+ N_("Generate big-endian output") },
{ "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
N_("Set the target's uint32_t alignment in bytes (default 4)") },
{ NULL, 0, NULL, 0, NULL }
@@ -337,10 +338,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
list_archive = true;
break;
case OPT_LITTLE_ENDIAN:
- set_big_endian (0);
+ set_big_endian (false);
break;
case OPT_BIG_ENDIAN:
- set_big_endian (1);
+ set_big_endian (true);
break;
case OPT_UINT32_ALIGN:
uint32_align_mask = strtol (arg, NULL, 0) - 1;
diff --git a/libc/locale/programs/locarchive.c b/libc/locale/programs/locarchive.c
index d8df39a8e..e2a30b568 100644
--- a/libc/locale/programs/locarchive.c
+++ b/libc/locale/programs/locarchive.c
@@ -46,6 +46,7 @@
#include "../localeinfo.h"
#include "../locarchive.h"
#include "localedef.h"
+#include "locfile.h"
/* Define the hash function. We define the function as static inline.
We must change the name so as not to conflict with simple-hash.h. */
@@ -74,6 +75,13 @@ static const char *locnames[] =
#define INITIAL_NUM_SUMS 2000
+/* Get and set values (possibly endian-swapped) in structures mapped
+ from or written directly to locale archives. */
+#define GET(FIELD) maybe_swap_uint32 (FIELD)
+#define SET(FIELD, VALUE) ((FIELD) = maybe_swap_uint32 (VALUE))
+#define INC(FIELD, INCREMENT) SET (FIELD, GET (FIELD) + (INCREMENT))
+
+
/* Size of the reserved address space area. */
#define RESERVE_MMAP_SIZE 512 * 1024 * 1024
@@ -125,27 +133,31 @@ create_archive (const char *archivefname, struct locarhandle *ah)
error (EXIT_FAILURE, errno, _("cannot create temporary file: %s"), fname);
/* Create the initial content of the archive. */
- head.magic = AR_MAGIC;
- head.serial = 0;
- head.namehash_offset = sizeof (struct locarhead);
- head.namehash_used = 0;
- head.namehash_size = next_prime (INITIAL_NUM_NAMES);
-
- head.string_offset = (head.namehash_offset
- + head.namehash_size * sizeof (struct namehashent));
- head.string_used = 0;
- head.string_size = INITIAL_SIZE_STRINGS;
-
- head.locrectab_offset = head.string_offset + head.string_size;
- head.locrectab_used = 0;
- head.locrectab_size = INITIAL_NUM_LOCREC;
-
- head.sumhash_offset = (head.locrectab_offset
- + head.locrectab_size * sizeof (struct locrecent));
- head.sumhash_used = 0;
- head.sumhash_size = next_prime (INITIAL_NUM_SUMS);
-
- total = head.sumhash_offset + head.sumhash_size * sizeof (struct sumhashent);
+ SET (head.magic, AR_MAGIC);
+ SET (head.serial, 0);
+ SET (head.namehash_offset, sizeof (struct locarhead));
+ SET (head.namehash_used, 0);
+ SET (head.namehash_size, next_prime (INITIAL_NUM_NAMES));
+
+ SET (head.string_offset,
+ (GET (head.namehash_offset)
+ + GET (head.namehash_size) * sizeof (struct namehashent)));
+ SET (head.string_used, 0);
+ SET (head.string_size, INITIAL_SIZE_STRINGS);
+
+ SET (head.locrectab_offset,
+ GET (head.string_offset) + GET (head.string_size));
+ SET (head.locrectab_used, 0);
+ SET (head.locrectab_size, INITIAL_NUM_LOCREC);
+
+ SET (head.sumhash_offset,
+ (GET (head.locrectab_offset)
+ + GET (head.locrectab_size) * sizeof (struct locrecent)));
+ SET (head.sumhash_used, 0);
+ SET (head.sumhash_size, next_prime (INITIAL_NUM_SUMS));
+
+ total = (GET (head.sumhash_offset)
+ + GET (head.sumhash_size) * sizeof (struct sumhashent));
/* Write out the header and create room for the other data structures. */
if (TEMP_FAILURE_RETRY (write (fd, &head, sizeof (head))) != sizeof (head))
@@ -240,10 +252,10 @@ oldlocrecentcmp (const void *a, const void *b)
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL)
{
- if (la->record[cnt].offset < start_a)
- start_a = la->record[cnt].offset;
- if (la->record[cnt].offset + la->record[cnt].len > end_a)
- end_a = la->record[cnt].offset + la->record[cnt].len;
+ if (GET (la->record[cnt].offset) < start_a)
+ start_a = GET (la->record[cnt].offset);
+ if (GET (la->record[cnt].offset) + GET (la->record[cnt].len) > end_a)
+ end_a = GET (la->record[cnt].offset) + GET (la->record[cnt].len);
}
assert (start_a != (uint32_t)-1);
assert (end_a != 0);
@@ -251,10 +263,10 @@ oldlocrecentcmp (const void *a, const void *b)
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL)
{
- if (lb->record[cnt].offset < start_b)
- start_b = lb->record[cnt].offset;
- if (lb->record[cnt].offset + lb->record[cnt].len > end_b)
- end_b = lb->record[cnt].offset + lb->record[cnt].len;
+ if (GET (lb->record[cnt].offset) < start_b)
+ start_b = GET (lb->record[cnt].offset);
+ if (GET (lb->record[cnt].offset) + GET (lb->record[cnt].len) > end_b)
+ end_b = GET (lb->record[cnt].offset) + GET (lb->record[cnt].len);
}
assert (start_b != (uint32_t)-1);
assert (end_b != 0);
@@ -371,38 +383,42 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
/* Create the new archive header. The sizes of the various tables
should be double from what is currently used. */
- newhead.namehash_size = MAX (next_prime (2 * newhead.namehash_used),
- newhead.namehash_size);
+ SET (newhead.namehash_size,
+ MAX (next_prime (2 * GET (newhead.namehash_used)),
+ GET (newhead.namehash_size)));
if (verbose)
printf ("name: size: %u, used: %d, new: size: %u\n",
- head->namehash_size, head->namehash_used, newhead.namehash_size);
+ GET (head->namehash_size),
+ GET (head->namehash_used), GET (newhead.namehash_size));
- newhead.string_offset = (newhead.namehash_offset
- + (newhead.namehash_size
- * sizeof (struct namehashent)));
+ SET (newhead.string_offset, (GET (newhead.namehash_offset)
+ + (GET (newhead.namehash_size)
+ * sizeof (struct namehashent))));
/* Keep the string table size aligned to 4 bytes, so that
all the struct { uint32_t } types following are happy. */
- newhead.string_size = MAX ((2 * newhead.string_used + 3) & -4,
- newhead.string_size);
+ SET (newhead.string_size, MAX ((2 * GET (newhead.string_used) + 3) & -4,
+ GET (newhead.string_size)));
- newhead.locrectab_offset = newhead.string_offset + newhead.string_size;
- newhead.locrectab_size = MAX (2 * newhead.locrectab_used,
- newhead.locrectab_size);
+ SET (newhead.locrectab_offset,
+ GET (newhead.string_offset) + GET (newhead.string_size));
+ SET (newhead.locrectab_size, MAX (2 * GET (newhead.locrectab_used),
+ GET (newhead.locrectab_size)));
- newhead.sumhash_offset = (newhead.locrectab_offset
- + (newhead.locrectab_size
- * sizeof (struct locrecent)));
- newhead.sumhash_size = MAX (next_prime (2 * newhead.sumhash_used),
- newhead.sumhash_size);
+ SET (newhead.sumhash_offset, (GET (newhead.locrectab_offset)
+ + (GET (newhead.locrectab_size)
+ * sizeof (struct locrecent))));
+ SET (newhead.sumhash_size,
+ MAX (next_prime (2 * GET (newhead.sumhash_used)),
+ GET (newhead.sumhash_size)));
- total = (newhead.sumhash_offset
- + newhead.sumhash_size * sizeof (struct sumhashent));
+ total = (GET (newhead.sumhash_offset)
+ + GET (newhead.sumhash_size) * sizeof (struct sumhashent));
/* The new file is empty now. */
- newhead.namehash_used = 0;
- newhead.string_used = 0;
- newhead.locrectab_used = 0;
- newhead.sumhash_used = 0;
+ SET (newhead.namehash_used, 0);
+ SET (newhead.string_used, 0);
+ SET (newhead.locrectab_used, 0);
+ SET (newhead.sumhash_used, 0);
/* Write out the header and create room for the other data structures. */
if (TEMP_FAILURE_RETRY (write (fd, &newhead, sizeof (newhead)))
@@ -453,17 +469,17 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
/* Walk through the hash name hash table to find out what data is
still referenced and transfer it into the new file. */
oldnamehashtab = (struct namehashent *) ((char *) ah->addr
- + head->namehash_offset);
+ + GET (head->namehash_offset));
/* Sort the old locrec table in order of data position. */
- struct oldlocrecent oldlocrecarray[head->namehash_size];
- for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt)
- if (oldnamehashtab[cnt].locrec_offset != 0)
+ struct oldlocrecent oldlocrecarray[GET (head->namehash_size)];
+ for (cnt = 0, loccnt = 0; cnt < GET (head->namehash_size); ++cnt)
+ if (GET (oldnamehashtab[cnt].locrec_offset) != 0)
{
oldlocrecarray[loccnt].cnt = cnt;
oldlocrecarray[loccnt++].locrec
= (struct locrecent *) ((char *) ah->addr
- + oldnamehashtab[cnt].locrec_offset);
+ + GET (oldnamehashtab[cnt].locrec_offset));
}
qsort (oldlocrecarray, loccnt, sizeof (struct oldlocrecent),
oldlocrecentcmp);
@@ -479,9 +495,9 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
for (idx = 0; idx < __LC_LAST; ++idx)
if (idx != LC_ALL)
{
- old_data[idx].size = oldlocrec->record[idx].len;
+ old_data[idx].size = GET (oldlocrec->record[idx].len);
old_data[idx].addr
- = ((char *) ah->addr + oldlocrec->record[idx].offset);
+ = ((char *) ah->addr + GET (oldlocrec->record[idx].offset));
__md5_buffer (old_data[idx].addr, old_data[idx].size,
old_data[idx].sum);
@@ -491,20 +507,23 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
{
const char *oldname
= ((char *) ah->addr
- + oldnamehashtab[oldlocrecarray[cnt - 1].cnt].name_offset);
-
- add_alias (&new_ah,
- ((char *) ah->addr
- + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
- 0, oldname, &last_locrec_offset);
+ + GET (oldnamehashtab[oldlocrecarray[cnt
+ - 1].cnt].name_offset));
+
+ add_alias
+ (&new_ah,
+ ((char *) ah->addr
+ + GET (oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset)),
+ 0, oldname, &last_locrec_offset);
continue;
}
last_locrec_offset =
- add_locale (&new_ah,
- ((char *) ah->addr
- + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
- old_data, 0);
+ add_locale
+ (&new_ah,
+ ((char *) ah->addr
+ + GET (oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset)),
+ old_data, 0);
if (last_locrec_offset == 0)
error (EXIT_FAILURE, 0, _("cannot extend locale archive file"));
}
@@ -672,26 +691,28 @@ insert_name (struct locarhandle *ah,
{
const struct locarhead *const head = ah->addr;
struct namehashent *namehashtab
- = (struct namehashent *) ((char *) ah->addr + head->namehash_offset);
+ = (struct namehashent *) ((char *) ah->addr
+ + GET (head->namehash_offset));
unsigned int insert_idx, idx, incr;
/* Hash value of the locale name. */
uint32_t hval = archive_hashval (name, name_len);
insert_idx = -1;
- idx = hval % head->namehash_size;
- incr = 1 + hval % (head->namehash_size - 2);
+ idx = hval % GET (head->namehash_size);
+ incr = 1 + hval % (GET (head->namehash_size) - 2);
/* If the name_offset field is zero this means this is a
deleted entry and therefore no entry can be found. */
- while (namehashtab[idx].name_offset != 0)
+ while (GET (namehashtab[idx].name_offset) != 0)
{
- if (namehashtab[idx].hashval == hval
- && strcmp (name,
- (char *) ah->addr + namehashtab[idx].name_offset) == 0)
+ if (GET (namehashtab[idx].hashval) == hval
+ && (strcmp (name,
+ (char *) ah->addr + GET (namehashtab[idx].name_offset))
+ == 0))
{
/* Found the entry. */
- if (namehashtab[idx].locrec_offset != 0 && ! replace)
+ if (GET (namehashtab[idx].locrec_offset) != 0 && ! replace)
{
if (! be_quiet)
error (0, 0, _("locale '%s' already exists"), name);
@@ -701,26 +722,27 @@ insert_name (struct locarhandle *ah,
break;
}
- if (namehashtab[idx].hashval == hval && ! be_quiet)
+ if (GET (namehashtab[idx].hashval) == hval && ! be_quiet)
{
error (0, 0, "hash collision (%u) %s, %s",
- hval, name, (char *) ah->addr + namehashtab[idx].name_offset);
+ hval, name,
+ (char *) ah->addr + GET (namehashtab[idx].name_offset));
}
/* Remember the first place we can insert the new entry. */
- if (namehashtab[idx].locrec_offset == 0 && insert_idx == -1)
+ if (GET (namehashtab[idx].locrec_offset) == 0 && insert_idx == -1)
insert_idx = idx;
idx += incr;
- if (idx >= head->namehash_size)
- idx -= head->namehash_size;
+ if (idx >= GET (head->namehash_size))
+ idx -= GET (head->namehash_size);
}
/* Add as early as possible. */
if (insert_idx != -1)
idx = insert_idx;
- namehashtab[idx].hashval = hval; /* no-op if replacing an old entry. */
+ SET (namehashtab[idx].hashval, hval); /* no-op if replacing an old entry. */
return &namehashtab[idx];
}
@@ -736,12 +758,13 @@ add_alias (struct locarhandle *ah, const char *alias, bool replace,
if (namehashent == NULL && ! replace)
return;
- if (namehashent->name_offset == 0)
+ if (GET (namehashent->name_offset) == 0)
{
/* We are adding a new hash entry for this alias.
Determine whether we have to resize the file. */
- if (head->string_used + name_len + 1 > head->string_size
- || 100 * head->namehash_used > 75 * head->namehash_size)
+ if (GET (head->string_used) + name_len + 1 > GET (head->string_size)
+ || (100 * GET (head->namehash_used)
+ > 75 * GET (head->namehash_size)))
{
/* The current archive is not large enough. */
enlarge_archive (ah, head);
@@ -749,9 +772,9 @@ add_alias (struct locarhandle *ah, const char *alias, bool replace,
/* The locrecent might have moved, so we have to look up
the old name afresh. */
namehashent = insert_name (ah, oldname, strlen (oldname), true);
- assert (namehashent->name_offset != 0);
- assert (namehashent->locrec_offset != 0);
- *locrec_offset_p = namehashent->locrec_offset;
+ assert (GET (namehashent->name_offset) != 0);
+ assert (GET (namehashent->locrec_offset) != 0);
+ *locrec_offset_p = GET (namehashent->locrec_offset);
/* Tail call to try the whole thing again. */
add_alias (ah, alias, replace, oldname, locrec_offset_p);
@@ -759,26 +782,27 @@ add_alias (struct locarhandle *ah, const char *alias, bool replace,
}
/* Add the name string. */
- memcpy (ah->addr + head->string_offset + head->string_used,
+ memcpy (ah->addr + GET (head->string_offset) + GET (head->string_used),
alias, name_len + 1);
- namehashent->name_offset = head->string_offset + head->string_used;
- head->string_used += name_len + 1;
+ SET (namehashent->name_offset,
+ GET (head->string_offset) + GET (head->string_used));
+ INC (head->string_used, name_len + 1);
- ++head->namehash_used;
+ INC (head->namehash_used, 1);
}
- if (namehashent->locrec_offset != 0)
+ if (GET (namehashent->locrec_offset) != 0)
{
/* Replacing an existing entry.
Mark that we are no longer using the old locrecent. */
struct locrecent *locrecent
= (struct locrecent *) ((char *) ah->addr
- + namehashent->locrec_offset);
- --locrecent->refs;
+ + GET (namehashent->locrec_offset));
+ INC (locrecent->refs, -1);
}
/* Point this entry at the locrecent installed for the main name. */
- namehashent->locrec_offset = locrec_offset;
+ SET (namehashent->locrec_offset, locrec_offset);
}
static int /* qsort comparator used below */
@@ -814,12 +838,17 @@ add_locale (struct locarhandle *ah,
off64_t lastoffset;
char *ptr;
struct locale_category_data *size_order[__LC_LAST];
- const size_t pagesz = getpagesize ();
+ /* Page size alignment is a minor optimization for locality; use a
+ common value here rather than making the localedef output depend
+ on the page size of the system on which localedef is run. See
+ <https://sourceware.org/glibc/wiki/Development_Todo/Master#Locale_archive_alignment>
+ for more discussion. */
+ const size_t pagesz = 4096;
int small_mask;
head = ah->addr;
sumhashtab = (struct sumhashent *) ((char *) ah->addr
- + head->sumhash_offset);
+ + GET (head->sumhash_offset));
memset (file_offsets, 0, sizeof (file_offsets));
@@ -877,10 +906,10 @@ add_locale (struct locarhandle *ah,
table. */
hval = archive_hashval (data[cnt].sum, 16);
- idx = hval % head->sumhash_size;
- incr = 1 + hval % (head->sumhash_size - 2);
+ idx = hval % GET (head->sumhash_size);
+ incr = 1 + hval % (GET (head->sumhash_size) - 2);
- while (sumhashtab[idx].file_offset != 0)
+ while (GET (sumhashtab[idx].file_offset) != 0)
{
if (memcmp (data[cnt].sum, sumhashtab[idx].sum, 16) == 0)
{
@@ -890,40 +919,42 @@ add_locale (struct locarhandle *ah,
Unfortunately the sumhashent record does not include
the size of the stored data. So we have to search for
it. */
- locrecent = (struct locrecent *) ((char *) ah->addr
- + head->locrectab_offset);
+ locrecent
+ = (struct locrecent *) ((char *) ah->addr
+ + GET (head->locrectab_offset));
size_t iloc;
- for (iloc = 0; iloc < head->locrectab_used; ++iloc)
- if (locrecent[iloc].refs != 0
- && (locrecent[iloc].record[cnt].offset
- == sumhashtab[idx].file_offset))
+ for (iloc = 0; iloc < GET (head->locrectab_used); ++iloc)
+ if (GET (locrecent[iloc].refs) != 0
+ && (GET (locrecent[iloc].record[cnt].offset)
+ == GET (sumhashtab[idx].file_offset)))
break;
- if (iloc != head->locrectab_used
- && data[cnt].size == locrecent[iloc].record[cnt].len
+ if (iloc != GET (head->locrectab_used)
+ && data[cnt].size == GET (locrecent[iloc].record[cnt].len)
/* We have to compare the content. Either we can
have the data mmaped or we have to read from
the file. */
- && (file_data_available_p (ah, sumhashtab[idx].file_offset,
- data[cnt].size)
+ && (file_data_available_p
+ (ah, GET (sumhashtab[idx].file_offset),
+ data[cnt].size)
? memcmp (data[cnt].addr,
(char *) ah->addr
- + sumhashtab[idx].file_offset,
+ + GET (sumhashtab[idx].file_offset),
data[cnt].size) == 0
: compare_from_file (ah, data[cnt].addr,
- sumhashtab[idx].file_offset,
+ GET (sumhashtab[idx].file_offset),
data[cnt].size) == 0))
{
/* Found it. */
- file_offsets[cnt] = sumhashtab[idx].file_offset;
+ file_offsets[cnt] = GET (sumhashtab[idx].file_offset);
--num_new_offsets;
break;
}
}
idx += incr;
- if (idx >= head->sumhash_size)
- idx -= head->sumhash_size;
+ if (idx >= GET (head->sumhash_size))
+ idx -= GET (head->sumhash_size);
}
}
@@ -933,11 +964,14 @@ add_locale (struct locarhandle *ah,
return 0;
/* Determine whether we have to resize the file. */
- if (100 * (head->sumhash_used + num_new_offsets) > 75 * head->sumhash_size
- || (namehashent->locrec_offset == 0
- && (head->locrectab_used == head->locrectab_size
- || head->string_used + name_len + 1 > head->string_size
- || 100 * head->namehash_used > 75 * head->namehash_size)))
+ if ((100 * (GET (head->sumhash_used) + num_new_offsets)
+ > 75 * GET (head->sumhash_size))
+ || (GET (namehashent->locrec_offset) == 0
+ && (GET (head->locrectab_used) == GET (head->locrectab_size)
+ || (GET (head->string_used) + name_len + 1
+ > GET (head->string_size))
+ || (100 * GET (head->namehash_used)
+ > 75 * GET (head->namehash_size)))))
{
/* The current archive is not large enough. */
enlarge_archive (ah, head);
@@ -1000,20 +1034,20 @@ add_locale (struct locarhandle *ah,
/* Add the hash value to the hash table. */
md5hval = archive_hashval (data[cnt].sum, 16);
- idx = md5hval % head->sumhash_size;
- incr = 1 + md5hval % (head->sumhash_size - 2);
+ idx = md5hval % GET (head->sumhash_size);
+ incr = 1 + md5hval % (GET (head->sumhash_size) - 2);
- while (sumhashtab[idx].file_offset != 0)
+ while (GET (sumhashtab[idx].file_offset) != 0)
{
idx += incr;
- if (idx >= head->sumhash_size)
- idx -= head->sumhash_size;
+ if (idx >= GET (head->sumhash_size))
+ idx -= GET (head->sumhash_size);
}
memcpy (sumhashtab[idx].sum, data[cnt].sum, 16);
- sumhashtab[idx].file_offset = file_offsets[cnt];
+ SET (sumhashtab[idx].file_offset, file_offsets[cnt]);
- ++head->sumhash_used;
+ INC (head->sumhash_used, 1);
}
lastoffset = file_offsets[LC_ALL];
@@ -1024,25 +1058,28 @@ add_locale (struct locarhandle *ah,
lastoffset += (data[cnt].size + 15) & -16;
}
- if (namehashent->name_offset == 0)
+ if (GET (namehashent->name_offset) == 0)
{
/* Add the name string. */
- memcpy ((char *) ah->addr + head->string_offset + head->string_used,
+ memcpy ((char *) ah->addr + GET (head->string_offset)
+ + GET (head->string_used),
name, name_len + 1);
- namehashent->name_offset = head->string_offset + head->string_used;
- head->string_used += name_len + 1;
- ++head->namehash_used;
+ SET (namehashent->name_offset,
+ GET (head->string_offset) + GET (head->string_used));
+ INC (head->string_used, name_len + 1);
+ INC (head->namehash_used, 1);
}
- if (namehashent->locrec_offset == 0)
+ if (GET (namehashent->locrec_offset == 0))
{
/* Allocate a name location record. */
- namehashent->locrec_offset = (head->locrectab_offset
- + (head->locrectab_used++
- * sizeof (struct locrecent)));
+ SET (namehashent->locrec_offset, (GET (head->locrectab_offset)
+ + (GET (head->locrectab_used)
+ * sizeof (struct locrecent))));
+ INC (head->locrectab_used, 1);
locrecent = (struct locrecent *) ((char *) ah->addr
- + namehashent->locrec_offset);
- locrecent->refs = 1;
+ + GET (namehashent->locrec_offset));
+ SET (locrecent->refs, 1);
}
else
{
@@ -1050,27 +1087,29 @@ add_locale (struct locarhandle *ah,
we still need a new one. If not, reuse the old one. */
locrecent = (struct locrecent *) ((char *) ah->addr
- + namehashent->locrec_offset);
- if (locrecent->refs > 1)
+ + GET (namehashent->locrec_offset));
+ if (GET (locrecent->refs) > 1)
{
- --locrecent->refs;
- namehashent->locrec_offset = (head->locrectab_offset
- + (head->locrectab_used++
- * sizeof (struct locrecent)));
- locrecent = (struct locrecent *) ((char *) ah->addr
- + namehashent->locrec_offset);
- locrecent->refs = 1;
+ INC (locrecent->refs, -1);
+ SET (namehashent->locrec_offset, (GET (head->locrectab_offset)
+ + (GET (head->locrectab_used)
+ * sizeof (struct locrecent))));
+ INC (head->locrectab_used, 1);
+ locrecent
+ = (struct locrecent *) ((char *) ah->addr
+ + GET (namehashent->locrec_offset));
+ SET (locrecent->refs, 1);
}
}
/* Fill in the table with the locations of the locale data. */
for (cnt = 0; cnt < __LC_LAST; ++cnt)
{
- locrecent->record[cnt].offset = file_offsets[cnt];
- locrecent->record[cnt].len = data[cnt].size;
+ SET (locrecent->record[cnt].offset, file_offsets[cnt]);
+ SET (locrecent->record[cnt].len, data[cnt].size);
}
- return namehashent->locrec_offset;
+ return GET (namehashent->locrec_offset);
}
@@ -1129,7 +1168,8 @@ add_locale_to_archive (ah, name, data, replace)
unsigned int strindex[0];
} *filedata = data[LC_CTYPE].addr;
codeset = (char *) filedata
- + filedata->strindex[_NL_ITEM_INDEX (_NL_CTYPE_CODESET_NAME)];
+ + maybe_swap_uint32 (filedata->strindex[_NL_ITEM_INDEX
+ (_NL_CTYPE_CODESET_NAME)]);
char *normalized_codeset_name = NULL;
normalized_codeset = _nl_normalize_codeset (codeset, strlen (codeset));
@@ -1492,7 +1532,7 @@ delete_locales_from_archive (nlist, list)
head = ah.addr;
namehashtab = (struct namehashent *) ((char *) ah.addr
- + head->namehash_offset);
+ + GET (head->namehash_offset));
while (nlist-- > 0)
{
@@ -1504,30 +1544,31 @@ delete_locales_from_archive (nlist, list)
/* Search for this locale in the archive. */
hval = archive_hashval (locname, strlen (locname));
- idx = hval % head->namehash_size;
- incr = 1 + hval % (head->namehash_size - 2);
+ idx = hval % GET (head->namehash_size);
+ incr = 1 + hval % (GET (head->namehash_size) - 2);
/* If the name_offset field is zero this means this is no
deleted entry and therefore no entry can be found. */
- while (namehashtab[idx].name_offset != 0)
+ while (GET (namehashtab[idx].name_offset) != 0)
{
- if (namehashtab[idx].hashval == hval
+ if (GET (namehashtab[idx].hashval) == hval
&& (strcmp (locname,
- (char *) ah.addr + namehashtab[idx].name_offset)
+ ((char *) ah.addr
+ + GET (namehashtab[idx].name_offset)))
== 0))
{
/* Found the entry. Now mark it as removed by zero-ing
the reference to the locale record. */
- namehashtab[idx].locrec_offset = 0;
+ SET (namehashtab[idx].locrec_offset, 0);
break;
}
idx += incr;
- if (idx >= head->namehash_size)
- idx -= head->namehash_size;
+ if (idx >= GET (head->namehash_size))
+ idx -= GET (head->namehash_size);
}
- if (namehashtab[idx].name_offset == 0 && ! be_quiet)
+ if (GET (namehashtab[idx].name_offset) == 0 && ! be_quiet)
error (0, 0, _("locale \"%s\" not in archive"), locname);
}
@@ -1590,17 +1631,17 @@ show_archive_content (int verbose)
head = ah.addr;
- names = (struct nameent *) xmalloc (head->namehash_used
+ names = (struct nameent *) xmalloc (GET (head->namehash_used)
* sizeof (struct nameent));
namehashtab = (struct namehashent *) ((char *) ah.addr
- + head->namehash_offset);
- for (cnt = used = 0; cnt < head->namehash_size; ++cnt)
- if (namehashtab[cnt].locrec_offset != 0)
+ + GET (head->namehash_offset));
+ for (cnt = used = 0; cnt < GET (head->namehash_size); ++cnt)
+ if (GET (namehashtab[cnt].locrec_offset) != 0)
{
- assert (used < head->namehash_used);
- names[used].name = ah.addr + namehashtab[cnt].name_offset;
- names[used++].locrec_offset = namehashtab[cnt].locrec_offset;
+ assert (used < GET (head->namehash_used));
+ names[used].name = ah.addr + GET (namehashtab[cnt].name_offset);
+ names[used++].locrec_offset = GET (namehashtab[cnt].locrec_offset);
}
/* Sort the names. */
@@ -1612,17 +1653,17 @@ show_archive_content (int verbose)
struct sumhashent *sumhashtab;
int sumused;
- files = (struct dataent *) xmalloc (head->sumhash_used
+ files = (struct dataent *) xmalloc (GET (head->sumhash_used)
* sizeof (struct dataent));
sumhashtab = (struct sumhashent *) ((char *) ah.addr
- + head->sumhash_offset);
- for (cnt = sumused = 0; cnt < head->sumhash_size; ++cnt)
- if (sumhashtab[cnt].file_offset != 0)
+ + GET (head->sumhash_offset));
+ for (cnt = sumused = 0; cnt < GET (head->sumhash_size); ++cnt)
+ if (GET (sumhashtab[cnt].file_offset) != 0)
{
- assert (sumused < head->sumhash_used);
+ assert (sumused < GET (head->sumhash_used));
files[sumused].sum = (const unsigned char *) sumhashtab[cnt].sum;
- files[sumused].file_offset = sumhashtab[cnt].file_offset;
+ files[sumused].file_offset = GET (sumhashtab[cnt].file_offset);
files[sumused++].nlink = 0;
}
@@ -1638,18 +1679,19 @@ show_archive_content (int verbose)
locrec = (struct locrecent *) ((char *) ah.addr
+ names[cnt].locrec_offset);
for (idx = 0; idx < __LC_LAST; ++idx)
- if (locrec->record[LC_ALL].offset != 0
+ if (GET (locrec->record[LC_ALL].offset) != 0
? (idx == LC_ALL
- || (locrec->record[idx].offset
- < locrec->record[LC_ALL].offset)
- || (locrec->record[idx].offset + locrec->record[idx].len
- > (locrec->record[LC_ALL].offset
- + locrec->record[LC_ALL].len)))
+ || (GET (locrec->record[idx].offset)
+ < GET (locrec->record[LC_ALL].offset))
+ || ((GET (locrec->record[idx].offset)
+ + GET (locrec->record[idx].len))
+ > (GET (locrec->record[LC_ALL].offset)
+ + GET (locrec->record[LC_ALL].len))))
: idx != LC_ALL)
{
struct dataent *data, dataent;
- dataent.file_offset = locrec->record[idx].offset;
+ dataent.file_offset = GET (locrec->record[idx].offset);
data = (struct dataent *) bsearch (&dataent, files, sumused,
sizeof (struct dataent),
dataentcmp);
@@ -1671,21 +1713,24 @@ show_archive_content (int verbose)
{
struct dataent *data, dataent;
- dataent.file_offset = locrec->record[idx].offset;
- if (locrec->record[LC_ALL].offset != 0
- && dataent.file_offset >= locrec->record[LC_ALL].offset
- && (dataent.file_offset + locrec->record[idx].len
- <= (locrec->record[LC_ALL].offset
- + locrec->record[LC_ALL].len)))
- dataent.file_offset = locrec->record[LC_ALL].offset;
+ dataent.file_offset = GET (locrec->record[idx].offset);
+ if (GET (locrec->record[LC_ALL].offset) != 0
+ && (dataent.file_offset
+ >= GET (locrec->record[LC_ALL].offset))
+ && (dataent.file_offset + GET (locrec->record[idx].len)
+ <= (GET (locrec->record[LC_ALL].offset)
+ + GET (locrec->record[LC_ALL].len))))
+ dataent.file_offset = GET (locrec->record[LC_ALL].offset);
data = (struct dataent *) bsearch (&dataent, files, sumused,
sizeof (struct dataent),
dataentcmp);
printf ("%6d %7x %3d%c ",
- locrec->record[idx].len, locrec->record[idx].offset,
+ GET (locrec->record[idx].len),
+ GET (locrec->record[idx].offset),
data->nlink,
- dataent.file_offset == locrec->record[LC_ALL].offset
+ (dataent.file_offset
+ == GET (locrec->record[LC_ALL].offset))
? '+' : ' ');
for (i = 0; i < 16; i += 4)
printf ("%02x%02x%02x%02x",
diff --git a/libc/locale/programs/locfile.c b/libc/locale/programs/locfile.c
index f9b26493a..f12ca0725 100644
--- a/libc/locale/programs/locfile.c
+++ b/libc/locale/programs/locfile.c
@@ -22,6 +22,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -540,7 +541,7 @@ compare_files (const char *filename1, const char *filename2, size_t size,
/* True if the locale files use the opposite endianness to the
machine running localedef. */
-int swap_endianness_p;
+bool swap_endianness_p;
/* The target's value of __align__(uint32_t) - 1. */
unsigned int uint32_align_mask = 3;
@@ -629,7 +630,7 @@ add_locale_wstring (struct locale_file *file, const uint32_t *string)
void
add_locale_uint32 (struct locale_file *file, uint32_t value)
{
- align_locale_data (file, sizeof (uint32_t));
+ align_locale_data (file, LOCFILE_ALIGN);
record_offset (file);
value = maybe_swap_uint32 (value);
obstack_grow (&file->data, &value, sizeof (value));
@@ -641,7 +642,7 @@ void
add_locale_uint32_array (struct locale_file *file,
const uint32_t *data, size_t n_elems)
{
- align_locale_data (file, sizeof (uint32_t));
+ align_locale_data (file, LOCFILE_ALIGN);
record_offset (file);
obstack_grow (&file->data, data, n_elems * sizeof (uint32_t));
maybe_swap_uint32_obstack (&file->data, n_elems);
diff --git a/libc/locale/programs/locfile.h b/libc/locale/programs/locfile.h
index 372bbd402..c784b2a31 100644
--- a/libc/locale/programs/locfile.h
+++ b/libc/locale/programs/locfile.h
@@ -18,6 +18,8 @@
#ifndef _LOCFILE_H
#define _LOCFILE_H 1
+#include <byteswap.h>
+#include <stdbool.h>
#include <stdint.h>
#include <sys/uio.h>
@@ -67,26 +69,16 @@ extern void write_all_categories (struct localedef_t *definitions,
const char *locname,
const char *output_path);
-extern int swap_endianness_p;
+extern bool swap_endianness_p;
extern unsigned int uint32_align_mask;
/* Change the output to be big-endian if BIG_ENDIAN is true and
little-endian otherwise. */
static inline void
-set_big_endian (int big_endian)
+set_big_endian (bool big_endian)
{
- swap_endianness_p = ((big_endian != 0) != (__BYTE_ORDER == __BIG_ENDIAN));
-}
-
-/* Swap the order of the bytes in VALUE. */
-static inline uint32_t
-swap_uint32 (uint32_t value)
-{
- return (((value & 0x000000ff) << 24)
- | ((value & 0x0000ff00) << 8)
- | ((value & 0x00ff0000) >> 8)
- | ((value & 0xff000000) >> 24));
+ swap_endianness_p = (big_endian != (__BYTE_ORDER == __BIG_ENDIAN));
}
/* Munge VALUE so that, when stored, it has the correct byte order
@@ -94,7 +86,7 @@ swap_uint32 (uint32_t value)
static inline uint32_t
maybe_swap_uint32 (uint32_t value)
{
- return swap_endianness_p ? swap_uint32 (value) : value;
+ return swap_endianness_p ? bswap_32 (value) : value;
}
/* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
@@ -103,7 +95,7 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
{
if (swap_endianness_p)
while (n-- > 0)
- array[n] = swap_uint32 (array[n]);
+ array[n] = bswap_32 (array[n]);
}
/* Like maybe_swap_uint32_array, but the array of N elements is at
diff --git a/libc/locale/setlocale.c b/libc/locale/setlocale.c
index f92faee31..ece27a915 100644
--- a/libc/locale/setlocale.c
+++ b/libc/locale/setlocale.c
@@ -382,7 +382,7 @@ setlocale (int category, const char *locale)
/* We must not simply free a global locale since we have no
control over the usage. So we mark it as un-deletable.
- Note: do not remove the `if', it's necessary to copy with
+ Note: do not remove the `if', it's necessary to cope with
the builtin locale data. */
if (newdata->usage_count != UNDELETABLE)
newdata->usage_count = UNDELETABLE;
diff --git a/libc/locale/weight.h b/libc/locale/weight.h
index 645eda2fe..b097aaca0 100644
--- a/libc/locale/weight.h
+++ b/libc/locale/weight.h
@@ -69,8 +69,8 @@ findidx (const unsigned char **cpp, size_t len)
/* Up to the next entry. */
cp += nhere;
- if ((1 + nhere) % __alignof__ (int32_t) != 0)
- cp += __alignof__ (int32_t) - (1 + nhere) % __alignof__ (int32_t);
+ if (!LOCFILE_ALIGNED_P (1 + nhere))
+ cp += LOCFILE_ALIGN - (1 + nhere) % LOCFILE_ALIGN;
}
else
{
@@ -89,9 +89,9 @@ findidx (const unsigned char **cpp, size_t len)
{
/* Cannot be in this range. */
cp += 2 * nhere;
- if ((1 + 2 * nhere) % __alignof__ (int32_t) != 0)
- cp += (__alignof__ (int32_t)
- - (1 + 2 * nhere) % __alignof__ (int32_t));
+ if (!LOCFILE_ALIGNED_P (1 + 2 * nhere))
+ cp += (LOCFILE_ALIGN
+ - (1 + 2 * nhere) % LOCFILE_ALIGN);
continue;
}
@@ -104,9 +104,9 @@ findidx (const unsigned char **cpp, size_t len)
{
/* Cannot be in this range. */
cp += 2 * nhere;
- if ((1 + 2 * nhere) % __alignof__ (int32_t) != 0)
- cp += (__alignof__ (int32_t)
- - (1 + 2 * nhere) % __alignof__ (int32_t));
+ if (!LOCFILE_ALIGNED_P (1 + 2 * nhere))
+ cp += (LOCFILE_ALIGN
+ - (1 + 2 * nhere) % LOCFILE_ALIGN);
continue;
}
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index c87b205ca..b87cc98f4 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,257 @@
+2013-10-13 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/he_IL: Adjust language-code fields of LC_ADDRESS.
+ * locales/hi_IN: Likewise.
+ * locales/hne_IN: Likewise.
+ * locales/hr_HR: Likewise.
+ * locales/hsb_DE: Likewise.
+ * locales/ht_HT: Likewise.
+ * locales/hu_HU: Likewise.
+ * locales/hy_AM: Likewise.
+ * locales/ia_FR: Likewise.
+ * locales/id_ID: Likewise.
+ * locales/ig_NG: Likewise.
+ * locales/ik_CA: Likewise.
+ * locales/is_IS: Likewise.
+ * locales/it_CH: Likewise.
+ * locales/it_IT: Likewise.
+ * locales/iu_CA: Likewise.
+
+2013-10-05 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/ff_SN: Adjust language-code fields of LC_ADDRESS.
+ * locales/fil_PH: Likewise.
+ * locales/fo_FO: Likewise.
+ * locales/fr_BE: Likewise.
+ * locales/fr_CA: Likewise.
+ * locales/fr_CH: Likewise.
+ * locales/fr_FR: Likewise.
+ * locales/fr_LU: Likewise.
+ * locales/fur_IT: Likewise.
+ * locales/fy_DE: Likewise.
+ * locales/fy_NL: Likewise.
+ * locales/ga_IE: Likewise.
+ * locales/gez_ER: Likewise.
+ * locales/gez_ET: Likewise.
+ * locales/gl_ES: Likewise.
+ * locales/gu_IN: Likewise.
+ * locales/gv_GB: Likewise.
+
+2013-10-04 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/pap_AN: Copy / modify pap_AN into pap_AW and pap_CW.
+ * locales/pap_AW: Likewise.
+ * locales/pap_CW: Likewise.
+ * SUPPORTED: Add ar_SS, pap_AW, pap_CW.
+
+2013-10-04 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/ar_SD: Split ar_SD into ar_SD and ar_SS
+ * locales/ar_SS: Likewise.
+
+2013-09-25 Michael Bauer <fios@akerbeltz.org>
+
+ [BZ #15400]
+ * locales/gd_GB: Version 1.2 of gd_GB locale.
+
+2013-09-23 Wei-Lun Chao <bluebat@member.fsf.org>
+
+ [BZ #15609]
+ * locales/cmn_TW: New locale for cmn_TW.
+ * SUPPORTED: Add cmn_TW.
+
+2013-09-23 Wei-Lun Chao <bluebat@member.fsf.org>
+
+ [BZ #15608]
+ * locales/hak_TW: New locale for hak_TW.
+ * SUPPORTED: Add hak_TW.
+
+2013-09-23 Wei-Lun Chao <bluebat@member.fsf.org>
+
+ [BZ #15608]
+ * locales/lzh_TW: New locale for lzh_TW.
+ * SUPPORTED: Add lzh_TW.
+
+2013-09-23 Wei-Lun Chao <bluebat@member.fsf.org>
+
+ [BZ #15608]
+ * locales/nan_TW: New locale for nan_TW.
+ * SUPPORTED: Add nan_TW.
+
+2013-09-15 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/as_IN: Adjust language-code fields of LC_ADDRESS.
+ * locales/ast_ES: Likewise.
+ * locales/ayc_PE: Likewise.
+ * locales/az_AZ: Likewise.
+ * locales/be_BY: Likewise.
+ * locales/bem_ZM: Likewise.
+ * locales/bg_BG: Likewise.
+ * locales/bho_IN: Likewise.
+ * locales/bn_BD: Likewise.
+ * locales/bn_IN: Likewise.
+ * locales/bo_CN: Likewise.
+ * locales/bo_IN: Likewise.
+ * locales/br_FR: Likewise.
+ * locales/brx_IN: Likewise.
+ * locales/bs_BA: Likewise.
+ * locales/ca_AD: Likewise.
+ * locales/ca_ES: Likewise.
+ * locales/ca_FR: Likewise.
+ * locales/ca_IT: Likewise.
+ * locales/crh_UA: Likewise.
+ * locales/csb_PL: Likewise.
+ * locales/cv_RU: Likewise.
+ * locales/da_DK: Likewise.
+ * locales/de_AT: Likewise.
+ * locales/de_BE: Likewise.
+ * locales/de_CH: Likewise.
+ * locales/de_DE: Likewise.
+ * locales/de_LU: Likewise.
+ * locales/doi_IN: Likewise.
+ * locales/dv_MV: Likewise.
+ * locales/dz_BT: Likewise.
+ * locales/el_CY: Likewise.
+ * locales/el_GR: Likewise.
+ * locales/en_AG: Likewise.
+ * locales/en_AU: Likewise.
+ * locales/en_BW: Likewise.
+ * locales/en_CA: Likewise.
+ * locales/en_DK: Likewise.
+ * locales/en_GB: Likewise.
+ * locales/en_HK: Likewise.
+ * locales/en_IE: Likewise.
+ * locales/en_IN: Likewise.
+ * locales/en_NG: Likewise.
+ * locales/en_NZ: Likewise.
+ * locales/en_PH: Likewise.
+ * locales/en_SG: Likewise.
+ * locales/en_US: Likewise.
+ * locales/en_ZA: Likewise.
+ * locales/en_ZM: Likewise.
+ * locales/en_ZW: Likewise.
+ * locales/es_AR: Likewise.
+ * locales/es_BO: Likewise.
+ * locales/es_CL: Likewise.
+ * locales/es_CO: Likewise.
+ * locales/es_CR: Likewise.
+ * locales/es_CU: Likewise.
+ * locales/es_DO: Likewise.
+ * locales/es_EC: Likewise.
+ * locales/es_ES: Likewise.
+ * locales/es_GT: Likewise.
+ * locales/es_HN: Likewise.
+ * locales/es_MX: Likewise.
+ * locales/es_NI: Likewise.
+ * locales/es_PA: Likewise.
+ * locales/es_PE: Likewise.
+ * locales/es_PR: Likewise.
+ * locales/es_PY: Likewise.
+ * locales/es_SV: Likewise.
+ * locales/es_US: Likewise.
+ * locales/es_UY: Likewise.
+ * locales/es_VE: Likewise.
+ * locales/eu_ES: Likewise.
+
+2013-09-21 Chris Leonard <cjl@sugarlabs.org>
+
+ [BZ#15919]
+ * locales/ak_GH: New locale for ak_GH.
+ * SUPPORTED: Add ak_GH.
+
+2013-09-15 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/aa_DJ: Adjust language-code fields of LC_ADDRESS.
+ * locales/aa_ER: Likewise.
+ * locales/aa_ET: Likewise.
+ * locales/af_ZA: Likewise.
+ * locales/am_ET: Likewise.
+ * locales/ar_AE: Likewise.
+ * locales/ar_BH: Likewise.
+ * locales/ar_DZ: Likewise.
+ * locales/ar_EG: Likewise.
+ * locales/ar_IN: Likewise.
+ * locales/ar_IQ: Likewise.
+ * locales/ar_JO: Likewise.
+ * locales/ar_KW: Likewise.
+ * locales/ar_LB: Likewise.
+ * locales/ar_LY: Likewise.
+ * locales/ar_MA: Likewise.
+ * locales/ar_OM: Likewise.
+ * locales/ar_QA: Likewise.
+ * locales/ar_SA: Likewise.
+ * locales/ar_SD: Likewise.
+ * locales/ar_SY: Likewise.
+ * locales/ar_TN: Likewise.
+ * locales/ar_YE: Likewise.
+
+2013-09-15 Chris Leonard <cjl@sugarlabs.org>
+
+ * locales/aa_ER: Add country_car field to LC_ADDRESS.
+ * locales/as_IN: Likewise.
+ * locales/ast_ES: Likewise.
+ * locales/ayc_PE: Likewise.
+ * locales/bem_ZM: Likewise.
+ * locales/ber_DZ: Likewise.
+ * locales/ber_MA: Likewise.
+ * locales/bho_IN: Likewise.
+ * locales/bo_IN: Likewise.
+ * locales/brx_IN: Likewise.
+ * locales/byn_ER: Likewise.
+ * locales/ca_AD: Likewise.
+ * locales/ca_FR: Likewise.
+ * locales/ca_IT: Likewise.
+ * locales/crh_UA: Likewise.
+ * locales/cv_RU: Likewise.
+ * locales/doi_IN: Likewise.
+ * locales/dz_BT: Likewise.
+ * locales/el_CY: Likewise.
+ * locales/en_US: Likewise.
+ * locales/en_ZM: Likewise.
+ * locales/es_CU: Likewise.
+ * locales/ff_SN: Likewise.
+ * locales/fil_PH: Likewise.
+ * locales/gd_GB: Likewise.
+ * locales/hne_IN: Likewise.
+ * locales/ht_HT: Likewise.
+ * locales/kl_GL: Likewise.
+ * locales/kok_IN: Likewise.
+ * locales/ks_IN: Likewise.
+ * locales/lij_IT: Likewise.
+ * locales/mag_IN: Likewise.
+ * locales/mai_IN: Likewise.
+ * locales/mg_MG: Likewise.
+ * locales/mhr_RU: Likewise.
+ * locales/mni_IN: Likewise.
+ * locales/my_MM: Likewise.
+ * locales/nhn_MX: Likewise.
+ * locales/niu_NZ: Likewise.
+ * locales/or_IN: Likewise.
+ * locales/os_RU: Likewise.
+ * locales/pa_PK: Likewise.
+ * locales/quz_PE: Likewise.
+ * locales/rw_RW: Likewise.
+ * locales/sat_IN: Likewise.
+ * locales/sc_IT: Likewise.
+ * locales/sd_IN: Likewise.
+ * locales/sd_IN@devanagari: Likewise.
+ * locales/shs_CA: Likewise.
+ * locales/si_LK: Likewise.
+ * locales/sid_ET: Likewise.
+ * locales/sq_MK: Likewise.
+ * locales/sw_KE: Likewise.
+ * locales/sw_TZ: Likewise.
+ * locales/szl_PL: Likewise.
+ * locales/ta_LK: Likewise.
+ * locales/ti_ER: Likewise.
+ * locales/tig_ER: Likewise.
+ * locales/tl_PH: Likewise.
+ * locales/ts_ZA: Likewise.
+ * locales/unm_US: Likewise.
+ * locales/ur_IN: Likewise.
+ * locales/wa_BE: Likewise.
+ * locales/yi_US: Likewise.
+
2013-09-06 Chris Leonard <cjl@sugarlabs,.org>
* locales/nr_ZA: Deduplicate country_car.
@@ -9,7 +263,7 @@
2013-09-04 Chris Leonard <cjl@sugarlabs,.org>
- [BZ #15923]
+ [BZ #15923]
* locales/ar_SD: Update iso-1427.def and related occurrences.
* locales/az_AZ: Likewise.
diff --git a/libc/localedata/SUPPORTED b/libc/localedata/SUPPORTED
index 41a7427df..9fde294a8 100644
--- a/libc/localedata/SUPPORTED
+++ b/libc/localedata/SUPPORTED
@@ -8,6 +8,7 @@ aa_ER@saaho/UTF-8 \
aa_ET/UTF-8 \
af_ZA.UTF-8/UTF-8 \
af_ZA/ISO-8859-1 \
+ak_GH/UTF-8 \
am_ET/UTF-8 \
an_ES.UTF-8/UTF-8 \
an_ES/ISO-8859-15 \
@@ -40,6 +41,7 @@ ar_SA.UTF-8/UTF-8 \
ar_SA/ISO-8859-6 \
ar_SD.UTF-8/UTF-8 \
ar_SD/ISO-8859-6 \
+ar_SS/UTF-8 \
ar_SY.UTF-8/UTF-8 \
ar_SY/ISO-8859-6 \
ar_TN.UTF-8/UTF-8 \
@@ -80,6 +82,7 @@ ca_FR.UTF-8/UTF-8 \
ca_FR/ISO-8859-15 \
ca_IT.UTF-8/UTF-8 \
ca_IT/ISO-8859-15 \
+cmn_TW/UTF-8 \
crh_UA/UTF-8 \
cs_CZ.UTF-8/UTF-8 \
cs_CZ/ISO-8859-2 \
@@ -229,6 +232,7 @@ gu_IN/UTF-8 \
gv_GB.UTF-8/UTF-8 \
gv_GB/ISO-8859-1 \
ha_NG/UTF-8 \
+hak_TW/UTF-8 \
he_IL.UTF-8/UTF-8 \
he_IL/ISO-8859-8 \
hi_IN/UTF-8 \
@@ -288,6 +292,7 @@ lt_LT.UTF-8/UTF-8 \
lt_LT/ISO-8859-13 \
lv_LV.UTF-8/UTF-8 \
lv_LV/ISO-8859-13 \
+lzh_TW/UTF-8 \
mag_IN/UTF-8 \
mai_IN/UTF-8 \
mg_MG.UTF-8/UTF-8 \
@@ -306,6 +311,7 @@ ms_MY/ISO-8859-1 \
mt_MT.UTF-8/UTF-8 \
mt_MT/ISO-8859-3 \
my_MM/UTF-8 \
+nan_TW/UTF-8 \
nan_TW@latin/UTF-8 \
nb_NO.UTF-8/UTF-8 \
nb_NO/ISO-8859-1 \
@@ -336,6 +342,8 @@ os_RU/UTF-8 \
pa_IN/UTF-8 \
pa_PK/UTF-8 \
pap_AN/UTF-8 \
+pap_AW/UTF-8 \
+pap_CW/UTF-8 \
pl_PL.UTF-8/UTF-8 \
pl_PL/ISO-8859-2 \
ps_AF/UTF-8 \
diff --git a/libc/localedata/locales/aa_DJ b/libc/localedata/locales/aa_DJ
index 184b8c474..369caf24c 100644
--- a/libc/localedata/locales/aa_DJ
+++ b/libc/localedata/locales/aa_DJ
@@ -159,8 +159,11 @@ country_num 262
% country_car unknown
% country_isbn unknown, Need ISO 2108
lang_name "<U0051><U0061><U0066><U0061><U0072>"
+% aa
lang_ab "<U0061><U0061>"
+% aar
lang_term "<U0061><U0061><U0072>"
+% aar
lang_lib "<U0061><U0061><U0072>"
%
END LC_ADDRESS
diff --git a/libc/localedata/locales/aa_ER b/libc/localedata/locales/aa_ER
index 1f369a178..5f8a60e91 100644
--- a/libc/localedata/locales/aa_ER
+++ b/libc/localedata/locales/aa_ER
@@ -109,11 +109,15 @@ country_post "<U0045><U0052><U0049>"
country_ab2 "<U0045><U0052>"
country_ab3 "<U0045><U0052><U0049>"
country_num 232
-% country_car unknown
+% ER
+country_car "<U0045><U0052>"
% country_isbn unknown, Need ISO 2108
lang_name "<U0051><U0061><U0066><U0061><U0072>"
+% aa
lang_ab "<U0061><U0061>"
+% aar
lang_term "<U0061><U0061><U0072>"
+% aar
lang_lib "<U0061><U0061><U0072>"
%
END LC_ADDRESS
diff --git a/libc/localedata/locales/aa_ET b/libc/localedata/locales/aa_ET
index 8bf7c375e..bc64388b9 100644
--- a/libc/localedata/locales/aa_ET
+++ b/libc/localedata/locales/aa_ET
@@ -113,8 +113,11 @@ country_num 231 % 210 found in at least one ISO 3166 doc
country_car "<U0045><U0054><U0048>"
% country_isbn unknown, Need ISO 2108
lang_name "<U0051><U0061><U0066><U0061><U0072>"
+% aa
lang_ab "<U0061><U0061>"
+% aar
lang_term "<U0061><U0061><U0072>"
+% aar
lang_lib "<U0061><U0061><U0072>"
%
END LC_ADDRESS
diff --git a/libc/localedata/locales/af_ZA b/libc/localedata/locales/af_ZA
index ec588605e..e7df1c3c1 100644
--- a/libc/localedata/locales/af_ZA
+++ b/libc/localedata/locales/af_ZA
@@ -279,10 +279,12 @@ country_isbn 0
% ISO 639 language abbreviations:
% 639-1 2 letter, 639-2 3 letter terminology
% http://www.loc.gov/standards/iso639-2/englangn.html
-% "af", "afr", "afr"
-lang_ab "<U0061><U0066>"
-lang_term "<U0061><U0066><U0072>"
-lang_lib "<U0061><U0066><U0072>"
+% af
+lang_ab "<U0061><U0066>"
+% afr
+lang_term "<U0061><U0066><U0072>"
+% afr
+lang_lib "<U0061><U0066><U0072>"
% ISO 3166 country number and 2 and 3 letter abbreviations
% http://www.unicode.org/onlinedat/countries.html
diff --git a/libc/localedata/locales/ak_GH b/libc/localedata/locales/ak_GH
new file mode 100644
index 000000000..b33ba6b08
--- /dev/null
+++ b/libc/localedata/locales/ak_GH
@@ -0,0 +1,216 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Akan locale for Ghana
+%
+% Prepared and contributed to glibc by Chris Leonard <cjl@sugarlabs.org>
+% and Jojoo Imbeah <jojoo.imbeah@kasahorow.com>
+%
+% This locale data has been developed by:
+% Sugar Labs, http://www.sugarlabs.org/
+% kasahorow, http://www.kasahorow.org/
+%
+% build with: localedef -f UTF-8 -i ak_GH ak_GH
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Akan locale for Ghana"
+source "Sugar Labs / OLPC"
+address ""
+contact "sugarlabs.org"
+email "libc-alpha@sourceware.org"
+tel ""
+fax ""
+language "Akan"
+territory "Ghana"
+revision "1.0"
+date "2013-08-24"
+%
+category "ak_GH:2013";LC_IDENTIFICATION
+category "ak_GH:2013";LC_CTYPE
+category "ak_GH:2013";LC_COLLATE
+category "ak_GH:2013";LC_TIME
+category "ak_GH:2013";LC_NUMERIC
+category "ak_GH:2013";LC_MONETARY
+category "ak_GH:2013";LC_PAPER
+category "ak_GH:2013";LC_MEASUREMENT
+category "ak_GH:2013";LC_MESSAGES
+category "ak_GH:2013";LC_NAME
+category "ak_GH:2013";LC_ADDRESS
+category "ak_GH:2013";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% Sanda-ƆpÉ›pÉ”n, Kwakwar-Ɔgyefuo, EbÉ”w-Ɔbenem, EbÉ”bira-Oforisuo, Esusow Aketseaba-KÉ”tÉ”nimba, Obirade-AyÉ›wohomumu, AyÉ›woho-Kitawonsa, Difuu-Ɔsandaa, Fankwa-ÆbÉ”, ƆbÉ›sÉ›-Ahinime, ƆberÉ›fÉ›w-Obubuo, Mumu-ƆpÉ›nimba
+mon "<U0053><U0061><U006E><U0064><U0061><U002D><U0186><U0070><U025B><U0070><U0254><U006E>";/
+ "<U004B><U0077><U0061><U006B><U0077><U0061><U0072><U002D><U0186><U0067><U0079><U0065><U0066><U0075><U006F>";/
+ "<U0045><U0062><U0254><U0077><U002D><U0186><U0062><U0065><U006E><U0065><U006D>";/
+ "<U0045><U0062><U0254><U0062><U0069><U0072><U0061><U002D><U004F><U0066><U006F><U0072><U0069><U0073><U0075><U006F>";/
+ "<U0045><U0073><U0075><U0073><U006F><U0077><U0020><U0041><U006B><U0065><U0074><U0073><U0065><U0061><U0062><U0061><U002D><U004B><U0254><U0074><U0254><U006E><U0069><U006D><U0062><U0061>";/
+ "<U004F><U0062><U0069><U0072><U0061><U0064><U0065><U002D><U0041><U0079><U025B><U0077><U006F><U0068><U006F><U006D><U0075><U006D><U0075>";/
+ "<U0041><U0079><U025B><U0077><U006F><U0068><U006F><U002D><U004B><U0069><U0074><U0061><U0077><U006F><U006E><U0073><U0061>";/
+ "<U0044><U0069><U0066><U0075><U0075><U002D><U0186><U0073><U0061><U006E><U0064><U0061><U0061>";/
+ "<U0046><U0061><U006E><U006B><U0077><U0061><U002D><U0190><U0062><U0254>";/
+ "<U0186><U0062><U025B><U0073><U025B><U002D><U0041><U0068><U0069><U006E><U0069><U006D><U0065>";/
+ "<U0186><U0062><U0065><U0072><U025B><U0066><U025B><U0077><U002D><U004F><U0062><U0075><U0062><U0075><U006F>";/
+ "<U004D><U0075><U006D><U0075><U002D><U0186><U0070><U025B><U006E><U0069><U006D><U0062><U0061>"
+% S-Ɔ, K-Ɔ, E-Ɔ, E-O, E-K, O-A, A-K, D-Ɔ, F-Æ, Ɔ-A, Ɔ-O, M-Ɔ
+abmon "<U0053><U002D><U0186>";/
+ "<U004B><U002D><U0186>";/
+ "<U0045><U002D><U0186>";/
+ "<U0045><U002D><U004F>";/
+ "<U0045><U002D><U004B>";/
+ "<U004F><U002D><U0041>";/
+ "<U0041><U002D><U004B>";/
+ "<U0044><U002D><U0186>";/
+ "<U0046><U002D><U0190>";/
+ "<U0186><U002D><U0041>";/
+ "<U0186><U002D><U004F>";/
+ "<U004D><U002D><U0186>"
+% Kwesida, Dwowda, Benada, Wukuda, Yawda, Fida, Memeneda
+day "<U004B><U0077><U0065><U0073><U0069><U0064><U0061>";/
+ "<U0044><U0077><U006F><U0077><U0064><U0061>";/
+ "<U0042><U0065><U006E><U0061><U0064><U0061>";/
+ "<U0057><U0075><U006B><U0075><U0064><U0061>";/
+ "<U0059><U0061><U0077><U0064><U0061>";/
+ "<U0046><U0069><U0064><U0061>";/
+ "<U004D><U0065><U006D><U0065><U006E><U0065><U0064><U0061>"
+% Kwe, Dwo, Ben, Wuk, Yaw, Fia, Mem
+abday "<U004B><U0077><U0065>";/
+ "<U0044><U0077><U006F>";/
+ "<U0042><U0065><U006E>";/
+ "<U0057><U0075><U006B>";/
+ "<U0059><U0061><U0077>";/
+ "<U0046><U0069><U0061>";/
+ "<U004D><U0065><U006D>"
+% %a %d %b %Y %T %Z
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+% %Y/%m/%d
+d_fmt "<U0025><U0059><U002F><U0025><U006D><U002F><U0025><U0064>"
+% %r
+t_fmt "<U0025><U0072>"
+% AM/PM time representation: %I:%M:%S %p
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
+% Strings for AM/PM: AN/EW
+am_pm "<U0041><U004E>";"<U0045><U0057>"
+week 7;19971130;7
+first_weekday 1
+first_workday 2
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping 3
+END LC_NUMERIC
+
+LC_MONETARY
+% GHS
+int_curr_symbol "<U0047><U0048><U0053><U0020>"
+% GH₵
+currency_symbol "<U0047><U0048><U20B5>"
+% .
+mon_decimal_point "<U002E>"
+% ,
+mon_thousands_sep "<U002C>"
+mon_grouping 3
+positive_sign ""
+% -
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 0
+p_sep_by_space 1
+n_cs_precedes 0
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 1
+END LC_MONETARY
+
+LC_PAPER
+% A4
+height 297
+width 210
+END LC_PAPER
+
+LC_MEASUREMENT
+% metric
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yY].*
+yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
+% ^[dDnN].*
+noexpr "<U005E><U005B><U0064><U0044><U006E><U004E><U005D><U002E><U002A>"
+% Yiw
+yesstr "<U0059><U0069><U0077>"
+% Daabi
+nostr "<U0044><U0061><U0061><U0062><U0069>"
+END LC_MESSAGES
+
+LC_NAME
+name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0068>/
+<U0020><U0025><U0073><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0054><U002C><U0020><U0025><U0053><U0020><U0025><U007A><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+% Gaana
+country_name "<U0047><U0061><U0061><U006E><U0061>"
+% GH
+country_post "<U0047><U0048>"
+% GH
+country_ab2 "<U0047><U0048>"
+% GHA
+country_ab3 "<U0047><U0048><U0041>"
+country_num 288
+country_isbn 9964
+% Akan
+lang_name "<U0041><U006B><U0061><U006E>"
+% ak
+lang_ab "<U0061><U006B>"
+% aka
+lang_term "<U0061><U006B><U0061>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c %a %l
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025><U006C>"
+% %a %l
+tel_dom_fmt "<U0025><U0061><U0020><U0025><U006C>"
+% 00
+int_select "<U0030><U0030>"
+% 233
+int_prefix "<U0032><U0033><U0033>"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/am_ET b/libc/localedata/locales/am_ET
index 717962242..ed66cf6e1 100644
--- a/libc/localedata/locales/am_ET
+++ b/libc/localedata/locales/am_ET
@@ -1448,9 +1448,12 @@ country_num 231 % 210 found in at least one ISO 3166 doc
country_car "<U0045><U0054><U0048>"
% country_isbn unknown, Need ISO 2108
lang_name "<U12A0><U121B><U122D><U129B>"
-lang_ab "<U0061><U006D>"
-lang_term "<U0061><U006D><U0068>"
-lang_lib "<U0061><U006D><U0068>"
+% am
+lang_ab "<U0061><U006D>"
+% amh
+lang_term "<U0061><U006D><U0068>"
+% amh
+lang_lib "<U0061><U006D><U0068>"
%
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_AE b/libc/localedata/locales/ar_AE
index 368f8803f..c7f249bb4 100644
--- a/libc/localedata/locales/ar_AE
+++ b/libc/localedata/locales/ar_AE
@@ -183,6 +183,12 @@ country_ab3 "<U0041><U0052><U0045>"
country_num 784
% UAE
country_car "<U0055><U0041><U0045>"
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_BH b/libc/localedata/locales/ar_BH
index 41e92655b..39e5e0d94 100644
--- a/libc/localedata/locales/ar_BH
+++ b/libc/localedata/locales/ar_BH
@@ -187,6 +187,12 @@ country_ab3 "<U0042><U0048><U0052>"
country_num 048
% BRN
country_car "<U0042><U0052><U004E>"
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_DZ b/libc/localedata/locales/ar_DZ
index 311dd21f6..cda64af0c 100644
--- a/libc/localedata/locales/ar_DZ
+++ b/libc/localedata/locales/ar_DZ
@@ -186,6 +186,12 @@ country_ab3 "<U0044><U005A><U0041>"
country_num 012
% DZ
country_car "<U0044><U005A>"
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_EG b/libc/localedata/locales/ar_EG
index 844254d5f..3916ed7ba 100644
--- a/libc/localedata/locales/ar_EG
+++ b/libc/localedata/locales/ar_EG
@@ -194,7 +194,12 @@ country_ab3 "<U0045><U0047><U0059>"
country_num 818
% ET
country_car "<U0045><U0054>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_IN b/libc/localedata/locales/ar_IN
index 1c4cdfb3e..819925f07 100644
--- a/libc/localedata/locales/ar_IN
+++ b/libc/localedata/locales/ar_IN
@@ -164,7 +164,12 @@ country_ab3 "<U0049><U004E><U0044>"
country_num 356
% IND
country_car "<U0049><U004E><U0044>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_IQ b/libc/localedata/locales/ar_IQ
index 8eea49b06..a398234d0 100644
--- a/libc/localedata/locales/ar_IQ
+++ b/libc/localedata/locales/ar_IQ
@@ -186,7 +186,12 @@ country_ab3 "<U0049><U0052><U0051>"
country_num 368
% IRQ
country_car "<U0049><U0052><U0051>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_JO b/libc/localedata/locales/ar_JO
index 7d094efed..8f65c74d4 100644
--- a/libc/localedata/locales/ar_JO
+++ b/libc/localedata/locales/ar_JO
@@ -204,7 +204,12 @@ country_ab3 "<U004A><U004F><U0052>"
country_num 400
% HKJ
country_car "<U0048><U004B><U004A>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_KW b/libc/localedata/locales/ar_KW
index 05a4c7daa..8bd66ada0 100644
--- a/libc/localedata/locales/ar_KW
+++ b/libc/localedata/locales/ar_KW
@@ -186,7 +186,12 @@ country_ab3 "<U004B><U0057><U0054>"
country_num 414
% KWT
country_car "<U004B><U0057><U0054>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_LB b/libc/localedata/locales/ar_LB
index 9144b7261..c946022ef 100644
--- a/libc/localedata/locales/ar_LB
+++ b/libc/localedata/locales/ar_LB
@@ -203,7 +203,12 @@ country_ab3 "<U004C><U0042><U004E>"
country_num 422
% RL
country_car "<U0052><U004C>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_LY b/libc/localedata/locales/ar_LY
index 719917948..d95255d6a 100644
--- a/libc/localedata/locales/ar_LY
+++ b/libc/localedata/locales/ar_LY
@@ -186,7 +186,12 @@ country_ab3 "<U004C><U0042><U0059>"
country_num 434
% LAR
country_car "<U004C><U0041><U0052>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_MA b/libc/localedata/locales/ar_MA
index f389eba55..d13dd6110 100644
--- a/libc/localedata/locales/ar_MA
+++ b/libc/localedata/locales/ar_MA
@@ -186,7 +186,12 @@ country_ab3 "<U004D><U0041><U0052>"
country_num 504
% MA
country_car "<U004D><U0041>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_OM b/libc/localedata/locales/ar_OM
index b43475ef6..ea546bdd2 100644
--- a/libc/localedata/locales/ar_OM
+++ b/libc/localedata/locales/ar_OM
@@ -184,7 +184,12 @@ postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
country_ab2 "<U004F><U004D>"
country_ab3 "<U004F><U004D><U004E>"
country_num 512
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_QA b/libc/localedata/locales/ar_QA
index e01dbcc23..4764f696e 100644
--- a/libc/localedata/locales/ar_QA
+++ b/libc/localedata/locales/ar_QA
@@ -186,7 +186,12 @@ country_ab3 "<U0051><U0041><U0054>"
country_num 634
% Q
country_car "<U0051>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_SA b/libc/localedata/locales/ar_SA
index 8660758c9..538449e53 100644
--- a/libc/localedata/locales/ar_SA
+++ b/libc/localedata/locales/ar_SA
@@ -388,5 +388,10 @@ country_ab3 "<U0053><U0041><U0055>"
country_num 682
% KSA
country_car "<U004B><U0053><U0041>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_SD b/libc/localedata/locales/ar_SD
index f68033d10..c8a34691d 100644
--- a/libc/localedata/locales/ar_SD
+++ b/libc/localedata/locales/ar_SD
@@ -1,8 +1,21 @@
comment_char %
escape_char /
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
% Arabic language locale for Sudan.
% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
% Tetsuji Orita <orita@jp.ibm.com>.
+%
+% Modified by Chris Leonard, version 1.1 for South Sudan split
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LC_IDENTIFICATION
title "Arabic language locale for Sudan"
@@ -14,7 +27,7 @@ tel ""
fax ""
language "Arabic"
territory "Sudan"
-revision "1.0"
+revision "1.1"
date "2000-07-20"
%
category "ar_SD:2000";LC_IDENTIFICATION
@@ -182,12 +195,19 @@ LC_ADDRESS
% LC_ADDRESS
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
+% SD
country_ab2 "<U0053><U0044>"
+% SDN
country_ab3 "<U0053><U0044><U004E>"
-country_num 736
+country_num 729
% SUD
country_car "<U0053><U0055><U0044>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_SS b/libc/localedata/locales/ar_SS
new file mode 100644
index 000000000..8cf487ad2
--- /dev/null
+++ b/libc/localedata/locales/ar_SS
@@ -0,0 +1,227 @@
+comment_char %
+escape_char /
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+% Arabic language locale for South Sudan.
+% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
+% Tetsuji Orita <orita@jp.ibm.com>.
+%
+% Modified by Chris Leonard, version 1.1 for South Sudan split
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Arabic language locale for South Sudan"
+source "IBM Globalization Center of Competency, Yamato Software Laboratory"
+address "1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan"
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Arabic"
+territory "South Sudan"
+revision "1.1"
+date "2000-07-20"
+%
+category "ar_SS:2000";LC_IDENTIFICATION
+category "ar_SS:2000";LC_CTYPE
+category "ar_SS:2000";LC_COLLATE
+category "ar_SS:2000";LC_TIME
+category "ar_SS:2000";LC_NUMERIC
+category "ar_SS:2000";LC_MONETARY
+category "ar_SS:2000";LC_MESSAGES
+category "ar_SS:2000";LC_PAPER
+category "ar_SS:2000";LC_NAME
+category "ar_SS:2000";LC_ADDRESS
+category "ar_SS:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "ar_EG"
+END LC_CTYPE
+
+LC_COLLATE
+
+% Copy the template from ISO/IEC 14651
+copy "iso14651_t1"
+
+END LC_COLLATE
+
+LC_MONETARY
+% This is the POSIX Locale definition the LC_MONETARY category.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode/Java
+%
+% SDG
+int_curr_symbol "<U0053><U0044><U0047><U0020>"
+currency_symbol "<U062C><U002E><U0633><U002E>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep "<U002C>"
+mon_grouping 3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 3
+frac_digits 3
+p_cs_precedes 1
+p_sep_by_space 1
+n_cs_precedes 1
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 2
+%
+END LC_MONETARY
+
+
+LC_NUMERIC
+% This is the POSIX Locale definition for the LC_NUMERIC category.
+%
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3
+%
+END LC_NUMERIC
+
+
+LC_TIME
+% This is the POSIX Locale definition for the LC_TIME category.
+% These are generated based on XML base Locale definition file
+% for IBM Class for Unicode/Java
+%
+% Abbreviated weekday names (%a)
+abday "<U062D>";"<U0646>";/
+ "<U062B>";"<U0631>";/
+ "<U062E>";"<U062C>";/
+ "<U0633>"
+%
+% Full weekday names (%A)
+day "<U0627><U0644><U0623><U062D><U062F>";/
+ "<U0627><U0644><U0627><U062B><U0646><U064A><U0646>";/
+ "<U0627><U0644><U062B><U0644><U0627><U062B><U0627><U0621>";/
+ "<U0627><U0644><U0623><U0631><U0628><U0639><U0627><U0621>";/
+ "<U0627><U0644><U062E><U0645><U064A><U0633>";/
+ "<U0627><U0644><U062C><U0645><U0639><U0629>";/
+ "<U0627><U0644><U0633><U0628><U062A>"
+%
+% Abbreviated month names (%b)
+abmon "<U064A><U0646><U0627>";"<U0641><U0628><U0631>";/
+ "<U0645><U0627><U0631>";"<U0623><U0628><U0631>";/
+ "<U0645><U0627><U064A>";"<U064A><U0648><U0646>";/
+ "<U064A><U0648><U0644>";"<U0623><U063A><U0633>";/
+ "<U0633><U0628><U062A>";"<U0623><U0643><U062A>";/
+ "<U0646><U0648><U0641>";"<U062F><U064A><U0633>"
+%
+% Full month names (%B)
+mon "<U064A><U0646><U0627><U064A><U0631>";/
+ "<U0641><U0628><U0631><U0627><U064A><U0631>";/
+ "<U0645><U0627><U0631><U0633>";/
+ "<U0623><U0628><U0631><U064A><U0644>";/
+ "<U0645><U0627><U064A><U0648>";/
+ "<U064A><U0648><U0646><U064A><U0648>";/
+ "<U064A><U0648><U0644><U064A><U0648>";/
+ "<U0623><U063A><U0633><U0637><U0633>";/
+ "<U0633><U0628><U062A><U0645><U0628><U0631>";/
+ "<U0623><U0643><U062A><U0648><U0628><U0631>";/
+ "<U0646><U0648><U0641><U0645><U0628><U0631>";/
+ "<U062F><U064A><U0633><U0645><U0628><U0631>"
+%
+% Equivalent of AM PM
+am_pm "<U0635>";"<U0645>"
+%
+% Appropriate date and time representation
+% %d %b, %Y%Z %I:%M:%S
+d_t_fmt "<U0025><U0064><U0020><U0025><U0062><U002C><U0020><U0025>/
+<U0059><U0020><U0025><U005A><U0020><U0025><U0049><U003A><U0025><U004D>/
+<U003A><U0025><U0053><U0020><U0025><U0070>"
+%
+% Appropriate date representation
+% %d %b, %Y
+d_fmt "<U0025><U0064><U0020><U0025><U0062><U002C><U0020><U0025><U0059>"
+%
+% Appropriate time representation
+% %Z %I:%M:%S
+t_fmt "<U0025><U005A><U0020><U0025><U0049><U003A><U0025><U004D>/
+<U003A><U0025><U0053><U0020>"
+%
+% Appropriate 12 h time representation (%r)
+t_fmt_ampm "<U0025><U005A><U0020><U0025><U0049><U003A><U0025><U004D>/
+<U003A><U0025><U0053><U0020><U0025><U0070>"
+%
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+
+LC_MESSAGES
+copy "ar_EG"
+END LC_MESSAGES
+
+
+LC_PAPER
+% This is the ISO_IEC TR14652 Locale definition for the
+% LC_PAPER category
+height 297
+width 210
+
+END LC_PAPER
+
+
+LC_NAME
+% This is the ISO_IEC TR14652 Locale definition for the
+% LC_NAME category.
+%
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
+<U0025><U0067>"
+name_gen "<U002D><U0073><U0061><U006E>"
+name_mr "<U004D><U0072><U002E>"
+name_mrs "<U004D><U0072><U0073><U002E>"
+name_miss "<U004D><U0069><U0073><U0073><U002E>"
+name_ms "<U004D><U0073><U002E>"
+
+END LC_NAME
+
+
+LC_ADDRESS
+% This is the ISO_IEC TR14652 Locale definition for the
+% LC_ADDRESS
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+% SS
+country_ab2 "<U0053><U0053>"
+% SSD
+country_ab3 "<U0053><U0053><U0044>"
+country_num 728
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
+END LC_ADDRESS
+
+
+LC_TELEPHONE
+% This is the ISO_IEC TR14652 Locale definition for the
+%
+tel_int_fmt "<U002B><U0025><U0063><U0020><U003B><U0025><U0061><U0020>/
+<U003B><U0025><U006C>"
+int_prefix "<U0032><U0034><U0039>"
+
+END LC_TELEPHONE
+
+
+LC_MEASUREMENT
+% This is the ISO_IEC TR14652 Locale definition for the
+%
+measurement 1
+
+END LC_MEASUREMENT
diff --git a/libc/localedata/locales/ar_SY b/libc/localedata/locales/ar_SY
index 9530f1842..9290de595 100644
--- a/libc/localedata/locales/ar_SY
+++ b/libc/localedata/locales/ar_SY
@@ -203,7 +203,12 @@ country_ab3 "<U0053><U0059><U0052>"
country_num 760
% SYR
country_car "<U0053><U0059><U0052>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_TN b/libc/localedata/locales/ar_TN
index 7103272f9..9714e4e33 100644
--- a/libc/localedata/locales/ar_TN
+++ b/libc/localedata/locales/ar_TN
@@ -186,7 +186,12 @@ country_ab3 "<U0054><U0055><U004E>"
country_num 788
% TN
country_car "<U0054><U004E>"
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ar_YE b/libc/localedata/locales/ar_YE
index 91da9e92b..0413752eb 100644
--- a/libc/localedata/locales/ar_YE
+++ b/libc/localedata/locales/ar_YE
@@ -184,7 +184,12 @@ postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
country_ab2 "<U0059><U0045>"
country_ab3 "<U0059><U0045><U004D>"
country_num 887
-
+% ar
+lang_ab "<U0061><U0072>"
+% ara
+lang_term "<U0061><U0072><U0061>"
+% ara
+lang_lib "<U0061><U0072><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/as_IN b/libc/localedata/locales/as_IN
index 47164ebae..b7288b72c 100644
--- a/libc/localedata/locales/as_IN
+++ b/libc/localedata/locales/as_IN
@@ -157,6 +157,14 @@ LC_ADDRESS
% LC_ADDRESS
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
+% IND
+country_car "<U0049><U004E><U0044>"
+% as
+lang_ab "<U0061><U0073>"
+% asm
+lang_term "<U0061><U0073><U006D>"
+% asm
+lang_lib "<U0061><U0073><U006D>"
END LC_ADDRESS
%%%%%%%%%%%%%
diff --git a/libc/localedata/locales/ast_ES b/libc/localedata/locales/ast_ES
index 2817c1acc..967f5471d 100644
--- a/libc/localedata/locales/ast_ES
+++ b/libc/localedata/locales/ast_ES
@@ -130,5 +130,18 @@ copy "es_ES"
END LC_NAME
LC_ADDRESS
-copy "es_ES"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0045><U0053>"
+country_ab3 "<U0045><U0053><U0050>"
+country_num 724
+% E
+country_car "<U0045>"
+% ast
+lang_term "<U0061><U0073><U0074>"
+% ast
+lang_lib "<U0061><U0073><U0074>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ayc_PE b/libc/localedata/locales/ayc_PE
index 2cdc92e15..a65dff057 100644
--- a/libc/localedata/locales/ayc_PE
+++ b/libc/localedata/locales/ayc_PE
@@ -192,7 +192,22 @@ END LC_NAME
% TO DO - adjust for Aymara specific lang-info for Peru
LC_ADDRESS
-copy "es_PE"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0050><U0045>"
+country_ab3 "<U0050><U0045><U0052>"
+country_num 604
+% PE
+country_car "<U0050><U0045>"
+% ay
+lang_ab "<U0061><U0079>"
+% ayc
+lang_term "<U0061><U0079><U0063>"
+% ayc
+lang_lib "<U0061><U0079><U0063>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/az_AZ b/libc/localedata/locales/az_AZ
index 0df07b931..0dd3de14e 100644
--- a/libc/localedata/locales/az_AZ
+++ b/libc/localedata/locales/az_AZ
@@ -294,7 +294,12 @@ country_ab3 "<U0041><U005A><U0045>"
country_num 031
% AZ
country_car "<U0041><U005A>"
-
+% az
+lang_ab "<U0061><U007A>"
+% aze
+lang_term "<U0061><U007A><U0065>"
+% aze
+lang_lib "<U0061><U007A><U0065>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/be_BY b/libc/localedata/locales/be_BY
index f5672ab29..e64867980 100644
--- a/libc/localedata/locales/be_BY
+++ b/libc/localedata/locales/be_BY
@@ -182,5 +182,10 @@ country_ab3 "<U0042><U004C><U0052>"
country_num 112
% BY
country_car "<U0042><U0059>"
-
+% be
+lang_ab "<U0062><U0065>"
+% bel
+lang_term "<U0062><U0065><U006C>"
+% bel
+lang_lib "<U0062><U0065><U006C>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/bem_ZM b/libc/localedata/locales/bem_ZM
index edb5cf3bb..ddf36a684 100644
--- a/libc/localedata/locales/bem_ZM
+++ b/libc/localedata/locales/bem_ZM
@@ -179,8 +179,13 @@ country_ab2 "<U005A><U004D>"
% ZMB
country_ab3 "<U005A><U004D><U0042>"
country_num 894
+% Z
+country_car "<U005A>"
lang_name "<U0069><U0063><U0069><U0042><U0065><U006D><U0062><U0061>"
-lang_term "<U0062><U0065><U006D>"
+% bem
+lang_term "<U0062><U0065><U006D>"
+% bem
+lang_lib "<U0062><U0065><U006D>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/ber_DZ b/libc/localedata/locales/ber_DZ
index be334c5bf..5c1f7d8f8 100644
--- a/libc/localedata/locales/ber_DZ
+++ b/libc/localedata/locales/ber_DZ
@@ -289,7 +289,8 @@ country_ab2 "<U0044><U005A>"
country_ab3 "<U0044><U005A><U0041>"
country_num 12
%country_isbn ""
-%country_car ""
+% DZ
+country_car "<U0044><U005A>"
lang_name "<U0074><U0061><U006D><U0061><U007A><U0069><U0067><U0068><U0074>"
%lang_ab
lang_term "<U0062><U0065><U0072>"
diff --git a/libc/localedata/locales/ber_MA b/libc/localedata/locales/ber_MA
index 1333b8c66..5f285a173 100644
--- a/libc/localedata/locales/ber_MA
+++ b/libc/localedata/locales/ber_MA
@@ -209,7 +209,8 @@ country_ab2 "<U004D><U0041>"
country_ab3 "<U004D><U0041><U0052>"
country_num 504
%country_isbn ""
-%country_car ""
+% MA
+country_car "<U004D><U0041>"
lang_name "<U2D5C><U2D30><U2D4E><U2D30><U2D49><U2D56><U2D5C>"
% lang_ab
lang_term "<U0062><U0065><U0072>"
diff --git a/libc/localedata/locales/bg_BG b/libc/localedata/locales/bg_BG
index 14e8fb97a..9316d1062 100644
--- a/libc/localedata/locales/bg_BG
+++ b/libc/localedata/locales/bg_BG
@@ -269,6 +269,7 @@ country_isbn 954
lang_name "<U0042><U0075><U006C><U0067><U0061><U0072><U0069><U0061><U006E>"
lang_ab "<U0062><U0067>"
lang_term "<U0062><U0075><U006C>"
+lang_lib "<U0062><U0075><U006C>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/bho_IN b/libc/localedata/locales/bho_IN
index b5c926e1a..54028b962 100644
--- a/libc/localedata/locales/bho_IN
+++ b/libc/localedata/locales/bho_IN
@@ -150,7 +150,17 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+% bho
+lang_term "<U0062><U0068><U006F>"
+% bho
+lang_lib "<U0062><U0068><U006F>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/bn_BD b/libc/localedata/locales/bn_BD
index b22657866..58842d6bd 100644
--- a/libc/localedata/locales/bn_BD
+++ b/libc/localedata/locales/bn_BD
@@ -180,7 +180,12 @@ postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E><U0025>
country_name "<U09AC><U09BE><U0982><U09B2><U09BE><U09A6><U09C7><U09B6>"
country_ab2 "<U0042><U0044>"
country_ab3 "<U0042><U0047><U0044>"
-lang_ab "<U0062><U006E>"
+% bn
+lang_ab "<U0062><U006E>"
+% ben
+lang_term "<U0062><U0065><U006E>"
+% ben
+lang_lib "<U0062><U0065><U006E>"
%lang_ab3_term "ben"
lang_name "<U09ac><U09be><U0982><U09b2><U09be>"
% todo
diff --git a/libc/localedata/locales/bn_IN b/libc/localedata/locales/bn_IN
index fbff935d3..ddf3cf251 100644
--- a/libc/localedata/locales/bn_IN
+++ b/libc/localedata/locales/bn_IN
@@ -183,7 +183,12 @@ country_ab3 "<U0049><U004E><U0044>"
country_num 356
% IND
country_car "<U0049><U004E><U0044>"
-
+% bn
+lang_ab "<U0062><U006E>"
+% ben
+lang_term "<U0062><U0065><U006E>"
+% ben
+lang_lib "<U0062><U0065><U006E>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/bo_CN b/libc/localedata/locales/bo_CN
index aa8ff0771..fab02ae0a 100644
--- a/libc/localedata/locales/bo_CN
+++ b/libc/localedata/locales/bo_CN
@@ -164,9 +164,11 @@ country_ab3 "<U0043><U0048><U004E>"
country_num 156
%country_car "FIXME"
country_isbn "<U0037>"
-
lang_name "<U0F54><U0F7C><U0F51><U0F0B><U0F66><U0F90><U0F51><U0F0B>"
+% bo
lang_ab "<U0062><U006F>"
+% bod
lang_term "<U0062><U006F><U0064>"
+% tib
lang_lib "<U0074><U0069><U0062>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/bo_IN b/libc/localedata/locales/bo_IN
index 9e9c4ff4f..73a9084dd 100644
--- a/libc/localedata/locales/bo_IN
+++ b/libc/localedata/locales/bo_IN
@@ -87,8 +87,13 @@ country_name "<U0F62><U0F92><U0FB1><U0F0B><U0F42><U0F62>"
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
lang_name "<U0F54><U0F7C><U0F51><U0F0B><U0F66><U0F90><U0F51><U0F0B>"
+% bo
lang_ab "<U0062><U006F>"
+% bod
lang_term "<U0062><U006F><U0064>"
+% tib
lang_lib "<U0074><U0069><U0062>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/br_FR b/libc/localedata/locales/br_FR
index eaba116e0..564212de6 100644
--- a/libc/localedata/locales/br_FR
+++ b/libc/localedata/locales/br_FR
@@ -170,6 +170,12 @@ country_ab3 "<U0046><U0052><U0041>"
country_num 250
% F
country_car "<U0046>"
+% br
+lang_ab "<U0062><U0072>"
+% bre
+lang_term "<U0062><U0072><U0065>"
+% bre
+lang_lib "<U0062><U0072><U0065>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/brx_IN b/libc/localedata/locales/brx_IN
index 0277a8e0a..ed79fe4f4 100644
--- a/libc/localedata/locales/brx_IN
+++ b/libc/localedata/locales/brx_IN
@@ -171,7 +171,18 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+% brx
+lang_term "<U0062><U0072><U0078>"
+% brx
+lang_lib "<U0062><U0072><U0078>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/bs_BA b/libc/localedata/locales/bs_BA
index cf59ccb2f..c4d37d7dc 100644
--- a/libc/localedata/locales/bs_BA
+++ b/libc/localedata/locales/bs_BA
@@ -236,7 +236,12 @@ country_ab3 "<U0042><U0049><U0048>"
country_num 070
% BIH
country_car "<U0042><U0049><U0048>"
-
+% bs
+lang_ab "<U0062><U0073>"
+% bos
+lang_term "<U0062><U006F><U0073>"
+% bos
+lang_lib "<U0062><U006F><U0073>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/byn_ER b/libc/localedata/locales/byn_ER
index 0440fbdc8..ff4061f92 100644
--- a/libc/localedata/locales/byn_ER
+++ b/libc/localedata/locales/byn_ER
@@ -120,7 +120,8 @@ country_post "<U0045><U0052><U0049>"
country_ab2 "<U0045><U0052>"
country_ab3 "<U0045><U0052><U0049>"
country_num 232
-% country_car unknown
+% ER
+country_car "<U0045><U0052>"
% country_isbn unknown, Need ISO 2108
lang_name "<U1265><U120A><U1295>"
lang_ab ""
diff --git a/libc/localedata/locales/ca_AD b/libc/localedata/locales/ca_AD
index a1eebbb02..4edb85a8b 100644
--- a/libc/localedata/locales/ca_AD
+++ b/libc/localedata/locales/ca_AD
@@ -91,4 +91,12 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0041><U0044>"
country_ab3 "<U0041><U004E><U0044>"
country_num 20
+% AND
+country_car "<U0041><U004E><U0044>"
+% ca
+lang_ab "<U0063><U0061>"
+% cat
+lang_term "<U0063><U0061><U0074>"
+% cat
+lang_lib "<U0063><U0061><U0074>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ca_ES b/libc/localedata/locales/ca_ES
index 0086b4222..68ffd4776 100644
--- a/libc/localedata/locales/ca_ES
+++ b/libc/localedata/locales/ca_ES
@@ -176,5 +176,10 @@ country_ab3 "<U0045><U0053><U0050>"
country_num 724
% E
country_car "<U0045>"
-
+% ca
+lang_ab "<U0063><U0061>"
+% cat
+lang_term "<U0063><U0061><U0074>"
+% cat
+lang_lib "<U0063><U0061><U0074>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ca_FR b/libc/localedata/locales/ca_FR
index bbaee96fa..aac4eacbb 100644
--- a/libc/localedata/locales/ca_FR
+++ b/libc/localedata/locales/ca_FR
@@ -81,5 +81,20 @@ copy "ca_ES"
END LC_NAME
LC_ADDRESS
-copy "fr_FR"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0046><U0052>"
+country_ab3 "<U0046><U0052><U0041>"
+country_num 250
+% F
+country_car "<U0046>"
+% ca
+lang_ab "<U0063><U0061>"
+% cat
+lang_term "<U0063><U0061><U0074>"
+% cat
+lang_lib "<U0063><U0061><U0074>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ca_IT b/libc/localedata/locales/ca_IT
index d257f8229..3865b8809 100644
--- a/libc/localedata/locales/ca_IT
+++ b/libc/localedata/locales/ca_IT
@@ -81,5 +81,20 @@ copy "ca_ES"
END LC_NAME
LC_ADDRESS
-copy "it_IT"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0049><U0054>"
+country_ab3 "<U0049><U0054><U0041>"
+country_num 380
+% I
+country_car "<U0049>"
+% ca
+lang_ab "<U0063><U0061>"
+% cat
+lang_term "<U0063><U0061><U0074>"
+% cat
+lang_lib "<U0063><U0061><U0074>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/cmn_TW b/libc/localedata/locales/cmn_TW
new file mode 100644
index 000000000..1ac117cba
--- /dev/null
+++ b/libc/localedata/locales/cmn_TW
@@ -0,0 +1,220 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Mandarin Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@member.fsf.org>
+%
+% build with: localedef -f UTF-8 -i cmn_TW cmn_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Mandarin Chinese locale for the Republic of China"
+source ""
+address ""
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Mandarin Chinese"
+territory "Republic of China"
+revision "0.1"
+date "2013-06-02"
+%
+category "cmn_TW:2000";LC_IDENTIFICATION
+category "cmn_TW:2000";LC_CTYPE
+category "cmn_TW:2000";LC_COLLATE
+category "cmn_TW:2000";LC_TIME
+category "cmn_TW:2000";LC_NUMERIC
+category "cmn_TW:2000";LC_MONETARY
+category "cmn_TW:2000";LC_PAPER
+category "cmn_TW:2000";LC_MEASUREMENT
+category "cmn_TW:2000";LC_MESSAGES
+category "cmn_TW:2000";LC_NAME
+category "cmn_TW:2000";LC_ADDRESS
+category "cmn_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class "hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, ä¹æœˆ, å月, å一月, å二月
+mon "<U4E00><U6708>";/
+ "<U4E8C><U6708>";/
+ "<U4E09><U6708>";/
+ "<U56DB><U6708>";/
+ "<U4E94><U6708>";/
+ "<U516D><U6708>";/
+ "<U4E03><U6708>";/
+ "<U516B><U6708>";/
+ "<U4E5D><U6708>";/
+ "<U5341><U6708>";/
+ "<U5341><U4E00><U6708>";/
+ "<U5341><U4E8C><U6708>"
+% 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月
+abmon "<U0020><U0031><U6708>";/
+ "<U0020><U0032><U6708>";/
+ "<U0020><U0033><U6708>";/
+ "<U0020><U0034><U6708>";/
+ "<U0020><U0035><U6708>";/
+ "<U0020><U0036><U6708>";/
+ "<U0020><U0037><U6708>";/
+ "<U0020><U0038><U6708>";/
+ "<U0020><U0039><U6708>";/
+ "<U0031><U0030><U6708>";/
+ "<U0031><U0031><U6708>";/
+ "<U0031><U0032><U6708>"
+% 星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六
+day "<U661F><U671F><U65E5>";/
+ "<U661F><U671F><U4E00>";/
+ "<U661F><U671F><U4E8C>";/
+ "<U661F><U671F><U4E09>";/
+ "<U661F><U671F><U56DB>";/
+ "<U661F><U671F><U4E94>";/
+ "<U661F><U671F><U516D>"
+% 日, 一, 二, 三, 四, 五, 六
+abday "<U65E5>";/
+ "<U4E00>";/
+ "<U4E8C>";/
+ "<U4E09>";/
+ "<U56DB>";/
+ "<U4E94>";/
+ "<U516D>"
+% %Y年%m月%d日 (%A) %H點%M分%S秒
+d_t_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Y年%m月%d日
+d_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
+% %H點%M分%S秒
+t_fmt "<U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% 上åˆ, 下åˆ
+am_pm "<U4E0A><U5348>";/
+ "<U4E0B><U5348>"
+% %p %I點%M分%S秒
+t_fmt_ampm "<U0025><U0070><U0020><U0025><U0049><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Yå¹´ %b %eæ—¥ %A %H:%M:%S %Z
+date_fmt "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A>"
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping 4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point "<U002E>"
+% ,
+mon_thousands_sep "<U002C>"
+mon_grouping 4
+positive_sign ""
+% -
+negative_sign "<U002D>"
+frac_digits 2
+int_frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 0
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+int_p_cs_precedes 1
+int_p_sep_by_space 0
+int_n_cs_precedes 1
+int_n_sep_by_space 0
+int_p_sign_posn 1
+int_n_sign_posn 1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yY是]
+yesexpr "<U005E><U005B><U0079><U0059><U662F><U005D>"
+% ^[nNä¸å¦]
+noexpr "<U005E><U005B><U006E><U004E><U4E0D><U5426><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%t%g%t%d
+name_fmt "<U0025><U0066><U0025><U0074><U0025><U0067><U0025><U0074><U0025><U0064>"
+% å›
+name_gen "<U541B>"
+% å°å§
+name_miss "<U5C0F><U59D0>"
+% 先生
+name_mr "<U5148><U751F>"
+% 夫人
+name_mrs "<U592B><U4EBA>"
+% 女士
+name_ms "<U5973><U58EB>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% 中è¯æ°‘國
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2 "<U0054><U0057>"
+% TWN
+country_ab3 "<U0054><U0057><U004E>"
+country_num 158
+country_isbn 957
+% 漢語官話
+lang_name "<U6F22><U8A9E><U5B98><U8A71>"
+% cmn
+lang_term "<U0063><U006D><U006E>"
+% cmn
+lang_lib "<U0063><U006D><U006E>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select "<U0030><U0030>"
+% 886
+int_prefix "<U0038><U0038><U0036>"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/crh_UA b/libc/localedata/locales/crh_UA
index d543b9b14..7bf156d56 100644
--- a/libc/localedata/locales/crh_UA
+++ b/libc/localedata/locales/crh_UA
@@ -225,6 +225,12 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0055><U0041>"
country_ab3 "<U0055><U004B><U0052>"
country_num 804
+% UA
+country_car "<U0055><U0041>"
+% crh
+lang_term "<U0063><U0072><U0068>"
+% crh
+lang_lib "<U0063><U0072><U0068>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/csb_PL b/libc/localedata/locales/csb_PL
index 70daf3a88..1ee9494d8 100644
--- a/libc/localedata/locales/csb_PL
+++ b/libc/localedata/locales/csb_PL
@@ -216,4 +216,8 @@ country_ab3 "<U0050><U004F><U004C>"
country_num 616
% PL
country_car "<U0050><U004C>"
+% csb
+lang_term "<U0063><U0073><U0062>"
+% csb
+lang_lib "<U0063><U0073><U0062>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/cv_RU b/libc/localedata/locales/cv_RU
index 0eae6d4d4..0d04cfb39 100644
--- a/libc/localedata/locales/cv_RU
+++ b/libc/localedata/locales/cv_RU
@@ -234,5 +234,20 @@ copy "ru_RU"
END LC_NAME
LC_ADDRESS
-copy "ru_RU"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0052><U0055>"
+country_ab3 "<U0052><U0055><U0053>"
+country_num 643
+% RUS
+country_car "<U0052><U0055><U0053>"
+% cv
+lang_ab "<U0063><U0076>"
+% chv
+lang_term "<U0063><U0068><U0076>"
+% chv
+lang_lib "<U0063><U0068><U0076>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/da_DK b/libc/localedata/locales/da_DK
index 211abcd85..2694a91e1 100644
--- a/libc/localedata/locales/da_DK
+++ b/libc/localedata/locales/da_DK
@@ -254,5 +254,10 @@ country_ab3 "<U0044><U004E><U004B>"
country_num 208
% DK
country_car "<U0044><U004B>"
-
+% da
+lang_ab "<U0064><U0061>"
+% dan
+lang_term "<U0064><U0061><U006E>"
+% dan
+lang_lib "<U0064><U0061><U006E>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/de_AT b/libc/localedata/locales/de_AT
index c450dafc7..185da1aa8 100644
--- a/libc/localedata/locales/de_AT
+++ b/libc/localedata/locales/de_AT
@@ -157,5 +157,10 @@ country_ab3 "<U0041><U0055><U0054>"
country_num 040
% A
country_car "<U0041>"
-
+% de
+lang_ab "<U0064><U0065>"
+% deu
+lang_term "<U0064><U0065><U0075>"
+% ger
+lang_lib "<U0067><U0065><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/de_BE b/libc/localedata/locales/de_BE
index 5368fd42f..d7001e025 100644
--- a/libc/localedata/locales/de_BE
+++ b/libc/localedata/locales/de_BE
@@ -151,5 +151,10 @@ country_ab3 "<U0042><U0045><U004C>"
country_num 056
% B
country_car "<U0042>"
-
+% de
+lang_ab "<U0064><U0065>"
+% deu
+lang_term "<U0064><U0065><U0075>"
+% ger
+lang_lib "<U0067><U0065><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/de_CH b/libc/localedata/locales/de_CH
index b26d79e28..0e437674b 100644
--- a/libc/localedata/locales/de_CH
+++ b/libc/localedata/locales/de_CH
@@ -160,5 +160,10 @@ country_ab3 "<U0043><U0048><U0045>"
country_num 756
% CH
country_car "<U0043><U0048>"
-
+% de
+lang_ab "<U0064><U0065>"
+% deu
+lang_term "<U0064><U0065><U0075>"
+% ger
+lang_lib "<U0067><U0065><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/de_DE b/libc/localedata/locales/de_DE
index 32cbd76dd..bfa7fc07b 100644
--- a/libc/localedata/locales/de_DE
+++ b/libc/localedata/locales/de_DE
@@ -195,8 +195,11 @@ country_num 276
country_car "<U0044>"
country_isbn 3
lang_name "<U0044><U0065><U0075><U0074><U0073><U0063><U0068>"
+% de
lang_ab "<U0064><U0065>"
+% deu
lang_term "<U0064><U0065><U0075>"
+% ger
lang_lib "<U0067><U0065><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/de_LU b/libc/localedata/locales/de_LU
index e11f6adfc..5f80739ee 100644
--- a/libc/localedata/locales/de_LU
+++ b/libc/localedata/locales/de_LU
@@ -157,5 +157,10 @@ country_ab3 "<U004C><U0055><U0058>"
country_num 442
% L
country_car "<U004C>"
-
+% de
+lang_ab "<U0064><U0065>"
+% deu
+lang_term "<U0064><U0065><U0075>"
+% ger
+lang_lib "<U0067><U0065><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/doi_IN b/libc/localedata/locales/doi_IN
index 50ef73501..47e90792b 100644
--- a/libc/localedata/locales/doi_IN
+++ b/libc/localedata/locales/doi_IN
@@ -163,7 +163,17 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+% doi
+lang_term "<U0064><U006F><U0069>"
+% doi
+lang_lib "<U0064><U006F><U0069>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/dv_MV b/libc/localedata/locales/dv_MV
index 91ca8b12a..4876d1490 100644
--- a/libc/localedata/locales/dv_MV
+++ b/libc/localedata/locales/dv_MV
@@ -177,4 +177,10 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
<U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
<U004E><U0025><U0063><U0025><U004E>"
+% dv
+lang_ab "<U0064><U0076>"
+% div
+lang_term "<U0064><U0069><U0076>"
+% div
+lang_lib "<U0064><U0069><U0076>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/dz_BT b/libc/localedata/locales/dz_BT
index 012bd49c5..84743465a 100644
--- a/libc/localedata/locales/dz_BT
+++ b/libc/localedata/locales/dz_BT
@@ -659,11 +659,13 @@ country_ab2 "<U0042><U0054>"
country_ab3 "<U0042><U0048><U0055>"
%country_num "<U0042><U0048><U0055>"
%FIXME
-%country_car "<U0042>"
-%FIXME
%country_isbn ""
-lang_name "<U0E44><U0E17><U0E22>"
-lang_ab "<U0074><U0068>"
-lang_term "<U0074><U0068><U0061>"
-lang_lib "<U0074><U0068><U0061>"
+% རྫོང་à½
+lang_name "<U0028><U0F62><U0FAB><U0F7C><U0F44><U0F0B><U0F41>"
+% dz
+lang_ab "<U0064><U007A>"
+% dzo
+lang_term "<U0064><U007A><U006F>"
+% dzo
+lang_lib "<U0064><U007A><U006F>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/el_CY b/libc/localedata/locales/el_CY
index 31175777e..58cbb1447 100644
--- a/libc/localedata/locales/el_CY
+++ b/libc/localedata/locales/el_CY
@@ -101,4 +101,12 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0043><U0059>"
country_ab3 "<U0043><U0059><U0050>"
country_num 196
+% CY
+country_car "<U0043><U0059>"
+% el
+lang_ab "<U0065><U006C>"
+% ell
+lang_term "<U0065><U006C><U006C>"
+% gre
+lang_lib "<U0067><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/el_GR b/libc/localedata/locales/el_GR
index edc8a6403..ad18cef7e 100644
--- a/libc/localedata/locales/el_GR
+++ b/libc/localedata/locales/el_GR
@@ -178,5 +178,10 @@ country_ab3 "<U0047><U0052><U0043>"
country_num 300
% GR
country_car "<U0047><U0052>"
-
+% el
+lang_ab "<U0065><U006C>"
+% ell
+lang_term "<U0065><U006C><U006C>"
+% gre
+lang_lib "<U0067><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_AG b/libc/localedata/locales/en_AG
index b724eace8..043d2a230 100644
--- a/libc/localedata/locales/en_AG
+++ b/libc/localedata/locales/en_AG
@@ -85,6 +85,12 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0041><U0047>"
country_ab3 "<U0041><U0054><U0047>"
country_num 28
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/en_AU b/libc/localedata/locales/en_AU
index 96e6fec19..eeeeef2e7 100644
--- a/libc/localedata/locales/en_AU
+++ b/libc/localedata/locales/en_AU
@@ -159,5 +159,10 @@ country_ab3 "<U0041><U0055><U0053>"
country_num 036
% AUS
country_car "<U0041><U0055><U0053>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_BW b/libc/localedata/locales/en_BW
index 02b1334ab..f3b0f02b2 100644
--- a/libc/localedata/locales/en_BW
+++ b/libc/localedata/locales/en_BW
@@ -116,5 +116,10 @@ country_ab3 "<U0042><U0057><U0041>"
country_num 072
% RB
country_car "<U0052><U0042>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_CA b/libc/localedata/locales/en_CA
index a4c0edaaa..74717c668 100644
--- a/libc/localedata/locales/en_CA
+++ b/libc/localedata/locales/en_CA
@@ -182,7 +182,10 @@ country_num 124
% CDN
country_car "<U0043><U0044><U004E>"
lang_name "<U0045><U006E><U0067><U006C><U0069><U0073><U0068>"
-lang_ab "<U0065><U006E>"
-lang_term "<U0065><U006E><U0067>"
-lang_lib "<U0065><U006E><U0067>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_DK b/libc/localedata/locales/en_DK
index 891331d23..160097445 100644
--- a/libc/localedata/locales/en_DK
+++ b/libc/localedata/locales/en_DK
@@ -160,4 +160,10 @@ country_ab3 "<U0044><U004E><U004B>"
country_num 208
% DK
country_car "<U0044><U004B>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_GB b/libc/localedata/locales/en_GB
index e48aa033a..88f440a22 100644
--- a/libc/localedata/locales/en_GB
+++ b/libc/localedata/locales/en_GB
@@ -163,5 +163,10 @@ country_ab3 "<U0047><U0042><U0052>"
country_num 826
% GB
country_car "<U0047><U0042>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_HK b/libc/localedata/locales/en_HK
index 4065c9c24..653543a33 100644
--- a/libc/localedata/locales/en_HK
+++ b/libc/localedata/locales/en_HK
@@ -198,7 +198,12 @@ country_ab3 "<U0048><U004B><U0047>"
country_num 344
% HK
country_car "<U0048><U004B>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_IE b/libc/localedata/locales/en_IE
index a76790733..568a7e9c4 100644
--- a/libc/localedata/locales/en_IE
+++ b/libc/localedata/locales/en_IE
@@ -157,5 +157,10 @@ country_ab3 "<U0049><U0052><U004C>"
country_num 372
% IRL
country_car "<U0049><U0052><U004C>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_IN b/libc/localedata/locales/en_IN
index 45ddaf4c1..9205a7b30 100644
--- a/libc/localedata/locales/en_IN
+++ b/libc/localedata/locales/en_IN
@@ -193,7 +193,12 @@ country_ab3 "<U0049><U004E><U0044>"
country_num 356
% IND
country_car "<U0049><U004E><U0044>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_NG b/libc/localedata/locales/en_NG
index a418eb957..f98251e57 100644
--- a/libc/localedata/locales/en_NG
+++ b/libc/localedata/locales/en_NG
@@ -274,10 +274,12 @@ country_isbn 978
% ISO 639 language abbreviations:
% 639-1 2 letter, 639-2 3 letter terminology
% http://www.loc.gov/standards/iso639-2/englagn.html
-% "en", "eng"
-lang_ab "<U0065><U006E>"
-lang_term "<U0065><U006E><U0067>"
-lang_lib "<U0065><U006E><U0067>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
% ISO 3166 country number and 2 and 3 letter abreviations
% http://www.unicode.org/onlinedat/countries.html
diff --git a/libc/localedata/locales/en_NZ b/libc/localedata/locales/en_NZ
index d85042377..e786f21e0 100644
--- a/libc/localedata/locales/en_NZ
+++ b/libc/localedata/locales/en_NZ
@@ -158,5 +158,10 @@ country_ab3 "<U004E><U005A><U004C>"
country_num 554
% NZ
country_car "<U004E><U005A>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_PH b/libc/localedata/locales/en_PH
index 04fb3a036..d8d87bae3 100644
--- a/libc/localedata/locales/en_PH
+++ b/libc/localedata/locales/en_PH
@@ -194,7 +194,12 @@ country_ab3 "<U0049><U0044><U004E>"
country_num 360
% RP
country_car "<U0052><U0050>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_SG b/libc/localedata/locales/en_SG
index 15a668a83..467dfa044 100644
--- a/libc/localedata/locales/en_SG
+++ b/libc/localedata/locales/en_SG
@@ -197,7 +197,12 @@ country_ab3 "<U0053><U0047><U0050>"
country_num 702
% SGP
country_car "<U0053><U0047><U0050>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/en_US b/libc/localedata/locales/en_US
index 3560c5700..4c5fa34de 100644
--- a/libc/localedata/locales/en_US
+++ b/libc/localedata/locales/en_US
@@ -162,12 +162,16 @@ country_post "<U0055><U0053><U0041>"
country_ab2 "<U0055><U0053>"
country_ab3 "<U0055><U0053><U0041>"
country_num 840
+% USA
country_car "<U0055><U0053><U0041>"
country_isbn 0
lang_name "<U0045><U006E><U0067><U006C><U0069><U0073><U0068>"
-lang_ab "<U0065><U006E>"
-lang_term "<U0065><U006E><U0067>"
-lang_lib "<U0065><U006E><U0067>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/en_ZA b/libc/localedata/locales/en_ZA
index 86201714b..2a6b2ba67 100644
--- a/libc/localedata/locales/en_ZA
+++ b/libc/localedata/locales/en_ZA
@@ -231,7 +231,7 @@ LC_TELEPHONE
tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
<U006C>"
-% Represntation of telephone number for domestic use -
+% Representation of telephone number for domestic use -
% "(%A) %l", which is
% %A - area code with national prefix
% %l - local number".
@@ -342,10 +342,12 @@ country_isbn 0
% ISO 639 language abbreviations:
% 639-1 2 letter, 639-2 3 letter terminology
% http://www.loc.gov/standards/iso639-2/englagn.html
-% "en", "eng"
-lang_ab "<U0065><U006E>"
-lang_term "<U0065><U006E><U0067>"
-lang_lib "<U0065><U006E><U0067>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
% ISO 3166 country number and 2 and 3 letter abreviations
% http://www.unicode.org/onlinedat/countries.html
diff --git a/libc/localedata/locales/en_ZM b/libc/localedata/locales/en_ZM
index ac8e68034..827703252 100644
--- a/libc/localedata/locales/en_ZM
+++ b/libc/localedata/locales/en_ZM
@@ -85,6 +85,14 @@ country_ab2 "<U005A><U004D>"
% ZMB
country_ab3 "<U005A><U004D><U0042>"
country_num 894
+% Z
+country_car "<U005A>"
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/en_ZW b/libc/localedata/locales/en_ZW
index 838a55da9..24558ed88 100644
--- a/libc/localedata/locales/en_ZW
+++ b/libc/localedata/locales/en_ZW
@@ -115,5 +115,10 @@ country_ab3 "<U005A><U0057><U0045>"
country_num 716
% ZW
country_car "<U005A><U0057>"
-
+% en
+lang_ab "<U0065><U006E>"
+% eng
+lang_term "<U0065><U006E><U0067>"
+% eng
+lang_lib "<U0065><U006E><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_AR b/libc/localedata/locales/es_AR
index e995c61f5..3eaabd3f9 100644
--- a/libc/localedata/locales/es_AR
+++ b/libc/localedata/locales/es_AR
@@ -158,5 +158,10 @@ country_ab3 "<U0041><U0052><U0047>"
country_num 032
% RA
country_car "<U0052><U0041>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_BO b/libc/localedata/locales/es_BO
index 1cc15af2b..b3544d9e0 100644
--- a/libc/localedata/locales/es_BO
+++ b/libc/localedata/locales/es_BO
@@ -156,5 +156,10 @@ country_ab3 "<U0042><U004F><U004C>"
country_num 068
% BOL
country_car "<U0042><U004F><U004C>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_CL b/libc/localedata/locales/es_CL
index a2ca00653..a40b361b2 100644
--- a/libc/localedata/locales/es_CL
+++ b/libc/localedata/locales/es_CL
@@ -154,5 +154,10 @@ country_ab3 "<U0043><U0048><U004C>"
country_num 152
% RCH
country_car "<U0052><U0043><U0048>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_CO b/libc/localedata/locales/es_CO
index 37599a7a1..31a28e708 100644
--- a/libc/localedata/locales/es_CO
+++ b/libc/localedata/locales/es_CO
@@ -157,5 +157,10 @@ country_ab3 "<U0043><U004F><U004C>"
country_num 170
% CO
country_car "<U0043><U004F>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_CR b/libc/localedata/locales/es_CR
index d7be7f8fa..e42dce27c 100644
--- a/libc/localedata/locales/es_CR
+++ b/libc/localedata/locales/es_CR
@@ -155,10 +155,14 @@ country_name "<U0043><U006F><U0073><U0074><U0061><U0020><U0052><U0069><U0063><U
country_post "<U0043><U0052>"
country_car "<U0043><U0052>"
country_isbn "9930,9977,9968"
-lang_name "<U0045><U0073><U0070><U0061><U00F1><U006F><U006C>"
-lang_ab "<U0065><U0073>"
-lang_term "<U0073><U0070><U0061>"
country_ab2 "<U0043><U0052>"
country_ab3 "<U0043><U0052><U0049>"
country_num 188
+lang_name "<U0045><U0073><U0070><U0061><U00F1><U006F><U006C>"
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_CU b/libc/localedata/locales/es_CU
index 67fb5f9a0..86de054e7 100644
--- a/libc/localedata/locales/es_CU
+++ b/libc/localedata/locales/es_CU
@@ -119,4 +119,12 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0043><U0055>"
country_ab3 "<U0043><U0055><U0042>"
country_num 192
+% C
+country_car "<U0043>"
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_DO b/libc/localedata/locales/es_DO
index 95afeb9ea..15da7d3d3 100644
--- a/libc/localedata/locales/es_DO
+++ b/libc/localedata/locales/es_DO
@@ -158,5 +158,10 @@ country_ab3 "<U0044><U004F><U004D>"
country_num 214
% DOM
country_car "<U0044><U004F><U004D>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_EC b/libc/localedata/locales/es_EC
index c9cb51e0f..829230839 100644
--- a/libc/localedata/locales/es_EC
+++ b/libc/localedata/locales/es_EC
@@ -156,5 +156,10 @@ country_ab3 "<U0045><U0043><U0055>"
country_num 218
% EC
country_car "<U0045><U0043>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_ES b/libc/localedata/locales/es_ES
index b8d4d8825..a75c01f8f 100644
--- a/libc/localedata/locales/es_ES
+++ b/libc/localedata/locales/es_ES
@@ -170,5 +170,10 @@ country_ab3 "<U0045><U0053><U0050>"
country_num 724
% E
country_car "<U0045>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_GT b/libc/localedata/locales/es_GT
index 6c3ae10ca..e17e70e7b 100644
--- a/libc/localedata/locales/es_GT
+++ b/libc/localedata/locales/es_GT
@@ -155,5 +155,10 @@ country_ab3 "<U0047><U0054><U004D>"
country_num 320
% GCA
country_car "<U0047><U0043><U0041>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_HN b/libc/localedata/locales/es_HN
index febab6bbe..6e0def2e3 100644
--- a/libc/localedata/locales/es_HN
+++ b/libc/localedata/locales/es_HN
@@ -156,4 +156,10 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0048><U004E>"
country_ab3 "<U0048><U004E><U0044>"
country_num 340
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_MX b/libc/localedata/locales/es_MX
index 0fa1dc3d2..faf9626fb 100644
--- a/libc/localedata/locales/es_MX
+++ b/libc/localedata/locales/es_MX
@@ -155,5 +155,10 @@ country_ab3 "<U004D><U0045><U0058>"
country_num 484
% MEX
country_car "<U004D><U0045><U0058>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_NI b/libc/localedata/locales/es_NI
index 52845f8fc..7e109b32b 100644
--- a/libc/localedata/locales/es_NI
+++ b/libc/localedata/locales/es_NI
@@ -149,5 +149,10 @@ country_ab3 "<U004E><U0049><U0043>"
country_num 558
% NIC
country_car "<U004E><U0049><U0043>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_PA b/libc/localedata/locales/es_PA
index c8c5d2375..702af0bc9 100644
--- a/libc/localedata/locales/es_PA
+++ b/libc/localedata/locales/es_PA
@@ -155,5 +155,10 @@ country_ab3 "<U0050><U0041><U004E>"
country_num 591
% PA
country_car "<U0050><U0041>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_PE b/libc/localedata/locales/es_PE
index 75c59d1a6..e3ab3d6ed 100644
--- a/libc/localedata/locales/es_PE
+++ b/libc/localedata/locales/es_PE
@@ -156,5 +156,10 @@ country_ab3 "<U0050><U0045><U0052>"
country_num 604
% PE
country_car "<U0050><U0045>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_PR b/libc/localedata/locales/es_PR
index 93d7d21c2..3f1368456 100644
--- a/libc/localedata/locales/es_PR
+++ b/libc/localedata/locales/es_PR
@@ -143,4 +143,10 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0050><U0052>"
country_ab3 "<U0050><U0052><U0049>"
country_num 630
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_PY b/libc/localedata/locales/es_PY
index 7bb5b35d0..11916c4a7 100644
--- a/libc/localedata/locales/es_PY
+++ b/libc/localedata/locales/es_PY
@@ -155,5 +155,10 @@ country_ab3 "<U0050><U0052><U0059>"
country_num 600
% PY
country_car "<U0050><U0059>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_SV b/libc/localedata/locales/es_SV
index 44c31a8ee..8b30284d2 100644
--- a/libc/localedata/locales/es_SV
+++ b/libc/localedata/locales/es_SV
@@ -156,5 +156,10 @@ country_ab3 "<U0053><U004C><U0056>"
country_num 222
% ES
country_car "<U0045><U0053>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_US b/libc/localedata/locales/es_US
index c90f88c04..5c1b74028 100644
--- a/libc/localedata/locales/es_US
+++ b/libc/localedata/locales/es_US
@@ -208,4 +208,10 @@ country_ab3 "<U0055><U0053><U0041>"
country_num 840
country_car "<U0055><U0053><U0041>"
country_isbn 0
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_UY b/libc/localedata/locales/es_UY
index 357b1dcc3..980ae94ff 100644
--- a/libc/localedata/locales/es_UY
+++ b/libc/localedata/locales/es_UY
@@ -155,5 +155,10 @@ country_ab3 "<U0055><U0052><U0059>"
country_num 858
% UY
country_car "<U0055><U0059>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/es_VE b/libc/localedata/locales/es_VE
index f1fe9f500..2784cb5ff 100644
--- a/libc/localedata/locales/es_VE
+++ b/libc/localedata/locales/es_VE
@@ -155,5 +155,10 @@ country_ab3 "<U0056><U0045><U004E>"
country_num 862
% YV
country_car "<U0059><U0056>"
-
+% es
+lang_ab "<U0065><U0073>"
+% spa
+lang_term "<U0073><U0070><U0061>"
+% spa
+lang_lib "<U0073><U0070><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/eu_ES b/libc/localedata/locales/eu_ES
index 4b8cbddc9..7c5621024 100644
--- a/libc/localedata/locales/eu_ES
+++ b/libc/localedata/locales/eu_ES
@@ -169,5 +169,10 @@ country_ab3 "<U0045><U0053><U0050>"
country_num 724
% E
country_car "<U0045>"
-
+% eu
+lang_ab "<U0065><U0075>"
+% eus
+lang_term "<U0065><U0075><U0073>"
+% eus
+lang_lib "<U0065><U0075><U0073>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ff_SN b/libc/localedata/locales/ff_SN
index 8012e3059..0c68401d7 100644
--- a/libc/localedata/locales/ff_SN
+++ b/libc/localedata/locales/ff_SN
@@ -177,10 +177,16 @@ country_ab2 "<U0053><U004E>"
% SEN
country_ab3 "<U0053><U0045><U004E>"
country_num 686
+% SN
+country_car "<U0053><U004E>"
% Pulaar
lang_name "<U0050><U0075><U006C><U0061><U0061><U0072>"
% ff
lang_ab "<U0066><U0066>"
+% ful
+lang_term "<U0066><U0075><U006C>"
+% ful
+lang_lib "<U0066><U0075><U006C>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/fil_PH b/libc/localedata/locales/fil_PH
index c1a6b1026..b2c70a53c 100644
--- a/libc/localedata/locales/fil_PH
+++ b/libc/localedata/locales/fil_PH
@@ -174,7 +174,19 @@ name_miss "<U0042><U0062><U002E>"
END LC_NAME
LC_ADDRESS
-copy "tl_PH"
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0068>/
+<U0020><U0025><U0073><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0054><U0020><U0025><U007A><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+
+country_ab2 "<U0050><U0048>"
+country_ab3 "<U0050><U0048><U004C>"
+country_num 608
+% RP
+country_car "<U0052><U0050>"
+% fil
+lang_term "<U0066><U0069><U006C>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/fo_FO b/libc/localedata/locales/fo_FO
index 2985119a1..0a84b2b4e 100644
--- a/libc/localedata/locales/fo_FO
+++ b/libc/localedata/locales/fo_FO
@@ -144,5 +144,8 @@ country_ab3 "<U0046><U0052><U004F>"
country_num 234
% FO
country_car "<U0046><U004F>"
-
+% fo
+lang_ab "<U0066><U006F>"
+% fao
+lang_term "<U0066><U0061><U006F>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fr_BE b/libc/localedata/locales/fr_BE
index 610b645ee..9ac30a283 100644
--- a/libc/localedata/locales/fr_BE
+++ b/libc/localedata/locales/fr_BE
@@ -161,5 +161,10 @@ country_ab3 "<U0042><U0045><U004C>"
country_num 056
% B
country_car "<U0042>"
-
+% fr
+lang_ab "<U0066><U0072>"
+% fra
+lang_term "<U0066><U0072><U0061>"
+% fre
+lang_lib "<U0066><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fr_CA b/libc/localedata/locales/fr_CA
index 56839b893..a86f603c8 100644
--- a/libc/localedata/locales/fr_CA
+++ b/libc/localedata/locales/fr_CA
@@ -149,7 +149,10 @@ country_num 124
% CDN
country_car "<U0043><U0044><U004E>"
lang_name "<U0046><U0072><U0061><U006E><U00E7><U0061><U0069><U0073>"
-lang_ab "<U0066><U0072>"
-lang_term "<U0066><U0072><U0061>"
+% fr
+lang_ab "<U0066><U0072>"
+% fra
+lang_term "<U0066><U0072><U0061>"
+% fre
lang_lib "<U0066><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fr_CH b/libc/localedata/locales/fr_CH
index 2a8bbddd3..da8dd76c8 100644
--- a/libc/localedata/locales/fr_CH
+++ b/libc/localedata/locales/fr_CH
@@ -141,5 +141,10 @@ country_ab3 "<U0043><U0048><U0045>"
country_num 756
% CH
country_car "<U0043><U0048>"
-
+% fr
+lang_ab "<U0066><U0072>"
+% fra
+lang_term "<U0066><U0072><U0061>"
+% fre
+lang_lib "<U0066><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fr_FR b/libc/localedata/locales/fr_FR
index 3576c6999..f5b5b04d0 100644
--- a/libc/localedata/locales/fr_FR
+++ b/libc/localedata/locales/fr_FR
@@ -179,5 +179,10 @@ country_ab3 "<U0046><U0052><U0041>"
country_num 250
% F
country_car "<U0046>"
-
+% fr
+lang_ab "<U0066><U0072>"
+% fra
+lang_term "<U0066><U0072><U0061>"
+% fre
+lang_lib "<U0066><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fr_LU b/libc/localedata/locales/fr_LU
index c1ceda184..5d76dc746 100644
--- a/libc/localedata/locales/fr_LU
+++ b/libc/localedata/locales/fr_LU
@@ -158,5 +158,10 @@ country_ab3 "<U004C><U0055><U0058>"
country_num 442
% L
country_car "<U004C>"
-
+% fr
+lang_ab "<U0066><U0072>"
+% fra
+lang_term "<U0066><U0072><U0061>"
+% fre
+lang_lib "<U0066><U0072><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fur_IT b/libc/localedata/locales/fur_IT
index a0e2e45c4..df51976fc 100644
--- a/libc/localedata/locales/fur_IT
+++ b/libc/localedata/locales/fur_IT
@@ -142,4 +142,6 @@ country_ab3 "<U0049><U0054><U0041>"
country_num 380
% I
country_car "<U0049>"
+% fur
+lang_term "<U0066><U0075><U0072>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/fy_DE b/libc/localedata/locales/fy_DE
index bfc462bf6..d4a861470 100644
--- a/libc/localedata/locales/fy_DE
+++ b/libc/localedata/locales/fy_DE
@@ -51,9 +51,12 @@ country_num 276
country_isbn "3"
% FIXME country_name in Low Saxon ?
lang_name "Frisian"
-lang_ab "fy"
-% FIXME lang_term for Low Saxon ?
-% FIXME lang_lib for Low Saxon ?
+% fy
+lang_ab "<U0066><U0079>"
+% fry
+lang_term "<U0066><U0072><U0079>"
+% fry
+lang_lib "<U0066><U0072><U0079>"
END LC_ADDRESS
LC_COLLATE
diff --git a/libc/localedata/locales/fy_NL b/libc/localedata/locales/fy_NL
index 0855a5560..c6be0b1f2 100644
--- a/libc/localedata/locales/fy_NL
+++ b/libc/localedata/locales/fy_NL
@@ -131,8 +131,11 @@ country_ab3 "<U004E><U004C><U0044>"
country_num 528
country_car "<U004E><U004C>"
lang_name "<U0046><U0072><U0069><U0073><U0069><U0061><U006E>"
-lang_ab "<U0066><U0079>"
-lang_term "<U0066><U0072><U0079>"
+% fy
+lang_ab "<U0066><U0079>"
+% fry
+lang_term "<U0066><U0072><U0079>"
+% fry
lang_lib "<U0066><U0072><U0079>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ga_IE b/libc/localedata/locales/ga_IE
index 435e242ed..dda000930 100644
--- a/libc/localedata/locales/ga_IE
+++ b/libc/localedata/locales/ga_IE
@@ -160,5 +160,10 @@ country_ab3 "<U0049><U0052><U004C>"
country_num 372
% IRL
country_car "<U0049><U0052><U004C>"
-
+% ga
+lang_ab "<U0067><U0061>"
+% gle
+lang_term "<U0067><U006C><U0065>"
+% gle
+lang_lib "<U0067><U006C><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/gd_GB b/libc/localedata/locales/gd_GB
index 4d422840b..f2d9e81be 100644
--- a/libc/localedata/locales/gd_GB
+++ b/libc/localedata/locales/gd_GB
@@ -1,56 +1,47 @@
-escape_char /
-comment_char %
-% charset "ISO_8859-15"
-% Distribution and use is free, also for commercial purposes.
-
-
-% WARNING: UNOFFICIAL; EXPERIMENTAL.
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Revision 1.1 created by Alastair McKinstry <mckinstry@computer.org>, 2000-06-12
+% Revision 1.2 created by Michael Bauer <fios@akerbeltz.org>, 2013-04-25
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LC_IDENTIFICATION
-title "Scots Gaelic language locale for Great Britain"
-source "Alastair McKinstry"
-address "Croí Lár, Ballinahalla, Maigh Cuilinn, Co. Gaillimh, Ireland"
-contact "Alastair McKinstry"
-email "mckinstry@computer.org"
-tel "+353 91 556177"
-language "Scots Gaelic"
-territory "Great Britain"
-date "2000-06-12"
-revision "1.1"
-
-category gd_GB:2000;LC_IDENTIFICATION
-category gd_GB:2000;LC_CTYPE
-category gd_GB:2000;LC_COLLATE
-category gd_GB:2000;LC_TIME
-category gd_Gb:2000;LC_NUMERIC
-category gd_GB:2000;LC_PAPER
-category gd_GB:2000;LC_NAME
-category gd_GB:2000;LC_ADDRESS
-category gd_GB:2000;LC_TELEPHONE
-category gd_GB:2000;LC_MEASUREMENT
-
+title "Scots Gaelic language locale for Great Britain"
+source "Akerbeltz"
+address "1/2, 47 Wilton Street, Glasgow G20 6RT, UK"
+contact "Michael Bauer"
+email "fios@akerbeltz.org"
+tel "+44 141 946 4437"
+language "Scots Gaelic"
+territory "Great Britain"
+revision "1.2"
+date "2013-04-25"
+%
+category "gd_GB:2000";LC_IDENTIFICATION
+category "gd_GB:2000";LC_CTYPE
+category "gd_GB:2000";LC_COLLATE
+category "gd_GB:2000";LC_TIME
+category "gd_GB:2000";LC_NUMERIC
+category "gd_GB:2000";LC_MONETARY
+category "gd_GB:2000";LC_PAPER
+category "gd_GB:2000";LC_MEASUREMENT
+category "gd_GB:2000";LC_MESSAGES
+category "gd_GB:2000";LC_NAME
+category "gd_GB:2000";LC_ADDRESS
+category "gd_GB:2000";LC_TELEPHONE
END LC_IDENTIFICATION
-LC_ADDRESS
-% FIXME
-postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
-<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
-<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
-<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
-<U004E><U0025><U0063><U0025><U004E>"
-
-country_name "<U0042><U0072><U0065><U0061><U0074><U0061><U0069><U006E><U006E><U0020><U004D><U0068><U00F2><U0072>"
-country_ab2 "GB"
-country_ab3 "GBR"
-country_num 826
-country_car "GB"
-country_isbn "0"
-lang_name "<U0047><U0061><U0069><U0064><U0068><U006C><U0069><U0067><U0020><U006E><U0061><U0020><U0068><U002D><U0041><U006C><U0062><U0061><U006E><U00F1>"
-lang_ab "gd"
-lang_term "gla"
-lang_lib "gla"
-END LC_ADDRESS
-
LC_CTYPE
copy "i18n"
translit_start
@@ -58,82 +49,115 @@ include "translit_combining";""
translit_end
END LC_CTYPE
-LC_PAPER
-copy "en_GB"
-END LC_PAPER
-
-LC_MEASUREMENT
-copy "en_GB"
-END LC_MEASUREMENT
-
-LC_TELEPHONE
-copy "en_GB"
-END LC_TELEPHONE
-
LC_COLLATE
-copy "en_DK"
+copy "iso14651_t1"
END LC_COLLATE
-LC_MONETARY
-copy "en_GB"
-END LC_MONETARY
+LC_TIME
+% Am Faoilleach, An Gearran, Am Màrt, An Giblean, An Cèitean, An t-Ògmhios, An t-Iuchar, An Lùnastal, An t-Sultain, An Dàmhair, An t-Samhain, An Dùbhlachd
+mon "<U0041><U006D><U0020><U0046><U0061><U006F><U0069><U006C><U006C><U0065><U0061><U0063><U0068>";/
+ "<U0041><U006E><U0020><U0047><U0065><U0061><U0072><U0072><U0061><U006E>";/
+ "<U0041><U006D><U0020><U004D><U00E0><U0072><U0074>";/
+ "<U0041><U006E><U0020><U0047><U0069><U0062><U006C><U0065><U0061><U006E>";/
+ "<U0041><U006E><U0020><U0043><U00E8><U0069><U0074><U0065><U0061><U006E>";/
+ "<U0041><U006E><U0020><U0074><U002D><U00D2><U0067><U006D><U0068><U0069><U006F><U0073>";/
+ "<U0041><U006E><U0020><U0074><U002D><U0049><U0075><U0063><U0068><U0061><U0072>";/
+ "<U0041><U006E><U0020><U004C><U00F9><U006E><U0061><U0073><U0074><U0061><U006C>";/
+ "<U0041><U006E><U0020><U0074><U002D><U0053><U0075><U006C><U0074><U0061><U0069><U006E>";/
+ "<U0041><U006E><U0020><U0044><U00E0><U006D><U0068><U0061><U0069><U0072>";/
+ "<U0041><U006E><U0020><U0074><U002D><U0053><U0061><U006D><U0068><U0061><U0069><U006E>";/
+ "<U0041><U006E><U0020><U0044><U00F9><U0062><U0068><U006C><U0061><U0063><U0068><U0064>"
+% Faoi, Gearr, Màrt, Gibl, Mhàrt, Ògmh, Iuch, Lùna, Sult, Dàmh, Samh, Dùbh
+abmon "<U0046><U0061><U006F><U0069>";/
+ "<U0047><U0065><U0061><U0072><U0072>";/
+ "<U004D><U00E0><U0072><U0074>";/
+ "<U0047><U0069><U0062><U006C>";/
+ "<U004D><U0068><U00E0><U0072><U0074>";/
+ "<U00D2><U0067><U006D><U0068>";/
+ "<U0049><U0075><U0063><U0068>";/
+ "<U004C><U00F9><U006E><U0061>";/
+ "<U0053><U0075><U006C><U0074>";/
+ "<U0044><U00E0><U006D><U0068>";/
+ "<U0053><U0061><U006D><U0068>";/
+ "<U0044><U00F9><U0062><U0068>"
+% DiDòmhnaich, DiLuain, DiMàirt, DiCiadain, DiarDaoin, DihAoine, DiSathairne
+day "<U0044><U0069><U0044><U00F2><U006D><U0068><U006E><U0061><U0069><U0063><U0068>";/
+ "<U0044><U0069><U004C><U0075><U0061><U0069><U006E>";/
+ "<U0044><U0069><U004D><U00E0><U0069><U0072><U0074>";/
+ "<U0044><U0069><U0043><U0069><U0061><U0064><U0061><U0069><U006E>";/
+ "<U0044><U0069><U0061><U0072><U0044><U0061><U006F><U0069><U006E>";/
+ "<U0044><U0069><U0068><U0041><U006F><U0069><U006E><U0065>";/
+ "<U0044><U0069><U0053><U0061><U0074><U0068><U0061><U0069><U0072><U006E><U0065>"
+% DiD, DiL, DiM, DiC, Dia, Dih, DiS
+abday "<U0044><U0069><U0044>";/
+ "<U0044><U0069><U004C>";/
+ "<U0044><U0069><U004D>";/
+ "<U0044><U0069><U0043>";/
+ "<U0044><U0069><U0061>";/
+ "<U0044><U0069><U0068>";/
+ "<U0044><U0069><U0053>"
+% %a %d %b %Y %T %Z
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+% %d/%m/%y
+d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
+% %r
+t_fmt "<U0025><U0072>"
+% m, f
+am_pm "<U006D>";/
+ "<U0066>"
+t_fmt_ampm ""
+END LC_TIME
LC_NUMERIC
copy "en_GB"
END LC_NUMERIC
-LC_TIME
-
-abday "<U0044><U0069><U0064><U006F>";"<U0044><U0069><U006C><U0075>";/
- "<U0044><U0069><U006D>";"<U0044><U0069><U0063>";/
- "<U0044><U0069><U0061><U0072>";"<U0044><U0069><U0068><U0061>";/
- "<U0044><U0069><U0073><U0061>"
-
-day "<U0044><U0069><U0064><U00F2><U006D><U0068><U006E><U0061><U0069><U0063><U0068>";/
- "<U0044><U0069><U006C><U0075><U0061><U0069><U006E>";/
- "<U0044><U0069><U006D><U00E0><U0069><U0072><U0074>";/
- "<U0044><U0069><U0063><U0069><U0061><U0064><U0061><U0069><U006E>";/
- "<U0044><U0069><U0061><U0072><U0064><U0061><U006F><U0069><U006E>";/
- "<U0044><U0069><U0068><U0061><U006F><U0069><U006E><U0065>";/
- "<U0044><U0069><U0073><U0061><U0074><U0068><U0061><U0069><U0072><U006E><U0065>"
-
-abmon "<U0046><U0061><U006F>";"<U0047><U0065><U0061>";/
- "<U004D><U00E0><U0072>";"<U0047><U0069><U0062>";/
- "<U004D><U0068><U00E0>";"<U004F><U0067><U004D>";/
- "<U006C><U0075><U0063>";"<U004C><U00F9><U006E>";/
- "<U0053><U0075><U006C>";"<U0044><U0061><U006D>";/
- "<U0053><U0061><U006D>";"<U0044><U00F9><U0062>"
+LC_MONETARY
+copy "en_GB"
+END LC_MONETARY
-mon "<U0041><U006D><U0020><U0046><U0061><U006F><U0069><U006C><U0074><U0065><U0061><U0063><U0068>";/
- "<U0041><U006E><U0020><U0047><U0065><U0061><U0072><U0072><U0061><U006E>";/
- "<U0041><U006D><U0020><U004D><U00E0><U0072><U0074>";/
- "<U0041><U006E><U0020><U0047><U0069><U0062><U006C><U0065><U0061><U006E>";/
- "<U0041><U0027><U0020><U004D><U0068><U00E0><U0069><U0067><U0068>";/
- "<U0041><U006E><U0020><U0074><U002D><U004D><U0068><U00EC><U006F><U0073>";/
- "<U0041><U006E><U0020><U0074><U002D><U006C><U0075><U0063><U0068><U0061><U0072>";/
- "<U0041><U006E><U0020><U004C><U00F9><U006E><U0061><U0073><U0064><U0061><U006C>";/
- "<U0041><U006E><U0020><U0074><U002D><U0053><U0075><U006C><U0074><U0061><U0069><U006E>";/
- "<U0041><U006E><U0020><U0044><U0061><U006D><U0068><U0061><U0069><U0072>";/
- "<U0041><U006E><U0020><U0074><U002D><U0053><U0061><U006D><U0068><U0061><U0069><U006E>";/
- "<U0041><U006E><U0020><U0044><U00F9><U0062><U0068><U006C><U0061><U0063><U0068><U0064>"
+LC_PAPER
+copy "en_GB"
+END LC_PAPER
-d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
-d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
-t_fmt "<U0025><U0054>"
-am_pm "";""
-t_fmt_ampm ""
-first_workday 2
-first_weekday 2
-END LC_TIME
+LC_MEASUREMENT
+copy "en_GB"
+END LC_MEASUREMENT
LC_MESSAGES
-% FIXME
-yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
-% FIXME
-noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+% ^[tTyY].*
+yesexpr "<U005E><U005B><U0074><U0054><U0079><U0059><U005D><U002E><U002A>"
+% ^[cCnN].*
+noexpr "<U005E><U005B><U0063><U0043><U006E><U004E><U005D><U002E><U002A>"
END LC_MESSAGES
LC_NAME
-% FIXME
copy "en_GB"
END LC_NAME
+
+LC_ADDRESS
+% %f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%S%N%c%N
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U007A><U0020><U0025><U0054><U0025><U004E><U0025><U0053><U0025><U004E><U0025><U0063><U0025><U004E>"
+% A' Bhreatainn Mhòr
+country_name "<U0042><U0072><U0065><U0061><U0074><U0061><U0069><U006E><U006E><U0020><U004D><U0068><U00F2><U0072>"
+% GB
+country_ab2 "<U0047><U0042>"
+% GBR
+country_ab3 "<U0047><U0042><U0052>"
+country_num 826
+% GB
+country_car "<U0047><U0042>"
+country_isbn 0
+% Gàidhlig
+lang_name "<U0047><U00E0><U0069><U0064><U0068><U006C><U0069><U0067>"
+% gd
+lang_ab "<U0067><U0064>"
+% gla
+lang_term "<U0067><U006C><U0061>"
+% gla
+lang_lib "<U0067><U006C><U0061>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+copy "en_GB"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/gez_ER b/libc/localedata/locales/gez_ER
index 3895c8e9a..5baff5c35 100644
--- a/libc/localedata/locales/gez_ER
+++ b/libc/localedata/locales/gez_ER
@@ -111,7 +111,7 @@ country_num 232
country_car "<U0045><U0052>"
% country_isbn unknown, Need ISO 2108
lang_name "<U130D><U12D5><U12DD>"
-%lang_ab "<U0067><U0065><U007A>"
+% gez
lang_term "<U0067><U0065><U007A>"
%
% Petter Reinholdtsen reports uncommenting the below breaks compilation
diff --git a/libc/localedata/locales/gez_ET b/libc/localedata/locales/gez_ET
index 7a84234b0..b5a6cc6a4 100644
--- a/libc/localedata/locales/gez_ET
+++ b/libc/localedata/locales/gez_ET
@@ -111,7 +111,6 @@ country_num 231 % 210 found in at least one ISO 3166 doc
country_car "<U0045><U0054><U0048>"
% country_isbn unknown, Need ISO 2108
lang_name "<U130D><U12D5><U12DD>"
-%lang_ab "<U0067><U0065><U007A>"
lang_term "<U0067><U0065><U007A>"
%
% Petter Reinholdtsen reports uncommenting the below breaks compilation
diff --git a/libc/localedata/locales/gl_ES b/libc/localedata/locales/gl_ES
index 3df1e33d6..6acf5050b 100644
--- a/libc/localedata/locales/gl_ES
+++ b/libc/localedata/locales/gl_ES
@@ -159,5 +159,10 @@ country_ab3 "<U0045><U0053><U0050>"
country_num 724
% E
country_car "<U0045>"
-
+% gl
+lang_ab "<U0067><U006C>"
+% glg
+lang_term "<U0067><U006C><U0067>"
+% glg
+lang_lib "<U0067><U006C><U0067>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/gu_IN b/libc/localedata/locales/gu_IN
index fdc9282f1..4e4f5c647 100644
--- a/libc/localedata/locales/gu_IN
+++ b/libc/localedata/locales/gu_IN
@@ -217,7 +217,12 @@ country_ab3 "<U0049><U004E><U0044>"
country_num 356
% IND
country_car "<U0049><U004E><U0044>"
-
+% gu
+lang_ab "<U0067><U0075>"
+% guj
+lang_term "<U0067><U0075><U006A>"
+% guj
+lang_lib "<U0067><U0075><U006A>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/gv_GB b/libc/localedata/locales/gv_GB
index 0b64788ad..40ab18753 100644
--- a/libc/localedata/locales/gv_GB
+++ b/libc/localedata/locales/gv_GB
@@ -174,5 +174,10 @@ country_ab3 "<U0047><U0042><U0052>"
country_num 826
% GB
country_car "<U0047><U0042>"
-
+% gv
+lang_ab "<U0067><U0076>"
+% glv
+lang_term "<U0067><U006C><U0076>"
+% glv
+lang_lib "<U0067><U006C><U0076>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hak_TW b/libc/localedata/locales/hak_TW
new file mode 100644
index 000000000..1886e5a35
--- /dev/null
+++ b/libc/localedata/locales/hak_TW
@@ -0,0 +1,219 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Hakka Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@member.fsf.org>
+%
+% build with: localedef -f UTF-8 -i hak_TW hak_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Hakka Chinese locale for the Republic of China"
+source ""
+address ""
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Hakka Chinese"
+territory "Republic of China"
+revision "0.1"
+date "2013-06-02"
+%
+category "hak_TW:2000";LC_IDENTIFICATION
+category "hak_TW:2000";LC_CTYPE
+category "hak_TW:2000";LC_COLLATE
+category "hak_TW:2000";LC_TIME
+category "hak_TW:2000";LC_NUMERIC
+category "hak_TW:2000";LC_MONETARY
+category "hak_TW:2000";LC_PAPER
+category "hak_TW:2000";LC_MEASUREMENT
+category "hak_TW:2000";LC_MESSAGES
+category "hak_TW:2000";LC_NAME
+category "hak_TW:2000";LC_ADDRESS
+category "hak_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class "hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, ä¹æœˆ, å月, å一月, å二月
+mon "<U4E00><U6708>";/
+ "<U4E8C><U6708>";/
+ "<U4E09><U6708>";/
+ "<U56DB><U6708>";/
+ "<U4E94><U6708>";/
+ "<U516D><U6708>";/
+ "<U4E03><U6708>";/
+ "<U516B><U6708>";/
+ "<U4E5D><U6708>";/
+ "<U5341><U6708>";/
+ "<U5341><U4E00><U6708>";/
+ "<U5341><U4E8C><U6708>"
+% 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月
+abmon "<U0020><U0031><U6708>";/
+ "<U0020><U0032><U6708>";/
+ "<U0020><U0033><U6708>";/
+ "<U0020><U0034><U6708>";/
+ "<U0020><U0035><U6708>";/
+ "<U0020><U0036><U6708>";/
+ "<U0020><U0037><U6708>";/
+ "<U0020><U0038><U6708>";/
+ "<U0020><U0039><U6708>";/
+ "<U0031><U0030><U6708>";/
+ "<U0031><U0031><U6708>";/
+ "<U0031><U0032><U6708>"
+% 禮拜日, 禮拜一, 禮拜二, 禮拜三, 禮拜四, 禮拜五, 禮拜六
+day "<U79AE><U62DC><U65E5>";/
+ "<U79AE><U62DC><U4E00>";/
+ "<U79AE><U62DC><U4E8C>";/
+ "<U79AE><U62DC><U4E09>";/
+ "<U79AE><U62DC><U56DB>";/
+ "<U79AE><U62DC><U4E94>";/
+ "<U79AE><U62DC><U516D>"
+% 日, 一, 二, 三, 四, 五, 六
+abday "<U65E5>";/
+ "<U4E00>";/
+ "<U4E8C>";/
+ "<U4E09>";/
+ "<U56DB>";/
+ "<U4E94>";/
+ "<U516D>"
+% %Y年%m月%d日 (%A) %H點%M分%S秒
+d_t_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Y年%m月%d日
+d_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
+% %H點%M分%S秒
+t_fmt "<U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% 上æ™, 下æ™
+am_pm "<U4E0A><U665D>";"<U4E0B><U665D>"
+% %p %I點%M分%S秒
+t_fmt_ampm "<U0025><U0070><U0020><U0025><U0049><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Yå¹´ %b %eæ—¥ %A %H:%M:%S %Z
+date_fmt "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A>"
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping 4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point "<U002E>"
+% ,
+mon_thousands_sep "<U002C>"
+mon_grouping 4
+positive_sign ""
+% -
+negative_sign "<U002D>"
+frac_digits 2
+int_frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 0
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+int_p_cs_precedes 1
+int_p_sep_by_space 0
+int_n_cs_precedes 1
+int_n_sep_by_space 0
+int_p_sign_posn 1
+int_n_sign_posn 1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yYä¿‚]
+yesexpr "<U005E><U005B><U0079><U0059><U4FC2><U005D>"
+% ^[nN毋]
+noexpr "<U005E><U005B><U006E><U004E><U6BCB><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%t%g%t%d
+name_fmt "<U0025><U0066><U0025><U0074><U0025><U0067><U0025><U0074><U0025><U0064>"
+% å›
+name_gen "<U541B>"
+% å°å§
+name_miss "<U5C0F><U59D0>"
+% 先生
+name_mr "<U5148><U751F>"
+% 夫人
+name_mrs "<U592B><U4EBA>"
+% 女士
+name_ms "<U5973><U58EB>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% 中è¯æ°‘國
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2 "<U0054><U0057>"
+% TWN
+country_ab3 "<U0054><U0057><U004E>"
+country_num 158
+country_isbn 957
+% 漢語客家語
+lang_name "<U6F22><U8A9E><U5BA2><U5BB6><U8A9E>"
+% hak
+lang_term "<U0068><U0061><U006B>"
+% hak
+lang_lib "<U0068><U0061><U006B>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select "<U0030><U0030>"
+% 886
+int_prefix "<U0038><U0038><U0036>"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/he_IL b/libc/localedata/locales/he_IL
index 478a97aee..b2539a1c2 100644
--- a/libc/localedata/locales/he_IL
+++ b/libc/localedata/locales/he_IL
@@ -164,5 +164,10 @@ country_ab3 "<U0049><U0053><U0052>"
country_num 376
% IL
country_car "<U0049><U004C>"
-
+% he
+lang_ab "<U0068><U0065>"
+% heb
+lang_term "<U0068><U0065><U0062>"
+% heb
+lang_lib "<U0068><U0065><U0062>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hi_IN b/libc/localedata/locales/hi_IN
index 41912b316..047f47f21 100644
--- a/libc/localedata/locales/hi_IN
+++ b/libc/localedata/locales/hi_IN
@@ -217,7 +217,12 @@ country_ab3 "<U0049><U004E><U0044>"
country_num 356
% IND
country_car "<U0049><U004E><U0044>"
-
+% hi
+lang_ab "<U0068><U0069>"
+% hin
+lang_term "<U0068><U0069><U006E>"
+% hin
+lang_lib "<U0068><U0069><U006E>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hne_IN b/libc/localedata/locales/hne_IN
index f1c3cfdc6..6a80b6940 100644
--- a/libc/localedata/locales/hne_IN
+++ b/libc/localedata/locales/hne_IN
@@ -157,16 +157,16 @@ END LC_NAME
LC_ADDRESS
-% This is the ISO_IEC TR14652 Locale definition for the
-% LC_ADDRESS
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
-lang_term "<U0068><U006E><U0065>"
-
+% IND
+country_car "<U0049><U004E><U0044>"
+% hne
+lang_term "<U0068><U006E><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hr_HR b/libc/localedata/locales/hr_HR
index 4c7a88a0a..7dccab38c 100644
--- a/libc/localedata/locales/hr_HR
+++ b/libc/localedata/locales/hr_HR
@@ -2249,5 +2249,8 @@ country_ab3 "<U0048><U0052><U0056>"
country_num 191
% HR
country_car "<U0048><U0052>"
-
+% hr
+lang_ab "<U0068><U0072>"
+% hrv
+lang_term "<U0068><U0072><U0076>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hsb_DE b/libc/localedata/locales/hsb_DE
index 0929897c8..fd3217af7 100644
--- a/libc/localedata/locales/hsb_DE
+++ b/libc/localedata/locales/hsb_DE
@@ -2214,7 +2214,9 @@ country_car "<U0044>"
country_isbn 3
lang_name "<U0048><U006F><U0072><U006E><U006A><U006F><U0073><U0065>/
<U0072><U0062><U0161><U0107><U0069><U006E><U0061>"
-lang_ab ""
-lang_term "<U0068><U0073><U0062>"
-lang_lib "<U0068><U0073><U0062>"
+lang_ab ""
+% hsb
+lang_term "<U0068><U0073><U0062>"
+% hsb
+lang_lib "<U0068><U0073><U0062>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ht_HT b/libc/localedata/locales/ht_HT
index 8b3d11827..66ae10bfd 100644
--- a/libc/localedata/locales/ht_HT
+++ b/libc/localedata/locales/ht_HT
@@ -194,6 +194,8 @@ country_ab2 "<U0048><U0054>"
country_ab3 "<U0048><U0054><U0049>"
country_num 332
country_isbn 99935
+% RH
+country_car "<U0052><U0048>"
%
% Kreyòl ayisyen
lang_name "<U004B><U0072><U0065><U0079><U00F2><U006C><U0020><U0061><U0079><U0069><U0073><U0079><U0065><U006E>"
@@ -201,6 +203,8 @@ lang_name "<U004B><U0072><U0065><U0079><U00F2><U006C><U0020><U0061><U0079><U0
lang_ab "<U0068><U0074>"
% hat
lang_term "<U0068><U0061><U0074>"
+% hat
+lang_lib "<U0068><U0061><U0074>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/hu_HU b/libc/localedata/locales/hu_HU
index 41180d4c2..a6169d739 100644
--- a/libc/localedata/locales/hu_HU
+++ b/libc/localedata/locales/hu_HU
@@ -586,5 +586,10 @@ country_ab3 "<U0048><U0055><U004E>"
country_num 348
% H
country_car "<U0048>"
-
+% hu
+lang_ab "<U0068><U0075>"
+% hun
+lang_term "<U0068><U0075><U006E>"
+% hun
+lang_lib "<U0068><U0075><U006E>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/hy_AM b/libc/localedata/locales/hy_AM
index d479730a6..1e4649a34 100644
--- a/libc/localedata/locales/hy_AM
+++ b/libc/localedata/locales/hy_AM
@@ -186,9 +186,12 @@ country_num 51
country_car "<U0041><U004D>"
country_isbn "<U0039><U0039><U0039><U0033><U0030>"
lang_name "<U0540><U0561><U0575><U0565><U0580><U0565><U0576>"
-lang_ab "<U0068><U0079>"
-lang_term "<U0068><U0079><U0065>"
-lang_lib "<U0061><U0072><U006D>"
+% hy
+lang_ab "<U0068><U0079>"
+% hye
+lang_term "<U0068><U0079><U0065>"
+% arm
+lang_lib "<U0061><U0072><U006D>"
END LC_ADDRESS
LC_NAME
diff --git a/libc/localedata/locales/ia_FR b/libc/localedata/locales/ia_FR
index 5b419d260..b6cd1fcba 100644
--- a/libc/localedata/locales/ia_FR
+++ b/libc/localedata/locales/ia_FR
@@ -130,9 +130,13 @@ country_num 250
country_isbn 2
country_car "<U0046>"
lang_name "<U0049><U006E><U0074><U0065><U0072><U006C><U0069><U006E><U0067><U0075><U0061>"
-lang_ab "<U0069><U0061>"
-lang_term "<U0069><U006E><U0061>"
-lang_lib "<U0069><U006E><U0061>"
+
+% ia
+lang_ab "<U0069><U0061>"
+% ina
+lang_term "<U0069><U006E><U0061>"
+% ina
+lang_lib "<U0069><U006E><U0061>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/id_ID b/libc/localedata/locales/id_ID
index 0e217240f..35cf7b1a1 100644
--- a/libc/localedata/locales/id_ID
+++ b/libc/localedata/locales/id_ID
@@ -161,5 +161,10 @@ country_ab3 "<U0049><U0044><U004E>"
country_num 360
% RI
country_car "<U0052><U0049>"
-
+% id
+lang_ab "<U0069><U0064>"
+% ind
+lang_term "<U0069><U006E><U0064>"
+% ind
+lang_lib "<U0069><U006E><U0064>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ig_NG b/libc/localedata/locales/ig_NG
index 47ad2124f..eb6fc3872 100644
--- a/libc/localedata/locales/ig_NG
+++ b/libc/localedata/locales/ig_NG
@@ -488,10 +488,12 @@ country_isbn 978
% ISO 639 language abbreviations:
% 639-1 2 letter, 639-2 3 letter terminology
% http://www.loc.gov/standards/iso639-2/englagn.html
-% "ig", "ibo"
-lang_ab "<U0069><U0067>"
-lang_term "<U0069><U0062><U006F>"
-lang_lib "<U0069><U0062><U006F>"
+% ig
+lang_ab "<U0069><U0067>"
+% ibo
+lang_term "<U0069><U0062><U006F>"
+% ibo
+lang_lib "<U0069><U0062><U006F>"
% ISO 3166 country number and 2 and 3 letter abreviations
% http://www.unicode.org/onlinedat/countries.html
diff --git a/libc/localedata/locales/ik_CA b/libc/localedata/locales/ik_CA
index 0b4a19447..3ca018a2e 100644
--- a/libc/localedata/locales/ik_CA
+++ b/libc/localedata/locales/ik_CA
@@ -233,6 +233,11 @@ country_ab3 "<U0043><U0041><U004E>"
country_num 124
% CDN
country_car "<U0043><U0044><U004E>"
-
+% ik
+lang_ab "<U0069><U006B>"
+% ipk
+lang_term "<U0069><U0070><U006B>"
+% ipk
+lang_lib "<U0069><U0070><U006B>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/is_IS b/libc/localedata/locales/is_IS
index 051fe8164..1e2dff02d 100644
--- a/libc/localedata/locales/is_IS
+++ b/libc/localedata/locales/is_IS
@@ -2265,5 +2265,10 @@ country_ab3 "<U0049><U0053><U004C>"
country_num 352
% IS
country_car "<U0049><U0053>"
-
+% is
+lang_ab "<U0069><U0073>"
+% isl
+lang_term "<U0069><U0073><U006C>"
+% ice
+lang_lib "<U0069><U0063><U0065>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/it_CH b/libc/localedata/locales/it_CH
index 9a0272a60..5702e44e6 100644
--- a/libc/localedata/locales/it_CH
+++ b/libc/localedata/locales/it_CH
@@ -136,5 +136,10 @@ country_ab3 "<U0043><U0048><U0045>"
country_num 756
% CH
country_car "<U0043><U0048>"
-
+% it
+lang_ab "<U0069><U0074>"
+% ita
+lang_term "<U0069><U0074><U0061>"
+% ita
+lang_lib "<U0069><U0074><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/it_IT b/libc/localedata/locales/it_IT
index 3aaa21385..498010dfd 100644
--- a/libc/localedata/locales/it_IT
+++ b/libc/localedata/locales/it_IT
@@ -162,5 +162,10 @@ country_ab3 "<U0049><U0054><U0041>"
country_num 380
% I
country_car "<U0049>"
-
+% it
+lang_ab "<U0069><U0074>"
+% ita
+lang_term "<U0069><U0074><U0061>"
+% ita
+lang_lib "<U0069><U0074><U0061>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/iu_CA b/libc/localedata/locales/iu_CA
index 748d289aa..3146568b1 100644
--- a/libc/localedata/locales/iu_CA
+++ b/libc/localedata/locales/iu_CA
@@ -45,9 +45,12 @@ country_num 124
country_car "<U0043><U0044><U004E>"
% FIXME country_isbn for Canada/inuktitut ?
lang_name "<U1403><U14C4><U1483><U144E><U1450><U1466>"
-lang_ab "<U0069><U0075>"
-lang_term "<U0069><U006B><U0075>"
-lang_lib "<U0069><U006B><U0075>"
+% iu
+lang_ab "<U0069><U0075>"
+% iku
+lang_term "<U0069><U006B><U0075>"
+% iku
+lang_lib "<U0069><U006B><U0075>"
END LC_ADDRESS
%%%%%%%%%%%%%
diff --git a/libc/localedata/locales/kl_GL b/libc/localedata/locales/kl_GL
index 788950c61..5bd305d94 100644
--- a/libc/localedata/locales/kl_GL
+++ b/libc/localedata/locales/kl_GL
@@ -143,4 +143,6 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0047><U004C>"
country_ab3 "<U0047><U0052><U004C>"
country_num 304
+% GRO
+country_car "<U0047><U0052><U004F>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/kok_IN b/libc/localedata/locales/kok_IN
index 8f3013905..c17887c2b 100644
--- a/libc/localedata/locales/kok_IN
+++ b/libc/localedata/locales/kok_IN
@@ -196,6 +196,8 @@ postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ks_IN b/libc/localedata/locales/ks_IN
index 77cc8c295..bdaf57dc0 100644
--- a/libc/localedata/locales/ks_IN
+++ b/libc/localedata/locales/ks_IN
@@ -197,7 +197,8 @@ postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073><U0025><U00
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
-
+% IND
+country_car "<U0049><U004E><U0044>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/lij_IT b/libc/localedata/locales/lij_IT
index cac3ae5c3..0d7e4586e 100644
--- a/libc/localedata/locales/lij_IT
+++ b/libc/localedata/locales/lij_IT
@@ -129,4 +129,6 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0049><U0054>"
country_ab3 "<U0049><U0054><U0041>"
country_num 380
+% I
+country_car "<U0049>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/lzh_TW b/libc/localedata/locales/lzh_TW
new file mode 100644
index 000000000..785d73ad5
--- /dev/null
+++ b/libc/localedata/locales/lzh_TW
@@ -0,0 +1,254 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Literary Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@member.fsf.org>
+%
+% build with: localedef -f UTF-8 -i lzh_TW lzh_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Literary Chinese locale for the Republic of China"
+source ""
+address ""
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Literary Chinese"
+territory "Republic of China"
+revision "0.1"
+date "2013-06-02"
+%
+category "lzh_TW:2000";LC_IDENTIFICATION
+category "lzh_TW:2000";LC_CTYPE
+category "lzh_TW:2000";LC_COLLATE
+category "lzh_TW:2000";LC_TIME
+category "lzh_TW:2000";LC_NUMERIC
+category "lzh_TW:2000";LC_MONETARY
+category "lzh_TW:2000";LC_PAPER
+category "lzh_TW:2000";LC_MEASUREMENT
+category "lzh_TW:2000";LC_MESSAGES
+category "lzh_TW:2000";LC_NAME
+category "lzh_TW:2000";LC_ADDRESS
+category "lzh_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class "hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, ä¹æœˆ, å月, å一月, å二月
+mon "<U4E00><U6708>";/
+ "<U4E8C><U6708>";/
+ "<U4E09><U6708>";/
+ "<U56DB><U6708>";/
+ "<U4E94><U6708>";/
+ "<U516D><U6708>";/
+ "<U4E03><U6708>";/
+ "<U516B><U6708>";/
+ "<U4E5D><U6708>";/
+ "<U5341><U6708>";/
+ "<U5341><U4E00><U6708>";/
+ "<U5341><U4E8C><U6708>"
+% 一 , 二 , 三 , å›› , 五 , å…­ , 七 , å…« , ä¹ , å , å一, å二
+abmon "<U0020><U4E00><U0020>";/
+ "<U0020><U4E8C><U0020>";/
+ "<U0020><U4E09><U0020>";/
+ "<U0020><U56DB><U0020>";/
+ "<U0020><U4E94><U0020>";/
+ "<U0020><U516D><U0020>";/
+ "<U0020><U4E03><U0020>";/
+ "<U0020><U516B><U0020>";/
+ "<U0020><U4E5D><U0020>";/
+ "<U0020><U5341><U0020>";/
+ "<U5341><U4E00>";/
+ "<U5341><U4E8C>"
+% 週日, 週一, 週二, 週三, 週四, 週五, 週六
+day "<U9031><U65E5>";/
+ "<U9031><U4E00>";/
+ "<U9031><U4E8C>";/
+ "<U9031><U4E09>";/
+ "<U9031><U56DB>";/
+ "<U9031><U4E94>";/
+ "<U9031><U516D>"
+% 日, 一, 二, 三, 四, 五, 六
+abday "<U65E5>";/
+ "<U4E00>";/
+ "<U4E8C>";/
+ "<U4E09>";/
+ "<U56DB>";/
+ "<U4E94>";/
+ "<U516D>"
+% %OC%Oy年%B%Od日 (%A) %OH時%OM分%OS秒
+d_t_fmt "<U0025><U004F><U0043><U0025><U004F><U0079><U5E74><U0025><U0042><U0025><U004F><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U004F><U0048><U6642><U0025><U004F><U004D><U5206><U0025><U004F><U0053><U79D2>"
+% %OC%Oyå¹´%B%Odæ—¥
+d_fmt "<U0025><U004F><U0043><U0025><U004F><U0079><U5E74><U0025><U0042><U0025><U004F><U0064><U65E5>"
+% %OH時%OM分%OS秒
+t_fmt "<U0025><U004F><U0048><U6642><U0025><U004F><U004D><U5206><U0025><U004F><U0053><U79D2>"
+% æœ, æš®
+am_pm "<U671D>";/
+ "<U66AE>"
+% %p %OI時%OM分%OS秒
+t_fmt_ampm "<U0025><U0070><U0020><U0025><U004F><U0049><U6642><U0025><U004F><U004D><U5206><U0025><U004F><U0053><U79D2>"
+% 公曆 %C%Oy年 %B %Oe日 %A %OH時%OM分%OS秒
+date_fmt "<U516C><U66C6><U0020><U0025><U0043><U0025><U004F><U0079><U5E74><U0020><U0025><U0042><U0020><U0025><U004F><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U004F><U0048><U6642><U0025><U004F><U004D><U5206><U0025><U004F><U0053><U79D2>"
+% 〇, 一, 二, 三, å››, 五, å…­, 七, å…«, ä¹, å, å一, å二, å三, åå››, å五, åå…­, å七, åå…«, åä¹, 廿, 廿一, 廿二, 廿三, 廿四, 廿五, 廿六, 廿七, 廿八, 廿ä¹, å…, å…一
+alt_digits "<U3007>";/
+ "<U4E00>";/
+ "<U4E8C>";/
+ "<U4E09>";/
+ "<U56DB>";/
+ "<U4E94>";/
+ "<U516D>";/
+ "<U4E03>";/
+ "<U516B>";/
+ "<U4E5D>";/
+ "<U5341>";/
+ "<U5341><U4E00>";/
+ "<U5341><U4E8C>";/
+ "<U5341><U4E09>";/
+ "<U5341><U56DB>";/
+ "<U5341><U4E94>";/
+ "<U5341><U516D>";/
+ "<U5341><U4E03>";/
+ "<U5341><U516B>";/
+ "<U5341><U4E5D>";/
+ "<U5EFF>";/
+ "<U5EFF><U4E00>";/
+ "<U5EFF><U4E8C>";/
+ "<U5EFF><U4E09>";/
+ "<U5EFF><U56DB>";/
+ "<U5EFF><U4E94>";/
+ "<U5EFF><U516D>";/
+ "<U5EFF><U4E03>";/
+ "<U5EFF><U516B>";/
+ "<U5EFF><U4E5D>";/
+ "<U5345>";/
+ "<U5345><U4E00>"
+%
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping 4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point "<U002E>"
+% ,
+mon_thousands_sep "<U002C>"
+mon_grouping 4
+positive_sign ""
+% -
+negative_sign "<U002D>"
+frac_digits 2
+int_frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 0
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+int_p_cs_precedes 1
+int_p_sep_by_space 0
+int_n_cs_precedes 1
+int_n_sep_by_space 0
+int_p_sign_posn 1
+int_n_sign_posn 1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yY是]
+yesexpr "<U005E><U005B><U0079><U0059><U662F><U005D>"
+% ^[nNéž]
+noexpr "<U005E><U005B><U006E><U004E><U975E><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%d%t%g
+name_fmt "<U0025><U0066><U0025><U0064><U0025><U0074><U0025><U0067>"
+% å›
+name_gen "<U541B>"
+% 女
+name_miss "<U5973>"
+% å­
+name_mr "<U5B50>"
+% æ°
+name_mrs "<U6C0F>"
+% 娘
+name_ms "<U5A18>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% 中è¯æ°‘國
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2 "<U0054><U0057>"
+% TWN
+country_ab3 "<U0054><U0057><U004E>"
+country_num 158
+country_isbn 957
+% 漢語文言
+lang_name "<U6F22><U8A9E><U6587><U8A00>"
+% lzh
+lang_term "<U006C><U007A><U0068>"
+% lzh
+lang_lib "<U006C><U007A><U0068>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select "<U0030><U0030>"
+% 886
+int_prefix "<U0038><U0038><U0036>"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/mag_IN b/libc/localedata/locales/mag_IN
index 69f319a23..4510776da 100644
--- a/libc/localedata/locales/mag_IN
+++ b/libc/localedata/locales/mag_IN
@@ -154,7 +154,16 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/mai_IN b/libc/localedata/locales/mai_IN
index 32bd12721..30108990b 100644
--- a/libc/localedata/locales/mai_IN
+++ b/libc/localedata/locales/mai_IN
@@ -70,7 +70,16 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/mg_MG b/libc/localedata/locales/mg_MG
index 4f738cae5..159a4a206 100644
--- a/libc/localedata/locales/mg_MG
+++ b/libc/localedata/locales/mg_MG
@@ -178,4 +178,6 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U004D><U0047>"
country_ab3 "<U004D><U0044><U0047>"
country_num 450
+% RM
+country_car "<U0052><U004D>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/mhr_RU b/libc/localedata/locales/mhr_RU
index 8ba17e8b3..b636aab16 100644
--- a/libc/localedata/locales/mhr_RU
+++ b/libc/localedata/locales/mhr_RU
@@ -159,4 +159,6 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0052><U0055>"
country_ab3 "<U0052><U0055><U0053>"
country_num 643
+% RUS
+country_car "<U0052><U0055><U0053>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/mni_IN b/libc/localedata/locales/mni_IN
index ff1ca4f89..d7d67860f 100644
--- a/libc/localedata/locales/mni_IN
+++ b/libc/localedata/locales/mni_IN
@@ -158,7 +158,14 @@ END LC_NAME
LC_ADDRESS
-copy "bn_IN"
+
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073><U0025><U0062><U0025><U0065><U0025><U0072>"
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/my_MM b/libc/localedata/locales/my_MM
index d7c40f364..261019ab1 100644
--- a/libc/localedata/locales/my_MM
+++ b/libc/localedata/locales/my_MM
@@ -312,6 +312,8 @@ postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0
country_name "<U1019><U103C><U1014><U103A><U1019><U102C>"
country_post "<U004D><U0079><U0061><U006E><U006D><U0061><U0072>"
country_ab2 "<U004D><U004D>"
+% BA
+country_car "<U0042><U0041>"
lang_ab "<U006D><U0079>"
lang_name "<U1017><U1019><U102C>"
lang_term "<U006D><U0079><U0061>"
diff --git a/libc/localedata/locales/nan_TW b/libc/localedata/locales/nan_TW
new file mode 100644
index 000000000..475e582c5
--- /dev/null
+++ b/libc/localedata/locales/nan_TW
@@ -0,0 +1,220 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Min Nan Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@member.fsf.org>
+%
+% build with: localedef -f UTF-8 -i nan_TW nan_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Min Nan Chinese locale for the Republic of China"
+source ""
+address ""
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Min Nan Chinese"
+territory "Republic of China"
+revision "0.1"
+date "2013-06-02"
+%
+category "nan_TW:2000";LC_IDENTIFICATION
+category "nan_TW:2000";LC_CTYPE
+category "nan_TW:2000";LC_COLLATE
+category "nan_TW:2000";LC_TIME
+category "nan_TW:2000";LC_NUMERIC
+category "nan_TW:2000";LC_MONETARY
+category "nan_TW:2000";LC_PAPER
+category "nan_TW:2000";LC_MEASUREMENT
+category "nan_TW:2000";LC_MESSAGES
+category "nan_TW:2000";LC_NAME
+category "nan_TW:2000";LC_ADDRESS
+category "nan_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class "hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, ä¹æœˆ, å月, å一月, å二月
+mon "<U4E00><U6708>";/
+ "<U4E8C><U6708>";/
+ "<U4E09><U6708>";/
+ "<U56DB><U6708>";/
+ "<U4E94><U6708>";/
+ "<U516D><U6708>";/
+ "<U4E03><U6708>";/
+ "<U516B><U6708>";/
+ "<U4E5D><U6708>";/
+ "<U5341><U6708>";/
+ "<U5341><U4E00><U6708>";/
+ "<U5341><U4E8C><U6708>"
+% 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月
+abmon "<U0020><U0031><U6708>";/
+ "<U0020><U0032><U6708>";/
+ "<U0020><U0033><U6708>";/
+ "<U0020><U0034><U6708>";/
+ "<U0020><U0035><U6708>";/
+ "<U0020><U0036><U6708>";/
+ "<U0020><U0037><U6708>";/
+ "<U0020><U0038><U6708>";/
+ "<U0020><U0039><U6708>";/
+ "<U0031><U0030><U6708>";/
+ "<U0031><U0031><U6708>";/
+ "<U0031><U0032><U6708>"
+% 禮拜日, 禮拜一, 禮拜二, 禮拜三, 禮拜四, 禮拜五, 禮拜六
+day "<U79AE><U62DC><U65E5>";/
+ "<U79AE><U62DC><U4E00>";/
+ "<U79AE><U62DC><U4E8C>";/
+ "<U79AE><U62DC><U4E09>";/
+ "<U79AE><U62DC><U56DB>";/
+ "<U79AE><U62DC><U4E94>";/
+ "<U79AE><U62DC><U516D>"
+% 日, 一, 二, 三, 四, 五, 六
+abday "<U65E5>";/
+ "<U4E00>";/
+ "<U4E8C>";/
+ "<U4E09>";/
+ "<U56DB>";/
+ "<U4E94>";/
+ "<U516D>"
+% %Y年%m月%d日 (%A) %H點%M分%S秒
+d_t_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Y年%m月%d日
+d_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
+% %H點%M分%S秒
+t_fmt "<U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% 頂晡, 下晡
+am_pm "<U9802><U6661>";/
+ "<U4E0B><U6661>"
+% %p %I點%M分%S秒
+t_fmt_ampm "<U0025><U0070><U0020><U0025><U0049><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %Yå¹´ %b %eæ—¥ %A %H:%M:%S %Z
+date_fmt "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A>"
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping 4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point "<U002E>"
+% ,
+mon_thousands_sep "<U002C>"
+mon_grouping 4
+positive_sign ""
+% -
+negative_sign "<U002D>"
+frac_digits 2
+int_frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 0
+n_cs_precedes 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+int_p_cs_precedes 1
+int_p_sep_by_space 0
+int_n_cs_precedes 1
+int_n_sep_by_space 0
+int_p_sign_posn 1
+int_n_sign_posn 1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yY是]
+yesexpr "<U005E><U005B><U0079><U0059><U662F><U005D>"
+% ^[nN伓]
+noexpr "<U005E><U005B><U006E><U004E><U4F13><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%t%g%t%d
+name_fmt "<U0025><U0066><U0025><U0074><U0025><U0067><U0025><U0074><U0025><U0064>"
+% å›
+name_gen "<U541B>"
+% å°å§
+name_miss "<U5C0F><U59D0>"
+% 先生
+name_mr "<U5148><U751F>"
+% 夫人
+name_mrs "<U592B><U4EBA>"
+% 女士
+name_ms "<U5973><U58EB>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% 中è¯æ°‘國
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2 "<U0054><U0057>"
+% TWN
+country_ab3 "<U0054><U0057><U004E>"
+country_num 158
+country_isbn 957
+% 漢語閩å—語
+lang_name "<U6F22><U8A9E><U95A9><U5357><U8A9E>"
+% nan
+lang_term "<U006E><U0061><U006E>"
+% nan
+lang_lib "<U006E><U0061><U006E>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select "<U0030><U0030>"
+% 886
+int_prefix "<U0038><U0038><U0036>"
+END LC_TELEPHONE
diff --git a/libc/localedata/locales/nhn_MX b/libc/localedata/locales/nhn_MX
index f2af76b6b..9029fb08f 100644
--- a/libc/localedata/locales/nhn_MX
+++ b/libc/localedata/locales/nhn_MX
@@ -140,5 +140,15 @@ copy "es_MX"
END LC_NAME
LC_ADDRESS
-copy "es_MX"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U004D><U0058>"
+country_ab3 "<U004D><U0045><U0058>"
+country_num 484
+% MEX
+country_car "<U004D><U0045><U0058>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/niu_NZ b/libc/localedata/locales/niu_NZ
index 25f58a90b..9a7e333af 100644
--- a/libc/localedata/locales/niu_NZ
+++ b/libc/localedata/locales/niu_NZ
@@ -181,6 +181,8 @@ country_ab2 "<U004E><U005A>"
% NZL
country_ab3 "<U004E><U005A><U004C>"
country_num 554
+% NZ
+country_car "<U004E><U005A>"
% niu
lang_term "<U006E><U0069><U0075>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/or_IN b/libc/localedata/locales/or_IN
index 2e28a0ab0..a291cc3ec 100644
--- a/libc/localedata/locales/or_IN
+++ b/libc/localedata/locales/or_IN
@@ -808,10 +808,13 @@ END LC_NAME
%%%%%%%%%%%%%
LC_ADDRESS
-% This is the ISO_IEC TR14652 Locale definition for the
-% LC_ADDRESS
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
END LC_ADDRESS
%%%%%%%%%%%%%
diff --git a/libc/localedata/locales/os_RU b/libc/localedata/locales/os_RU
index 6f6d00bc8..fe66c2864 100644
--- a/libc/localedata/locales/os_RU
+++ b/libc/localedata/locales/os_RU
@@ -166,5 +166,15 @@ copy "ru_RU"
END LC_NAME
LC_ADDRESS
-copy "ru_RU"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0052><U0055>"
+country_ab3 "<U0052><U0055><U0053>"
+country_num 643
+% RUS
+country_car "<U0052><U0055><U0053>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/pa_PK b/libc/localedata/locales/pa_PK
index 8b7cd0861..95543d913 100644
--- a/libc/localedata/locales/pa_PK
+++ b/libc/localedata/locales/pa_PK
@@ -177,6 +177,8 @@ postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
country_ab2 "<U0050><U004B>"
country_ab3 "<U0050><U0041><U004B>"
country_num 586
+% PK
+country_car "<U0050><U004B>"
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/pap_AN b/libc/localedata/locales/pap_AN
index 6f0e262bb..45696cdd2 100644
--- a/libc/localedata/locales/pap_AN
+++ b/libc/localedata/locales/pap_AN
@@ -2,6 +2,13 @@ comment_char %
escape_char /
% Distribution and use is free, also for commercial purposes.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This locale is replaced by pap_AW and pap_CW and should be removed in
+% release 2.21. AN line of iso-3177.def should also be removed.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
LC_IDENTIFICATION
title "Papiamento Language for the (Netherland) Antilles"
source "informations from native speaker"
@@ -143,8 +150,10 @@ END LC_PAPER
LC_TELEPHONE
tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025><U006C>"
% FIXME FIND tel_dom_fmt
-int_select "00"
-int_prefix "599"
+% 00
+int_select "<U0030><U0030>"
+% 599
+int_prefix "<U0035><U0039><U0039>"
END LC_TELEPHONE
LC_NAME
diff --git a/libc/localedata/locales/pap_AW b/libc/localedata/locales/pap_AW
new file mode 100644
index 000000000..115fa3d4f
--- /dev/null
+++ b/libc/localedata/locales/pap_AW
@@ -0,0 +1,172 @@
+comment_char %
+escape_char /
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is derived from pap_AN ver0.2 (after AN was deprecated in ISO-3166)
+% revision "0.2" date "2000-11-15"
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Papiamento Language for Aruba"
+source "information from native speaker"
+address ""
+contact "Pablo Saratxaga"
+email "pablo@mandrakesoft.com"
+tel ""
+fax ""
+language "pap"
+territory "AW"
+revision "1.0"
+date "2013-09-27"
+
+category i18n:2000;LC_IDENTIFICATION
+category i18n:2000;LC_COLLATE
+category i18n:2000;LC_CTYPE
+category i18n:2000;LC_MESSAGES
+category i18n:2000;LC_MONETARY
+category i18n:2000;LC_NUMERIC
+category i18n:2000;LC_TIME
+category i18n:2000;LC_PAPER
+category i18n:2000;LC_MEASUREMENT
+category i18n:2000;LC_TELEPHONE
+category i18n:2000;LC_ADDRESS
+
+% ISO/IEC 14652: Converted comments to LC_IDENTIFICATION
+% added LC_PAPER, LC_MEASUREMENT, LC_TELEPHONE, LC_ADDRESS
+% -- mckinstry@computer.org, 2000-07-03
+
+END LC_IDENTIFICATION
+
+LC_ADDRESS
+postal_fmt "<U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E>/
+<U0025><U0073><U0020><U0025><U0068><U0020><U0035><U0065><U0020><U0025><U0072><U0025><U004E>/
+<U0025><U0043><U0025><U007A><U0020><U0025><U0054><U0025><U004E><U0025><U0063><U0025><U004E>"
+% FIXME country_name for Antilles in Paplamento
+% FIXME country_post MAIL_CEPTCODE for Nederland Antilles, AN?
+% AW
+country_ab2 "<U0041><U0057>"
+% ABW
+country_ab3 "<U0041><U0042><U0057>"
+country_num 533
+country_isbn ""
+country_car ""
+% lang_ab
+% pap
+lang_term "<U0070><U0061><U0070>"
+% pap
+lang_lib "<U0070><U0061><U0070>"
+END LC_ADDRESS
+
+LC_CTYPE
+copy "en_DK"
+END LC_CTYPE
+
+LC_COLLATE
+copy "en_DK"
+END LC_COLLATE
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U006A><U004A><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+END LC_MESSAGES
+
+
+LC_MONETARY
+int_curr_symbol "<U0041><U004E><U0047><U0020>"
+currency_symbol "<U0066>"
+mon_decimal_point "<U002C>"
+mon_thousands_sep "<U0020>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 1
+n_cs_precedes 1
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 2
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "<U002C>"
+thousands_sep ""
+grouping 0;0
+END LC_NUMERIC
+
+LC_TIME
+abday "<U0064><U006F>";"<U006C><U0075>";"<U006D><U0061>";/
+ "<U0077><U0065>";"<U0072><U0061>";"<U0062><U0069>";/
+ "<U0073><U0061>"
+day "<U0044><U006A><U0061><U0064><U006F><U006D><U0069><U006E><U0067><U006F>";/
+ "<U0044><U006A><U0061><U006C><U0075><U006E><U0061>";/
+ "<U0044><U006A><U0061><U006D><U0061><U0072><U0073>";/
+ "<U0044><U006A><U0061><U0077><U0065><U0062><U0073>";/
+ "<U0044><U006A><U0061><U0072><U0061><U0073><U006F><U006E>";/
+ "<U0044><U006A><U0061><U0062><U0069><U0065><U0072><U006E><U0065>";/
+ "<U0044><U006A><U0061><U0073><U0061><U0062><U0072><U0061>"
+abmon "<U0059><U0061><U006E>";"<U0046><U0065><U0062>";/
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0065><U0069>";"<U0059><U00FC><U006E>";/
+ "<U0059><U00FC><U006C>";"<U004F><U0075><U0067>";/
+ "<U0053><U00E8><U0070>";"<U004F><U006B><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0073>"
+mon "<U0059><U0061><U006E><U00FC><U0061><U0072><U0069>";/
+ "<U0046><U0065><U0062><U0072><U00FC><U0061><U0072><U0069>";/
+ "<U004D><U0061><U0072><U0074>";/
+ "<U0041><U0070><U0072><U0065><U006C>";/
+ "<U004D><U0065><U0069>";/
+ "<U0059><U00FC><U006E><U0069>";/
+ "<U0059><U00FC><U006C><U0069>";/
+ "<U004F><U0075><U0067><U00F9><U0073><U0074><U00F9><U0073>";/
+ "<U0053><U00E8><U0070><U0074><U00E8><U006D><U0062><U0065><U0072>";/
+ "<U004F><U006B><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U00E8><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0073><U00E8><U006D><U0062><U0065><U0072>"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+d_fmt "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0079>"
+t_fmt "<U0025><U0054>"
+am_pm "";""
+t_fmt_ampm ""
+END LC_TIME
+
+LC_NUMERIC
+decimal_point "<U002C>"
+thousands_sep ""
+grouping 0;0
+END LC_NUMERIC
+
+% Metric Measurement system (ISO 1000)
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+% Default paper: A4
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025><U006C>"
+% FIXME FIND tel_dom_fmt
+% 00
+int_select "<U0030><U0030>"
+% 599
+int_prefix "<U0035><U0039><U0039>"
+END LC_TELEPHONE
+
+LC_NAME
+% Todo
+copy "en_DK"
+END LC_NAME
diff --git a/libc/localedata/locales/pap_CW b/libc/localedata/locales/pap_CW
new file mode 100644
index 000000000..dc10c836b
--- /dev/null
+++ b/libc/localedata/locales/pap_CW
@@ -0,0 +1,172 @@
+comment_char %
+escape_char /
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is derived from pap_AN ver0.2 (after AN was deprecated in ISO-3166)
+% revision "0.2" date "2000-11-15"
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title "Papiamento language for Curaçao"
+source "information from native speaker"
+address ""
+contact "Pablo Saratxaga"
+email "pablo@mandrakesoft.com"
+tel ""
+fax ""
+language "pap"
+territory "CW"
+revision "1.0"
+date "2013-09-27"
+
+category i18n:2000;LC_IDENTIFICATION
+category i18n:2000;LC_COLLATE
+category i18n:2000;LC_CTYPE
+category i18n:2000;LC_MESSAGES
+category i18n:2000;LC_MONETARY
+category i18n:2000;LC_NUMERIC
+category i18n:2000;LC_TIME
+category i18n:2000;LC_PAPER
+category i18n:2000;LC_MEASUREMENT
+category i18n:2000;LC_TELEPHONE
+category i18n:2000;LC_ADDRESS
+
+% ISO/IEC 14652: Converted comments to LC_IDENTIFICATION
+% added LC_PAPER, LC_MEASUREMENT, LC_TELEPHONE, LC_ADDRESS
+% -- mckinstry@computer.org, 2000-07-03
+
+END LC_IDENTIFICATION
+
+LC_ADDRESS
+postal_fmt "<U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E>/
+<U0025><U0073><U0020><U0025><U0068><U0020><U0035><U0065><U0020><U0025><U0072><U0025><U004E>/
+<U0025><U0043><U0025><U007A><U0020><U0025><U0054><U0025><U004E><U0025><U0063><U0025><U004E>"
+% FIXME country_name for Antilles in Paplamento
+% FIXME country_post MAIL_CEPTCODE for Nederland Antilles, AN?
+% CW
+country_ab2 "<U0043><U0057>"
+% CUW
+country_ab3 "<U0043><U0055><U0057>"
+country_num 531
+country_car ""
+country_isbn ""
+% lang_ab
+% pap
+lang_term "<U0070><U0061><U0070>"
+% pap
+lang_lib "<U0070><U0061><U0070>"
+END LC_ADDRESS
+
+LC_CTYPE
+copy "en_DK"
+END LC_CTYPE
+
+LC_COLLATE
+copy "en_DK"
+END LC_COLLATE
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U006A><U004A><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+END LC_MESSAGES
+
+
+LC_MONETARY
+int_curr_symbol "<U0041><U004E><U0047><U0020>"
+currency_symbol "<U0066>"
+mon_decimal_point "<U002C>"
+mon_thousands_sep "<U0020>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 1
+p_sep_by_space 1
+n_cs_precedes 1
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 2
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "<U002C>"
+thousands_sep ""
+grouping 0;0
+END LC_NUMERIC
+
+LC_TIME
+abday "<U0064><U006F>";"<U006C><U0075>";"<U006D><U0061>";/
+ "<U0077><U0065>";"<U0072><U0061>";"<U0062><U0069>";/
+ "<U0073><U0061>"
+day "<U0044><U006A><U0061><U0064><U006F><U006D><U0069><U006E><U0067><U006F>";/
+ "<U0044><U006A><U0061><U006C><U0075><U006E><U0061>";/
+ "<U0044><U006A><U0061><U006D><U0061><U0072><U0073>";/
+ "<U0044><U006A><U0061><U0077><U0065><U0062><U0073>";/
+ "<U0044><U006A><U0061><U0072><U0061><U0073><U006F><U006E>";/
+ "<U0044><U006A><U0061><U0062><U0069><U0065><U0072><U006E><U0065>";/
+ "<U0044><U006A><U0061><U0073><U0061><U0062><U0072><U0061>"
+abmon "<U0059><U0061><U006E>";"<U0046><U0065><U0062>";/
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0065><U0069>";"<U0059><U00FC><U006E>";/
+ "<U0059><U00FC><U006C>";"<U004F><U0075><U0067>";/
+ "<U0053><U00E8><U0070>";"<U004F><U006B><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0073>"
+mon "<U0059><U0061><U006E><U00FC><U0061><U0072><U0069>";/
+ "<U0046><U0065><U0062><U0072><U00FC><U0061><U0072><U0069>";/
+ "<U004D><U0061><U0072><U0074>";/
+ "<U0041><U0070><U0072><U0065><U006C>";/
+ "<U004D><U0065><U0069>";/
+ "<U0059><U00FC><U006E><U0069>";/
+ "<U0059><U00FC><U006C><U0069>";/
+ "<U004F><U0075><U0067><U00F9><U0073><U0074><U00F9><U0073>";/
+ "<U0053><U00E8><U0070><U0074><U00E8><U006D><U0062><U0065><U0072>";/
+ "<U004F><U006B><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U00E8><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0073><U00E8><U006D><U0062><U0065><U0072>"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+d_fmt "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0079>"
+t_fmt "<U0025><U0054>"
+am_pm "";""
+t_fmt_ampm ""
+END LC_TIME
+
+LC_NUMERIC
+decimal_point "<U002C>"
+thousands_sep ""
+grouping 0;0
+END LC_NUMERIC
+
+% Metric Measurement system (ISO 1000)
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+% Default paper: A4
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025><U006C>"
+% FIXME FIND tel_dom_fmt
+% 00
+int_select "<U0030><U0030>"
+% 599
+int_prefix "<U0035><U0039><U0039>"
+END LC_TELEPHONE
+
+LC_NAME
+% Todo
+copy "en_DK"
+END LC_NAME
diff --git a/libc/localedata/locales/quz_PE b/libc/localedata/locales/quz_PE
index 85fde3e1a..efc5a0077 100644
--- a/libc/localedata/locales/quz_PE
+++ b/libc/localedata/locales/quz_PE
@@ -159,9 +159,18 @@ LC_NAME
copy "es_PE"
END LC_NAME
-% TO DO - adjust for Quechua specific lang-info for Peru
LC_ADDRESS
-copy "es_PE"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0050><U0045>"
+country_ab3 "<U0050><U0045><U0052>"
+country_num 604
+% PE
+country_car "<U0050><U0045>"
+
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/rw_RW b/libc/localedata/locales/rw_RW
index 437df4bb2..e4e6c8765 100644
--- a/libc/localedata/locales/rw_RW
+++ b/libc/localedata/locales/rw_RW
@@ -135,6 +135,8 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_name "<U0052><U0077><U0061><U006E><U0064><U0061>"
country_ab2 "<U0052><U0057>"
country_ab3 "<U0052><U0057><U0041>"
+% RWA
+country_car "<U0052><U0057><U0041>"
lang_name "<U004B><U0069><U006E><U0079><U0061><U0072><U0077><U0061><U006E><U0064><U0061>"
lang_ab "<U0072><U0077>"
lang_term "<U006B><U0069><U006E>"
diff --git a/libc/localedata/locales/sat_IN b/libc/localedata/locales/sat_IN
index a77de633b..57fb383f1 100644
--- a/libc/localedata/locales/sat_IN
+++ b/libc/localedata/locales/sat_IN
@@ -170,7 +170,16 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/sc_IT b/libc/localedata/locales/sc_IT
index f0b99d292..8ff00a02e 100644
--- a/libc/localedata/locales/sc_IT
+++ b/libc/localedata/locales/sc_IT
@@ -132,5 +132,15 @@ copy "it_IT"
END LC_NAME
LC_ADDRESS
-copy "it_IT"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0049><U0054>"
+country_ab3 "<U0049><U0054><U0041>"
+country_num 380
+% I
+country_car "<U0049>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/sd_IN b/libc/localedata/locales/sd_IN
index 77d6af26a..cc0de5b54 100644
--- a/libc/localedata/locales/sd_IN
+++ b/libc/localedata/locales/sd_IN
@@ -192,6 +192,8 @@ postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073><U0025><U00
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/sd_IN@devanagari b/libc/localedata/locales/sd_IN@devanagari
index e54fc92e2..e275eb627 100644
--- a/libc/localedata/locales/sd_IN@devanagari
+++ b/libc/localedata/locales/sd_IN@devanagari
@@ -189,10 +189,11 @@ LC_ADDRESS
% generated by IBM Basic CountryPack Transformer.
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
-
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/shs_CA b/libc/localedata/locales/shs_CA
index b3d0bcfba..d90b28c27 100644
--- a/libc/localedata/locales/shs_CA
+++ b/libc/localedata/locales/shs_CA
@@ -154,6 +154,8 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_ab2 "<U0043><U0041>"
country_ab3 "<U0043><U0041><U004E>"
country_num 124
+% CDN
+country_car "<U0043><U0044><U004E>"
lang_name "<U0053><U0065><U0063><U0077><U0065><U0070><U0065><U006D><U0063><U0074><U0073><U0069><U006E>"
lang_term "<U0073><U0068><U0073>"
lang_lib "<U0073><U0068><U0073>"
diff --git a/libc/localedata/locales/si_LK b/libc/localedata/locales/si_LK
index f26f653ab..f600ab710 100644
--- a/libc/localedata/locales/si_LK
+++ b/libc/localedata/locales/si_LK
@@ -192,14 +192,14 @@ END LC_NAME
LC_ADDRESS
-% This is the ISO_IEC TR14652 Locale definition for the LC_ADDRESS category
-%
+
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073><U0025><U0062><U0025><U0065><U0025><U0072>"
country_ab2 "<U004C><U004B>"
country_ab3 "<U004C><U004B><U0041>"
country_num 144
-
+% CL
+country_car "<U0043><U004C>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/sid_ET b/libc/localedata/locales/sid_ET
index 8ce3234a5..3de83901b 100644
--- a/libc/localedata/locales/sid_ET
+++ b/libc/localedata/locales/sid_ET
@@ -110,7 +110,8 @@ country_post "<U0045><U0054><U0048>"
country_ab2 "<U0045><U0054>"
country_ab3 "<U0045><U0054><U0048>"
country_num 231 % 210 found in at least one ISO 3166 doc
-% country_car unknown
+% ETH
+country_car "<U0045><U0054><U0048>"
% country_isbn unknown, Need ISO 2108
lang_name "<U0053><U0069><U0064><U0061><U0061><U006D><U0075><U0020><U0041><U0066><U006F>"
lang_term "<U0073><U0069><U0064>"
diff --git a/libc/localedata/locales/sq_MK b/libc/localedata/locales/sq_MK
index eb3c7eb64..caa250acf 100644
--- a/libc/localedata/locales/sq_MK
+++ b/libc/localedata/locales/sq_MK
@@ -88,7 +88,23 @@ END LC_NAME
LC_ADDRESS
-copy "mk_MK"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_name "<U004d><U0061><U0063><U0065><U0064>/
+<U006f><U006e><U0069><U0061>"
+country_post "<U004d><U004b>"
+country_ab2 "<U004d><U004b>"
+country_ab3 "<U004d><U004b><U0044>"
+country_car "<U004d><U004b>"
+country_num 807
+country_isbn "9989"
+% lang_name ""
+% lang_ab ""
+% lang_term ""
+% lang_lib ""
END LC_ADDRESS
@@ -98,8 +114,6 @@ END LC_TELEPHONE
LC_MEASUREMENT
-% This is the ISO_IEC TR14652 Locale definition for the
-%
+% metric
measurement 1
-
END LC_MEASUREMENT
diff --git a/libc/localedata/locales/sw_KE b/libc/localedata/locales/sw_KE
index 61dd49daf..0037161ba 100644
--- a/libc/localedata/locales/sw_KE
+++ b/libc/localedata/locales/sw_KE
@@ -152,6 +152,8 @@ country_ab2 "<U004B><U0045>"
% KEN
country_ab3 "<U004B><U0045><U004E>"
country_num 404
+% EAK
+country_car "<U0045><U0041><U004B>"
% Kiswahili
lang_name "<U004B><U0069><U0073><U0077><U0061><U0068><U0069><U006C><U0069>"
% sw
diff --git a/libc/localedata/locales/sw_TZ b/libc/localedata/locales/sw_TZ
index 71fd8cdab..05a48731b 100644
--- a/libc/localedata/locales/sw_TZ
+++ b/libc/localedata/locales/sw_TZ
@@ -103,6 +103,8 @@ country_ab2 "<U0054><U005A>"
% TZA
country_ab3 "<U0054><U005A><U0041>"
country_num 834
+% EAT
+country_car "<U0045><U0041><U0054>"
% Kiswahili
lang_name "<U004B><U0069><U0073><U0077><U0061><U0068><U0069><U006C><U0069>"
% sw
diff --git a/libc/localedata/locales/szl_PL b/libc/localedata/locales/szl_PL
index 959611a2d..3147ede4c 100644
--- a/libc/localedata/locales/szl_PL
+++ b/libc/localedata/locales/szl_PL
@@ -207,5 +207,15 @@ copy "pl_PL"
END LC_NAME
LC_ADDRESS
-copy "pl_PL"
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0050><U004C>"
+country_ab3 "<U0050><U004F><U004C>"
+country_num 616
+% PL
+country_car "<U0050><U004C>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/ta_LK b/libc/localedata/locales/ta_LK
index 80b2f69a7..ae6f5d5c8 100644
--- a/libc/localedata/locales/ta_LK
+++ b/libc/localedata/locales/ta_LK
@@ -81,5 +81,12 @@ copy "ta_IN"
END LC_NAME
LC_ADDRESS
-copy "si_LK"
+
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073><U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U004C><U004B>"
+country_ab3 "<U004C><U004B><U0041>"
+country_num 144
+% CL
+country_car "<U0043><U004C>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/ti_ER b/libc/localedata/locales/ti_ER
index cc2c4ebb9..103244f4c 100644
--- a/libc/localedata/locales/ti_ER
+++ b/libc/localedata/locales/ti_ER
@@ -150,7 +150,8 @@ country_post "<U0045><U0052><U0049>"
country_ab2 "<U0045><U0052>"
country_ab3 "<U0045><U0052><U0049>"
country_num 232
-% country_car unknown
+% ER
+country_car "<U0045><U0052>"
% country_isbn unknown, Need ISO 2108
lang_name "<U1275><U130D><U122D><U129B>"
lang_ab "<U0074><U0069>"
diff --git a/libc/localedata/locales/tig_ER b/libc/localedata/locales/tig_ER
index 80d0afb26..417ab7278 100644
--- a/libc/localedata/locales/tig_ER
+++ b/libc/localedata/locales/tig_ER
@@ -120,7 +120,8 @@ country_post "<U0045><U0052><U0049>"
country_ab2 "<U0045><U0052>"
country_ab3 "<U0045><U0052><U0049>"
country_num 232
-% country_car unknown
+% ER
+country_car "<U0045><U0052>"
% country_isbn unknown, Need ISO 2108
lang_name "<U1275><U130D><U1228>"
lang_ab ""
diff --git a/libc/localedata/locales/tl_PH b/libc/localedata/locales/tl_PH
index de6ad15ef..27993e8d4 100644
--- a/libc/localedata/locales/tl_PH
+++ b/libc/localedata/locales/tl_PH
@@ -158,7 +158,6 @@ copy "en_US"
END LC_NAME
LC_ADDRESS
-% FIXME
postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0068>/
<U0020><U0025><U0073><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
diff --git a/libc/localedata/locales/ts_ZA b/libc/localedata/locales/ts_ZA
index 740bbae10..010cba2d3 100644
--- a/libc/localedata/locales/ts_ZA
+++ b/libc/localedata/locales/ts_ZA
@@ -281,7 +281,5 @@ postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
country_num 710
country_ab2 "<U005A><U0041>"
country_ab3 "<U005A><U0041><U0046>"
-% ZA
-country_car "<U005A><U0041>"
END LC_ADDRESS
diff --git a/libc/localedata/locales/unm_US b/libc/localedata/locales/unm_US
index 9734e25b3..ddd049363 100644
--- a/libc/localedata/locales/unm_US
+++ b/libc/localedata/locales/unm_US
@@ -138,7 +138,23 @@ name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
END LC_NAME
LC_ADDRESS
-copy "en_US"
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0068>/
+<U0020><U0025><U0073><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0054><U002C><U0020><U0025><U0053><U0020><U0025><U007A><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_name "<U0055><U0053><U0041>"
+country_post "<U0055><U0053><U0041>"
+country_ab2 "<U0055><U0053>"
+country_ab3 "<U0055><U0053><U0041>"
+country_num 840
+% USA
+country_car "<U0055><U0053><U0041>"
+country_isbn 0
+% lang_name ""
+% lang_ab ""
+% lang_term ""
+% lang_lib ""
END LC_ADDRESS
LC_TELEPHONE
diff --git a/libc/localedata/locales/ur_IN b/libc/localedata/locales/ur_IN
index d14946f29..366ad5ff4 100644
--- a/libc/localedata/locales/ur_IN
+++ b/libc/localedata/locales/ur_IN
@@ -170,7 +170,15 @@ END LC_NAME
LC_ADDRESS
-copy "hi_IN"
+postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
+<U0025><U0062><U0025><U0065><U0025><U0072>"
+
+country_ab2 "<U0049><U004E>"
+country_ab3 "<U0049><U004E><U0044>"
+country_num 356
+% IND
+country_car "<U0049><U004E><U0044>"
+
END LC_ADDRESS
diff --git a/libc/localedata/locales/wa_BE b/libc/localedata/locales/wa_BE
index b05142408..d0d4dbff2 100644
--- a/libc/localedata/locales/wa_BE
+++ b/libc/localedata/locales/wa_BE
@@ -43,7 +43,8 @@ country_ab2 "BE"
country_ab3 "BEL"
country_num 56
country_isbn "2"
-country_car "B"
+% B
+country_car "<U0042>"
lang_name "<U0057><U0061><U006C><U006F><U006E>"
lang_ab "wa"
lang_term "wln"
diff --git a/libc/localedata/locales/yi_US b/libc/localedata/locales/yi_US
index 134eeed9a..586b12db9 100644
--- a/libc/localedata/locales/yi_US
+++ b/libc/localedata/locales/yi_US
@@ -47,7 +47,8 @@ country_post "USA"
country_ab2 "US"
country_ab3 "USA"
country_num 840
-country_car "USA"
+% USA
+country_car "<U0055><U0053><U0041>"
% FIXME Check which isbn for Yiddish in USA
country_isbn "0"
lang_name "<U05D9><U05D9><U05B4><U05D3><U05D9><U05E9>"
diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile
index be81dd3b8..9ca8edf67 100644
--- a/libc/malloc/Makefile
+++ b/libc/malloc/Makefile
@@ -27,7 +27,9 @@ all:
dist-headers := malloc.h
headers := $(dist-headers) obstack.h mcheck.h
tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
- tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 tst-malloc-usable
+ tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 \
+ tst-malloc-usable tst-realloc tst-posix_memalign \
+ tst-pvalloc tst-memalign
test-srcs = tst-mtrace
routines = malloc morecore mcheck mtrace obstack
diff --git a/libc/malloc/arena.c b/libc/malloc/arena.c
index 12a48ad7b..d81ed0d68 100644
--- a/libc/malloc/arena.c
+++ b/libc/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
@@ -736,6 +740,7 @@ _int_new_arena(size_t size)
top(a) = (mchunkptr)ptr;
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+ LIBC_PROBE (memory_arena_new, 2, a, size);
tsd_setspecific(arena_key, (void *)a);
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
@@ -774,6 +779,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -810,9 +816,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -891,6 +899,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -903,6 +912,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
@@ -926,6 +936,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/libc/malloc/hooks.c b/libc/malloc/hooks.c
index 8c2584633..3f663bb6b 100644
--- a/libc/malloc/hooks.c
+++ b/libc/malloc/hooks.c
@@ -361,10 +361,13 @@ memalign_check(size_t alignment, size_t bytes, const void *caller)
if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes, NULL);
if (alignment < MINSIZE) alignment = MINSIZE;
- if (bytes+1 == 0) {
- __set_errno (ENOMEM);
- return NULL;
- }
+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - alignment - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
(void)mutex_lock(&main_arena.mutex);
mem = (top_check() >= 0) ? _int_memalign(&main_arena, alignment, bytes+1) :
NULL;
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index dd295f522..1a18c3f5f 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -1878,6 +1878,8 @@ static int perturb_byte;
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+#include <stap-probe.h>
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -2214,15 +2216,6 @@ static void do_check_malloc_state(mstate av)
/* top chunk is OK */
check_chunk(av, av->top);
- /* sanity checks for statistics */
-
- assert(mp_.n_mmaps <= mp_.max_n_mmaps);
-
- assert((unsigned long)(av->system_mem) <=
- (unsigned long)(av->max_system_mem));
-
- assert((unsigned long)(mp_.mmapped_mem) <=
- (unsigned long)(mp_.max_mmapped_mem));
}
#endif
@@ -2446,8 +2439,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2745,6 +2740,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
@@ -2854,6 +2851,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2894,6 +2892,8 @@ __libc_free(void* mem)
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -2973,6 +2973,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
@@ -2986,6 +2987,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3015,11 +3017,19 @@ __libc_memalign(size_t alignment, size_t bytes)
/* Otherwise, ensure that it is at least a minimum chunk size */
if (alignment < MINSIZE) alignment = MINSIZE;
+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - alignment - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
arena_get(ar_ptr, bytes + alignment + MINSIZE);
if(!ar_ptr)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3046,6 +3056,13 @@ __libc_valloc(size_t bytes)
size_t pagesz = GLRO(dl_pagesize);
+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - pagesz - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
@@ -3056,6 +3073,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3082,6 +3100,13 @@ __libc_pvalloc(size_t bytes)
size_t page_mask = GLRO(dl_pagesize) - 1;
size_t rounded_bytes = (bytes + page_mask) & ~(page_mask);
+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - 2*pagesz - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
@@ -3090,6 +3115,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3166,6 +3192,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
@@ -4674,21 +4701,29 @@ int __libc_mallopt(int param_number, int value)
/* Ensure initialization/consolidation */
malloc_consolidate(av);
+ LIBC_PROBE (memory_mallopt, 2, param_number, value);
+
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast(value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4699,33 +4734,45 @@ int __libc_mallopt(int param_number, int value)
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.n_mmaps_max, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
diff --git a/libc/malloc/tst-memalign.c b/libc/malloc/tst-memalign.c
new file mode 100644
index 000000000..1c5975248
--- /dev/null
+++ b/libc/malloc/tst-memalign.c
@@ -0,0 +1,99 @@
+/* Test for memalign.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+static int
+do_test (void)
+{
+ void *p;
+ unsigned long pagesize = getpagesize ();
+ unsigned long ptrval;
+ int save;
+
+ errno = 0;
+
+ /* An attempt to allocate a huge value should return NULL and set
+ errno to ENOMEM. */
+ p = memalign (sizeof (void *), -1);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("memalign (sizeof (void *), -1) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("memalign (sizeof (void *), -1) errno is not set correctly");
+
+ free (p);
+
+ errno = 0;
+
+ /* Test to expose integer overflow in malloc internals from BZ #15857. */
+ p = memalign (pagesize, -pagesize);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("memalign (pagesize, -pagesize) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("memalign (pagesize, -pagesize) errno is not set correctly");
+
+ free (p);
+
+ /* A zero-sized allocation should succeed with glibc, returning a
+ non-NULL value. */
+ p = memalign (sizeof (void *), 0);
+
+ if (p == NULL)
+ merror ("memalign (sizeof (void *), 0) failed.");
+
+ free (p);
+
+ /* Check the alignment of the returned pointer is correct. */
+ p = memalign (0x100, 10);
+
+ if (p == NULL)
+ merror ("memalign (0x100, 10) failed.");
+
+ ptrval = (unsigned long) p;
+
+ if ((ptrval & 0xff) != 0)
+ merror ("pointer is not aligned to 0x100");
+
+ free (p);
+
+ return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/malloc/tst-posix_memalign.c b/libc/malloc/tst-posix_memalign.c
new file mode 100644
index 000000000..27c0dd2bd
--- /dev/null
+++ b/libc/malloc/tst-posix_memalign.c
@@ -0,0 +1,108 @@
+/* Test for posix_memalign.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+static int
+do_test (void)
+{
+ void *p;
+ int ret;
+ unsigned long pagesize = getpagesize ();
+ unsigned long ptrval;
+
+ p = NULL;
+
+ /* An attempt to allocate a huge value should return ENOMEM and
+ p should remain NULL. */
+ ret = posix_memalign (&p, sizeof (void *), -1);
+
+ if (ret != ENOMEM)
+ merror ("posix_memalign (&p, sizeof (void *), -1) succeeded.");
+
+ if (ret == ENOMEM && p != NULL)
+ merror ("returned an error but pointer was modified");
+
+ free (p);
+
+ p = NULL;
+
+ /* Test to expose integer overflow in malloc internals from BZ #15857. */
+ ret = posix_memalign (&p, pagesize, -pagesize);
+
+ if (ret != ENOMEM)
+ merror ("posix_memalign (&p, pagesize, -pagesize) succeeded.");
+
+ free (p);
+
+ p = NULL;
+
+ /* A zero-sized allocation should succeed with glibc, returning zero
+ and setting p to a non-NULL value. */
+ ret = posix_memalign (&p, sizeof (void *), 0);
+
+ if (ret != 0 || p == NULL)
+ merror ("posix_memalign (&p, sizeof (void *), 0) failed.");
+
+ free (p);
+
+ ret = posix_memalign (&p, 0x300, 10);
+
+ if (ret != EINVAL)
+ merror ("posix_memalign (&p, 0x300, 10) succeeded.");
+
+ ret = posix_memalign (&p, 0, 10);
+
+ if (ret != EINVAL)
+ merror ("posix_memalign (&p, 0, 10) succeeded.");
+
+ p = NULL;
+
+ ret = posix_memalign (&p, 0x100, 10);
+
+ if (ret != 0)
+ merror ("posix_memalign (&p, 0x100, 10) failed.");
+
+ if (ret == 0 && p == NULL)
+ merror ("returned success but pointer is NULL");
+
+ ptrval = (unsigned long) p;
+
+ if (ret == 0 && (ptrval & 0xff) != 0)
+ merror ("pointer is not aligned to 0x100");
+
+ free (p);
+
+ return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/malloc/tst-pvalloc.c b/libc/malloc/tst-pvalloc.c
new file mode 100644
index 000000000..1c8129492
--- /dev/null
+++ b/libc/malloc/tst-pvalloc.c
@@ -0,0 +1,99 @@
+/* Test for pvalloc.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+static int
+do_test (void)
+{
+ void *p;
+ unsigned long pagesize = getpagesize ();
+ unsigned long ptrval;
+ int save;
+
+ errno = 0;
+
+ /* An attempt to allocate a huge value should return NULL and set
+ errno to ENOMEM. */
+ p = pvalloc (-1);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("pvalloc (-1) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("pvalloc (-1) errno is not set correctly");
+
+ free (p);
+
+ errno = 0;
+
+ /* Test to expose integer overflow in malloc internals from BZ #15855. */
+ p = pvalloc (-pagesize);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("pvalloc (-pagesize) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("pvalloc (-pagesize) errno is not set correctly");
+
+ free (p);
+
+ /* A zero-sized allocation should succeed with glibc, returning a
+ non-NULL value. */
+ p = pvalloc (0);
+
+ if (p == NULL)
+ merror ("pvalloc (0) failed.");
+
+ free (p);
+
+ /* Check the alignment of the returned pointer is correct. */
+ p = pvalloc (32);
+
+ if (p == NULL)
+ merror ("pvalloc (32) failed.");
+
+ ptrval = (unsigned long) p;
+
+ if ((ptrval & (pagesize - 1)) != 0)
+ merror ("returned pointer is not page aligned.");
+
+ free (p);
+
+ return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/malloc/tst-realloc.c b/libc/malloc/tst-realloc.c
new file mode 100644
index 000000000..9d290d24c
--- /dev/null
+++ b/libc/malloc/tst-realloc.c
@@ -0,0 +1,146 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <string.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+static int
+do_test (void)
+{
+ void *p;
+ unsigned char *c;
+ int save, i, ok;
+
+ errno = 0;
+
+ /* realloc (NULL, ...) behaves similarly to malloc (C89). */
+ p = realloc (NULL, -1);
+ save = errno;
+
+ if (p != NULL)
+ merror ("realloc (NULL, -1) succeeded.");
+
+ /* errno should be set to ENOMEM on failure (POSIX). */
+ if (p == NULL && save != ENOMEM)
+ merror ("errno is not set correctly");
+
+ errno = 0;
+
+ /* realloc (NULL, ...) behaves similarly to malloc (C89). */
+ p = realloc (NULL, 10);
+ save = errno;
+
+ if (p == NULL)
+ merror ("realloc (NULL, 10) failed.");
+
+ /* errno should be clear on success (POSIX). */
+ if (p != NULL && save != 0)
+ merror ("errno is set but should not be");
+
+ free (p);
+
+ p = calloc (20, 1);
+ if (p == NULL)
+ merror ("calloc (20, 1) failed.");
+
+ /* Check increasing size preserves contents (C89). */
+ p = realloc (p, 200);
+ if (p == NULL)
+ merror ("realloc (p, 200) failed.");
+
+ c = p;
+ ok = 1;
+
+ for (i = 0; i < 20; i++)
+ {
+ if (c[i] != 0)
+ ok = 0;
+ }
+
+ if (ok == 0)
+ merror ("first 20 bytes were not cleared");
+
+ free (p);
+
+ p = realloc (NULL, 100);
+ if (p == NULL)
+ merror ("realloc (NULL, 100) failed.");
+
+ memset (p, 0xff, 100);
+
+ /* Check decreasing size preserves contents (C89). */
+ p = realloc (p, 16);
+ if (p == NULL)
+ merror ("realloc (p, 16) failed.");
+
+ c = p;
+ ok = 1;
+
+ for (i = 0; i < 16; i++)
+ {
+ if (c[i] != 0xff)
+ ok = 0;
+ }
+
+ if (ok == 0)
+ merror ("first 16 bytes were not correct");
+
+ /* Check failed realloc leaves original untouched (C89). */
+ c = realloc (p, -1);
+ if (c != NULL)
+ merror ("realloc (p, -1) succeeded.");
+
+ c = p;
+ ok = 1;
+
+ for (i = 0; i < 16; i++)
+ {
+ if (c[i] != 0xff)
+ ok = 0;
+ }
+
+ if (ok == 0)
+ merror ("first 16 bytes were not correct after failed realloc");
+
+ /* realloc (p, 0) frees p (C89) and returns NULL (glibc). */
+ p = realloc (p, 0);
+ if (p != NULL)
+ merror ("realloc (p, 0) returned non-NULL.");
+
+ /* realloc (NULL, 0) acts like malloc (0) (glibc). */
+ p = realloc (NULL, 0);
+ if (p == NULL)
+ merror ("realloc (NULL, 0) returned NULL.");
+
+ free (p);
+
+ return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/malloc/tst-valloc.c b/libc/malloc/tst-valloc.c
index 643a0dda4..4fd0dbb96 100644
--- a/libc/malloc/tst-valloc.c
+++ b/libc/malloc/tst-valloc.c
@@ -1,23 +1,99 @@
-/* Test case by Stephen Tweedie <sct@redhat.com>. */
-#include <unistd.h>
-#include <stdio.h>
+/* Test for valloc.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
-int
-main (void)
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+static int
+do_test (void)
{
- char *p;
- int pagesize = getpagesize ();
- int i;
+ void *p;
+ unsigned long pagesize = getpagesize ();
+ unsigned long ptrval;
+ int save;
+
+ errno = 0;
+
+ /* An attempt to allocate a huge value should return NULL and set
+ errno to ENOMEM. */
+ p = valloc (-1);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("valloc (-1) succeeded.");
- p = valloc (pagesize);
- i = (long int) p;
+ if (p == NULL && save != ENOMEM)
+ merror ("valloc (-1) errno is not set correctly");
- if ((i & (pagesize-1)) != 0)
- {
- fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
- exit (1);
- }
+ free (p);
- return 0;
+ errno = 0;
+
+ /* Test to expose integer overflow in malloc internals from BZ #15856. */
+ p = valloc (-pagesize);
+
+ save = errno;
+
+ if (p != NULL)
+ merror ("valloc (-pagesize) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("valloc (-pagesize) errno is not set correctly");
+
+ free (p);
+
+ /* A zero-sized allocation should succeed with glibc, returning a
+ non-NULL value. */
+ p = valloc (0);
+
+ if (p == NULL)
+ merror ("valloc (0) failed.");
+
+ free (p);
+
+ /* Check the alignment of the returned pointer is correct. */
+ p = valloc (32);
+
+ if (p == NULL)
+ merror ("valloc (32) failed.");
+
+ ptrval = (unsigned long) p;
+
+ if ((ptrval & (pagesize - 1)) != 0)
+ merror ("returned pointer is not page aligned.");
+
+ free (p);
+
+ return errors != 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/manual/Makefile b/libc/manual/Makefile
index 44c0fd4f6..7bb419aea 100644
--- a/libc/manual/Makefile
+++ b/libc/manual/Makefile
@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug threads)
+ users sysinfo conf crypt debug threads probes)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
diff --git a/libc/manual/arith.texi b/libc/manual/arith.texi
index 77056c3ea..85aa197a3 100644
--- a/libc/manual/arith.texi
+++ b/libc/manual/arith.texi
@@ -2455,7 +2455,8 @@ is provided mostly for compatibility with existing code; using
@Theglibc{} also provides @samp{_l} versions of these functions,
which take an additional argument, the locale to use in conversion.
-@xref{Parsing of Integers}.
+
+See also @ref{Parsing of Integers}.
@node System V Number Conversion
@section Old-fashioned System V number-to-string functions
diff --git a/libc/manual/freemanuals.texi b/libc/manual/freemanuals.texi
index a424e8aa3..9caf22017 100644
--- a/libc/manual/freemanuals.texi
+++ b/libc/manual/freemanuals.texi
@@ -1,4 +1,7 @@
-@appendix Free Software Needs Free Documentation
+@c freemanuals.texi - blurb for free documentation.
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
@cindex free documentation
The biggest deficiency in the free software community today is not in
diff --git a/libc/manual/install.texi b/libc/manual/install.texi
index 2ac0104ca..4ca7b1a1a 100644
--- a/libc/manual/install.texi
+++ b/libc/manual/install.texi
@@ -320,14 +320,11 @@ can dramatically improve performance with NIS+, and may help with DNS as
well.
One auxiliary program, @file{/usr/libexec/pt_chown}, is installed setuid
-@code{root}. This program is invoked by the @code{grantpt} function; it
-sets the permissions on a pseudoterminal so it can be used by the
-calling process. This means programs like @code{xterm} and
-@code{screen} do not have to be setuid to get a pty. (There may be
-other reasons why they need privileges.) If you are using a
-Linux kernel with the @code{devptsfs} or @code{devfs} filesystems
-providing pty slaves, you don't need this program; otherwise you do.
-The source for @file{pt_chown} is in @file{login/programs/pt_chown.c}.
+@code{root} if the @samp{--enable-pt_chown} configuration option is used.
+This program is invoked by the @code{grantpt} function; it sets the
+permissions on a pseudoterminal so it can be used by the calling process.
+If you are using a Linux kernel with the @code{devpts} filesystem enabled
+and mounted at @file{/dev/pts}, you don't need this program.
After installation you might want to configure the timezone and locale
installation of your system. @Theglibc{} comes with a locale
diff --git a/libc/manual/libc.texinfo b/libc/manual/libc.texinfo
index 4505d270b..96cd380ce 100644
--- a/libc/manual/libc.texinfo
+++ b/libc/manual/libc.texinfo
@@ -118,6 +118,7 @@ of @theglibc{}.
@include chapters.texi
@node Free Manuals, Copying, Contributors, Top
+@appendix Free Software Needs Free Documentation
@include freemanuals.texi
@node Copying, Documentation License, Free Manuals, Top
diff --git a/libc/manual/probes.texi b/libc/manual/probes.texi
new file mode 100644
index 000000000..5492bb79f
--- /dev/null
+++ b/libc/manual/probes.texi
@@ -0,0 +1,355 @@
+@node Internal Probes
+@c @node Internal Probes, , POSIX Threads, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
+In order to aid in debugging and monitoring internal behavior,
+@theglibc{} exposes nearly-zero-overhead SystemTap probes marked with
+the @code{libc} provider.
+
+These probes are not part of the @glibcadj{} stable ABI, and they are
+subject to change or removal across releases. Our only promise with
+regard to them is that, if we find a need to remove or modify the
+arguments of a probe, the modified probe will have a different name, so
+that program monitors relying on the old probe will not get unexpected
+arguments.
+
+@menu
+* Memory Allocation Probes:: Probes in the memory allocation subsystem
+* Mathematical Function Probes:: Probes in mathematical functions
+@end menu
+
+@node Memory Allocation Probes
+@section Memory Allocation Probes
+
+These probes are designed to signal relatively unusual situations within
+the virtual memory subsystem of @theglibc{}. The location and the
+availability of some probes depend on whether per-thread arenas are
+enabled (the default) or disabled at the time @theglibc{} is compiled.
+
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after the size of the main arena is decreased by
+calling @code{sbrk}. Argument @var{$arg1} is the size released by
+@code{sbrk} (the positive value, rather than the negative value passed
+to @code{sbrk}), and @var{$arg2} is the pointer that marks the end of
+the @code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered @emph{before} (unlike the other sbrk and heap
+probes) a heap is completely removed via @code{munmap}. Argument
+@var{$arg1} is a pointer to the heap, and @var{$arg2} is the size of the
+heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a trailing portion of an @code{mmap}ed
+heap is extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a trailing portion of an @code{mmap}ed
+heap is released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are triggered when the corresponding functions fail to
+obtain the requested amount of memory from the arena in use, before they
+call @code{arena_get_retry} to select an alternate arena in which to
+retry the allocation. Argument @var{$arg1} is the amount of memory
+requested by the user; in the @code{calloc} case, that is the total size
+computed from both function arguments. In the @code{realloc} case,
+@var{$arg2} is the pointer to the memory area being resized. In the
+@code{memalign} case, @var{$arg2} is the alignment to be used for the
+request, which may be stricter than the value passed to the
+@code{memalign} function.
+
+Note that the argument order does @emph{not} match that of the
+corresponding two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is triggered within @code{arena_get_retry} (the function
+called to select the alternate arena in which to retry an allocation
+that failed on the first attempt), before the selection of an alternate
+arena. This probe is redundant, but much easier to use when it's not
+important to determine which of the various memory allocation functions
+is failing to allocate on the first try. Argument @var{$arg1} is the
+same as in the function-specific probes, except for extra room for
+padding introduced by functions that have to ensure stricter alignment.
+Argument @var{$arg2} is the arena in which allocation failed.
+@end deftp
+
+@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered when @code{malloc} allocates and initializes an
+additional arena (not the main arena), but before the arena is assigned
+to the running thread or inserted into the internal linked list of
+arenas. The arena's @code{malloc_state} internal data structure is
+located at @var{$arg1}, within a newly-allocated heap big enough to hold
+at least @var{$arg2} bytes.
+@end deftp
+
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is triggered when @code{malloc} has just selected an existing
+arena to reuse, and (temporarily) reserved it for exclusive use.
+Argument @var{$arg1} is a pointer to the newly-selected arena, and
+@var{$arg2} is a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is triggered when @code{malloc} is about to wait for an arena
+to become available for reuse. Argument @var{$arg1} holds a pointer to
+the mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is triggered when @code{malloc} has chosen an arena that is
+in the free list for use by a thread, within the @code{get_free_list}
+function. This probe is only available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is triggered within @code{realloc}, as the arena of the
+current thread is changed to match that in which the given address was
+allocated. This probe is @emph{not} available when @code{malloc} is
+configured to use per-thread arenas. The argument @var{$arg1} holds a
+pointer to the newly-selected arena.
+@end deftp
+
+@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+This probe is triggered when function @code{mallopt} is called to change
+@code{malloc} internal configuration parameters, before any change to
+the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+the ones passed to the @code{mallopt} function.
+@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MXFAST}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, and @var{$arg2} is the previous value of this @code{malloc}
+parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggere shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_TOP_PAD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MMAP_THRESHOLD}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustment
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MMAP_MAX}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_CHECK_ACTION}. Argument
+@var{$arg1} is the requested value, and @var{$arg2} is the previous
+value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_PERTURB}. Argument
+@var{$arg1} is the requested value, and @var{$arg2} is the previous
+value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_ARENA_TEST}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter. This probe is only available when per-thread
+arenas are enabled.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_ARENA_MAX}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter. This probe is only available when per-thread
+arenas are enabled.
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is triggered when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
+
+@node Mathematical Function Probes
+@section Mathematical Function Probes
+
+Some mathematical functions fall back to multiple precision arithmetic for
+some inputs to get last bit precision for their return values. This multiple
+precision fallback is much slower than the default algorithms and may have a
+significant impact on application performance. The systemtap probe markers
+described in this section may help you determine if your application calls
+mathematical functions with inputs that may result in multiple-precision
+arithmetic.
+
+Unless explicitly mentioned otherwise, a precision of 1 implies 24 bits of
+precision in the mantissa of the multiple precision number. Hence, a precision
+level of 32 implies 768 bits of precision in the mantissa.
+
+@deftp Probe slowexp_p6 (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{exp} function is called with an input that
+results in multiple precision computation with precision 6. Argument
+@var{$arg1} is the input value and @var{$arg2} is the computed output.
+@end deftp
+
+@deftp Probe slowexp_p32 (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{exp} function is called with an input that
+results in multiple precision computation with precision 32. Argument
+@var{$arg1} is the input value and @var{$arg2} is the computed output.
+@end deftp
+
+@deftp Probe slowpow_p10 (double @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4})
+This probe is hit when the @code{pow} function is called with inputs that
+result in multiple precision computation with precision 10. Arguments
+@var{$arg1} and @var{$arg2} are the input values, @code{$arg3} is the value
+computed in the fast phase of the algorithm and @code{$arg4} is the final
+accurate value.
+@end deftp
+
+@deftp Probe slowpow_p32 (double @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4})
+This probe is hit when the @code{pow} function is called with an input that
+results in multiple precision computation with precision 32. Arguments
+@var{$arg1} and @var{$arg2} are the input values, @code{$arg3} is the value
+computed in the fast phase of the algorithm and @code{$arg4} is the final
+accurate value.
+@end deftp
+
+@deftp Probe slowlog (int @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{log} function is called with an input that
+results in multiple precision computation. Argument @var{$arg1} is the
+precision with which the computation succeeded. Argument @var{$arg2} is the
+input and @var{$arg3} is the computed output.
+@end deftp
+
+@deftp Probe slowlog_inexact (int @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{log} function is called with an input that
+results in multiple precision computation and none of the multiple precision
+computations result in an accurate result. Argument @var{$arg1} is the maximum
+precision with which computations were performed. Argument @var{$arg2} is the
+input and @var{$arg3} is the computed output.
+@end deftp
+
+@deftp Probe slowatan2 (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4})
+This probe is hit when the @code{atan2} function is called with an input that
+results in multiple precision computation. Argument @var{$arg1} is the
+precision with which computation succeeded. Arguments @var{$arg2} and
+@var{$arg3} are inputs to the @code{atan2} function and @var{$arg4} is the
+computed result.
+@end deftp
+
+@deftp Probe slowatan2_inexact (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4})
+This probe is hit when the @code{atan} function is called with an input that
+results in multiple precision computation and none of the multiple precision
+computations result in an accurate result. Argument @var{$arg1} is the maximum
+precision with which computations were performed. Arguments @var{$arg2} and
+@var{$arg3} are inputs to the @code{atan2} function and @var{$arg4} is the
+computed result.
+@end deftp
+
+@deftp Probe slowatan (int @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{atan} function is called with an input that
+results in multiple precision computation. Argument @var{$arg1} is the
+precision with which computation succeeded. Argument @var{$arg2} is the
+input to the @code{atan} function and @var{$arg3} is the computed result.
+@end deftp
+
+@deftp Probe slowatan_inexact (int @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{atan} function is called with an input that
+results in multiple precision computation and none of the multiple precision
+computations result in an accurate result. Argument @var{$arg1} is the maximum
+precision with which computations were performed. Argument @var{$arg2} is the
+input to the @code{atan} function and @var{$arg3} is the computed result.
+@end deftp
+
+@deftp Probe slowtan (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{tan} function is called with an input that
+results in multiple precision computation with precision 32. Argument
+@var{$arg1} is the input to the function and @var{$arg2} is the computed
+result.
+@end deftp
diff --git a/libc/manual/socket.texi b/libc/manual/socket.texi
index e187402ab..25c35c46b 100644
--- a/libc/manual/socket.texi
+++ b/libc/manual/socket.texi
@@ -1290,14 +1290,17 @@ pointer and the size of the buffer in the @var{buf} and @var{buflen}
parameters.
A pointer to the buffer, in which the result is stored, is available in
-@code{*@var{result}} after the function call successfully returned. If
-an error occurs or if no entry is found, the pointer @code{*@var{result}}
-is a null pointer. Success is signalled by a zero return value. If the
-function failed the return value is an error number. In addition to the
-errors defined for @code{gethostbyname} it can also be @code{ERANGE}.
-In this case the call should be repeated with a larger buffer.
-Additional error information is not stored in the global variable
-@code{h_errno} but instead in the object pointed to by @var{h_errnop}.
+@code{*@var{result}} after the function call successfully returned. The
+buffer passed as the @var{buf} parameter can be freed only once the caller
+has finished with the result hostent struct, or has copied it including all
+the other memory that it points to. If an error occurs or if no entry is
+found, the pointer @code{*@var{result}} is a null pointer. Success is
+signalled by a zero return value. If the function failed the return value
+is an error number. In addition to the errors defined for
+@code{gethostbyname} it can also be @code{ERANGE}. In this case the call
+should be repeated with a larger buffer. Additional error information is
+not stored in the global variable @code{h_errno} but instead in the object
+pointed to by @var{h_errnop}.
Here's a small example:
@smallexample
diff --git a/libc/manual/string.texi b/libc/manual/string.texi
index 2a164a952..1e45d9ddb 100644
--- a/libc/manual/string.texi
+++ b/libc/manual/string.texi
@@ -955,8 +955,8 @@ The @code{strncat} function could be implemented like this:
char *
strncat (char *to, const char *from, size_t size)
@{
- to[strlen (to) + size] = '\0';
- strncpy (to + strlen (to), from, size);
+ memcpy (to + strlen (to), from, strnlen (from, size));
+ to[strlen (to) + strnlen (from, size)] = '\0';
return to;
@}
@end group
@@ -982,8 +982,8 @@ wchar_t *
wcsncat (wchar_t *restrict wto, const wchar_t *restrict wfrom,
size_t size)
@{
- wto[wcslen (to) + size] = L'\0';
- wcsncpy (wto + wcslen (wto), wfrom, size);
+ memcpy (wto + wcslen (wto), wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t));
+ wto[wcslen (to) + wcsnlen (wfrom, size)] = '\0';
return wto;
@}
@end group
@@ -1370,7 +1370,7 @@ int
compare_elements (const void *v1, const void *v2)
@{
char * const *p1 = v1;
- char * const *p1 = v2;
+ char * const *p2 = v2;
return strcoll (*p1, *p2);
@}
diff --git a/libc/manual/threads.texi b/libc/manual/threads.texi
index a23ac261e..9a5ef6a98 100644
--- a/libc/manual/threads.texi
+++ b/libc/manual/threads.texi
@@ -1,5 +1,5 @@
@node POSIX Threads
-@c @node POSIX Threads, , Cryptographic Functions, Top
+@c @node POSIX Threads, Internal Probes, Cryptographic Functions, Top
@chapter POSIX Threads
@c %MENU% POSIX Threads
@cindex pthreads
@@ -69,7 +69,7 @@ function returns @math{0} on success and a non-zero error code on
failure.
@end deftypefun
-@deftypefun int pthread_getattr_default_np (pthread_attr_t *@var{attr})
+@deftypefun int pthread_setattr_default_np (pthread_attr_t *@var{attr})
Set the default attribute values to match the values in @var{attr}. The
function returns @math{0} on success and a non-zero error code on failure.
The following error codes are defined for this function:
diff --git a/libc/math/Makefile b/libc/math/Makefile
index c880f38da..16e8f2541 100644
--- a/libc/math/Makefile
+++ b/libc/math/Makefile
@@ -89,9 +89,11 @@ long-c-yes = $(calls:=l)
# Rules for the test suite.
tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
- test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \
- bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int \
- test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan
+ test-misc test-fpucw test-fpucw-ieee tst-definitions test-tgmath \
+ test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \
+ test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
+ $(tests-static)
+tests-static = test-fpucw-static test-fpucw-ieee-static
# We do the `long double' tests only if this data type is available and
# distinct from `double'.
test-longdouble-yes = test-ldouble test-ildoubl
@@ -219,7 +221,8 @@ $(objpfx)libieee.a: $(objpfx)ieee-math.o
$(LN_S) $(<F) $(@F)
ifeq ($(build-shared),yes)
-$(addprefix $(objpfx),$(tests)): $(objpfx)libm.so$(libm.so-version)
+$(addprefix $(objpfx),$(filter-out $(tests-static),$(tests))): $(objpfx)libm.so$(libm.so-version)
+$(addprefix $(objpfx),$(tests-static)): $(objpfx)libm.a
else
$(addprefix $(objpfx),$(tests)): $(objpfx)libm.a
endif
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc
index fe85bb9f1..9677052e0 100644
--- a/libc/math/libm-test.inc
+++ b/libc/math/libm-test.inc
@@ -6836,6 +6836,14 @@ static const struct test_f_f_data cos_test_data[] =
TEST_f_f (cos, 0x1.fffffep+127, 8.53021039830304158051791467692161107353094e-01L),
TEST_f_f (cos, 0x1p+50, 8.68095904660550604334592502063501320395739e-01L),
TEST_f_f (cos, 0x1p+28, -1.65568979490578758865468278195361551113358e-01L),
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (cos, 0x1.000000cf4a2a2p0, 0x1.14a27f9e7521ep-1);
+ TEST_f_f (cos, 0x1.0000010b239a9p0, 0x1.14a27f39bc09dp-1);
+ TEST_f_f (cos, 0x1.00000162a932bp0, 0x1.14a27ea670b8cp-1);
+ TEST_f_f (cos, 0x1.000002d452a10p0, 0x1.14a27c385222ep-1);
+ TEST_f_f (cos, 0x1.000005bc7d86dp0, 0x1.14a27753ee07ap-1);
+#endif
};
static void
@@ -7821,6 +7829,11 @@ static const struct test_f_f_data erf_test_data[] =
TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L),
TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L),
TEST_f_f (erf, 27.0L, 1.0L),
+ TEST_f_f (erf, -27.0L, -1.0L),
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 54
+ /* The input is not exactly representable as a double. */
+ TEST_f_f (erf, -0x1.fffffffffffff8p-2L, -0.5204998778130465132916303345518417673509L),
+#endif
};
static void
@@ -7849,6 +7862,10 @@ static const struct test_f_f_data erfc_test_data[] =
TEST_f_f (erfc, 0x1.ffa002p+2L, 1.233585992097580296336099501489175967033e-29L),
TEST_f_f (erfc, 0x1.ffffc8p+2L, 1.122671365033056305522366683719541099329e-29L),
#ifdef TEST_LDOUBLE
+# if LDBL_MANT_DIG >= 54
+ /* The input is not exactly representable as a double. */
+ TEST_f_f (erfc, -0x1.fffffffffffff8p-2L, 1.52049987781304651329163033455184176735L),
+# endif
/* The result can only be represented in long double. */
# if LDBL_MIN_10_EXP < -319
TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L),
@@ -9347,6 +9364,13 @@ static const struct test_ff_f_data fmod_test_data[] =
#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381
TEST_ff_f (fmod, 0x0.fffffffffffffffep-16382L, 0x1p-16445L, plus_zero, NO_INEXACT_EXCEPTION),
#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 56
+ TEST_ff_f (fmod, -0x1.00000000000004p+0L, 0x1.fffffffffffff8p-1L, -0x1p-53L, NO_INEXACT_EXCEPTION),
+ TEST_ff_f (fmod, 0x1.fffffffffffffap-1L, 0x1.fffffffffffff8p-1L, 0x1p-56L, NO_INEXACT_EXCEPTION),
+ TEST_ff_f (fmod, -0x1.fffffffffffffap-1L, 0x1.fffffffffffff8p-1L, -0x1p-56L, NO_INEXACT_EXCEPTION),
+ TEST_ff_f (fmod, 0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, 0x1p-56L, NO_INEXACT_EXCEPTION),
+ TEST_ff_f (fmod, -0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, -0x1p-56L, NO_INEXACT_EXCEPTION),
+#endif
};
static void
@@ -12308,6 +12332,9 @@ static const struct test_ff_f_data remainder_test_data[] =
TEST_ff_f (remainder, -1.625, -1.0, 0.375, NO_INEXACT_EXCEPTION),
TEST_ff_f (remainder, 5.0, 2.0, 1.0, NO_INEXACT_EXCEPTION),
TEST_ff_f (remainder, 3.0, 2.0, -1.0, NO_INEXACT_EXCEPTION),
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 56
+ TEST_ff_f (remainder, -0x1.80000000000002p1L, 2.0, 0x1.fffffffffffff8p-1L, NO_INEXACT_EXCEPTION),
+#endif
};
static void
@@ -13305,6 +13332,16 @@ static const struct test_f_f_data sin_test_data[] =
TEST_f_f (sin, 0x1.fffffep+127, -5.21876523333658540551505357019806722935726e-01L),
TEST_f_f (sin, 0x1p+50, 4.96396515208940840876821859865411368093356e-01L),
TEST_f_f (sin, 0x1p+28, -9.86198211836975655703110310527108292055548e-01L),
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (sin, 0.93340582292648832662962377071381, 0x1.9b78326675a75p-1);
+ TEST_f_f (sin, 2.3328432680770916363144351635128, 0x1.7264abddb4205p-1);
+ TEST_f_f (sin, 3.7439477503636453548097051680088, -0x1.2217622485d94p-1);
+ TEST_f_f (sin, 3.9225160069792437411706487182528, -0x1.686a3d55a1306p-1);
+ TEST_f_f (sin, 4.0711651639931289992091478779912, -0x1.9a4c6be7f5eadp-1);
+ TEST_f_f (sin, 4.7858438478542097982426639646292, -0x1.fe9e8d4105e51p-1);
+ TEST_f_f (sin, 5.9840767662578002727968851104379, -0x1.2dbd90aa4d692p-2);
+#endif
};
static void
diff --git a/libc/math/test-fpucw-ieee-static.c b/libc/math/test-fpucw-ieee-static.c
new file mode 100644
index 000000000..3a3554206
--- /dev/null
+++ b/libc/math/test-fpucw-ieee-static.c
@@ -0,0 +1 @@
+#include "test-fpucw-ieee.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c b/libc/math/test-fpucw-ieee.c
index 238a0f629..ae5fc73f6 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c
+++ b/libc/math/test-fpucw-ieee.c
@@ -1,7 +1,6 @@
-/* Convert string to 32-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+/* FPU control word overridden initialization test.
+ Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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
@@ -17,11 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <stddef.h>
-#include <spe.h>
+#define FPU_CONTROL _FPU_IEEE
-int32_t
-atosfix32 (const char *str)
-{
- return strtosfix32 (str, NULL);
-}
+#include "test-fpucw.c"
+
+/* Preempt the library's definition of `__fpu_control'. */
+fpu_control_t __fpu_control = _FPU_IEEE;
diff --git a/libc/math/test-fpucw-static.c b/libc/math/test-fpucw-static.c
new file mode 100644
index 000000000..bc1cfa8ce
--- /dev/null
+++ b/libc/math/test-fpucw-static.c
@@ -0,0 +1 @@
+#include "test-fpucw.c"
diff --git a/libc/math/test-fpucw.c b/libc/math/test-fpucw.c
index 1961a6748..ae6a2c9a7 100644
--- a/libc/math/test-fpucw.c
+++ b/libc/math/test-fpucw.c
@@ -19,6 +19,10 @@
#include <fpu_control.h>
#include <stdio.h>
+#ifndef FPU_CONTROL
+# define FPU_CONTROL _FPU_DEFAULT
+#endif
+
int
main (void)
{
@@ -30,11 +34,11 @@ main (void)
cw &= ~_FPU_RESERVED;
- if (cw != (_FPU_DEFAULT & ~_FPU_RESERVED))
+ if (cw != (FPU_CONTROL & ~_FPU_RESERVED))
printf ("control word is 0x%lx but should be 0x%lx.\n",
- (long int) cw, (long int) (_FPU_DEFAULT & ~_FPU_RESERVED));
+ (long int) cw, (long int) (FPU_CONTROL & ~_FPU_RESERVED));
- return cw != (_FPU_DEFAULT & ~_FPU_RESERVED);
+ return cw != (FPU_CONTROL & ~_FPU_RESERVED);
#else
return 0;
diff --git a/libc/math/test-misc.c b/libc/math/test-misc.c
index 27d673b82..f5276ebff 100644
--- a/libc/math/test-misc.c
+++ b/libc/math/test-misc.c
@@ -722,300 +722,161 @@ main (void)
#ifndef NO_LONG_DOUBLE
{
- union ieee854_long_double v1;
- union ieee854_long_double v2;
- long double ld;
+ long double v1, v2;
- v1.d = ld = LDBL_MIN;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = LDBL_MIN;
+ if (fpclassify (v1) != FP_NORMAL)
{
- printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MIN) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
}
- ld = nextafterl (ld, LDBL_MIN / 2.0);
- if (fpclassify (ld) != FP_SUBNORMAL)
+ v2 = nextafterl (v1, LDBL_MIN / 2.0);
+ if (fpclassify (v2) != FP_SUBNORMAL)
{
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
}
- v2.d = ld = nextafterl (ld, LDBL_MIN);
- if (fpclassify (ld) != FP_NORMAL)
+ v2 = nextafterl (v2, LDBL_MIN);
+ if (fpclassify (v2) != FP_NORMAL)
{
printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
}
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
+ if (v1 != v2)
{
- printf ("LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
- {
- printf ("LDBL_MIN: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
- {
- printf ("LDBL_MIN: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("LDBL_MIN-epsilon+epsilon != LDBL_MIN: %La vs %La\n", v2, v1);
result = 1;
}
- v1.d = ld = -LDBL_MIN;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = -LDBL_MIN;
+ if (fpclassify (v1) != FP_NORMAL)
{
- printf ("fpclassify (-LDBL_MIN) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (-LDBL_MIN) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
}
- ld = nextafterl (ld, -LDBL_MIN / 2.0);
- if (fpclassify (ld) != FP_SUBNORMAL)
+ v2 = nextafterl (v1, -LDBL_MIN / 2.0);
+ if (fpclassify (v2) != FP_SUBNORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
}
- v2.d = ld = nextafterl (ld, -LDBL_MIN);
- if (fpclassify (ld) != FP_NORMAL)
+ v2 = nextafterl (v2, -LDBL_MIN);
+ if (fpclassify (v2) != FP_NORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
}
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("-LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("-LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
+ if (v1 != v2)
{
- printf ("-LDBL_MIN: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
- {
- printf ("-LDBL_MIN: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-LDBL_MIN-epsilon+epsilon != -LDBL_MIN: %La vs %La\n", v2, v1);
result = 1;
}
- ld = LDBL_MAX;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = LDBL_MAX;
+ if (fpclassify (v1) != FP_NORMAL)
{
- printf ("fpclassify (LDBL_MAX) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MAX) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
}
- ld = nextafterl (ld, INFINITY);
- if (fpclassify (ld) != FP_INFINITE)
+ v2 = nextafterl (v1, INFINITY);
+ if (fpclassify (v2) != FP_INFINITE)
{
- printf ("fpclassify (LDBL_MAX+epsilon) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MAX+epsilon) failed: %d (%La)\n",
+ fpclassify (v2), v2);
result = 1;
}
- ld = -LDBL_MAX;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = -LDBL_MAX;
+ if (fpclassify (v1) != FP_NORMAL)
{
- printf ("fpclassify (-LDBL_MAX) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (-LDBL_MAX) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
}
- ld = nextafterl (ld, -INFINITY);
- if (fpclassify (ld) != FP_INFINITE)
+ v2 = nextafterl (v1, -INFINITY);
+ if (fpclassify (v2) != FP_INFINITE)
{
- printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d\n",
- fpclassify (ld));
+ printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d (%La)\n",
+ fpclassify (v2), v2);
result = 1;
}
- v1.d = ld = 0.0625;
- ld = nextafterl (ld, 0.0);
- v2.d = ld = nextafterl (ld, 1.0);
+ v1 = 0.0625;
+ v2 = nextafterl (v1, 0.0);
+ v2 = nextafterl (v2, 1.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0625L down: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("0.0625L down: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
- {
- printf ("0.0625L down: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
+ if (v1 != v2)
{
- printf ("0.0625L down: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("0.0625L-epsilon+epsilon != 0.0625L: %La vs %La\n", v2, v1);
result = 1;
}
- v1.d = ld = 0.0625;
- ld = nextafterl (ld, 1.0);
- v2.d = ld = nextafterl (ld, 0.0);
+ v1 = 0.0625;
+ v2 = nextafterl (v1, 1.0);
+ v2 = nextafterl (v2, 0.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0625L up: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("0.0625L up: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
- {
- printf ("0.0625L up: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
+ if (v1 != v2)
{
- printf ("0.0625L up: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("0.0625L+epsilon-epsilon != 0.0625L: %La vs %La\n", v2, v1);
result = 1;
}
- v1.d = ld = -0.0625;
- ld = nextafterl (ld, 0.0);
- v2.d = ld = nextafterl (ld, -1.0);
+ v1 = -0.0625;
+ v2 = nextafterl (v1, 0.0);
+ v2 = nextafterl (v2, -1.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
+ if (v1 != v2)
{
- printf ("-0.0625L up: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("-0.0625L up: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
- {
- printf ("-0.0625L up: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
- {
- printf ("-0.0625L up: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-0.0625L+epsilon-epsilon != -0.0625L: %La vs %La\n", v2, v1);
result = 1;
}
- v1.d = ld = -0.0625;
- ld = nextafterl (ld, -1.0);
- v2.d = ld = nextafterl (ld, 0.0);
+ v1 = -0.0625;
+ v2 = nextafterl (v1, -1.0);
+ v2 = nextafterl (v2, 0.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("-0.0625L down: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("-0.0625L down: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
+ if (v1 != v2)
{
- printf ("-0.0625L down: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
- result = 1;
- }
- if (v1.ieee.negative != v2.ieee.negative)
- {
- printf ("-0.0625L down: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-0.0625L-epsilon+epsilon != -0.0625L: %La vs %La\n", v2, v1);
result = 1;
}
- v1.d = ld = 0.0;
- ld = nextafterl (ld, 1.0);
- v2.d = nextafterl (ld, -1.0);
+ v1 = 0.0;
+ v2 = nextafterl (v1, 1.0);
+ v2 = nextafterl (v2, -1.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0L up: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
- {
- printf ("0.0L up: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
+ if (v1 != v2)
{
- printf ("0.0L up: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
+ printf ("0.0+epsilon-epsilon != 0.0L: %La vs %La\n", v2, v1);
result = 1;
}
- if (0 != v2.ieee.negative)
+ if (signbit (v2))
{
- printf ("0.0L up: negative differs: 0 vs %d\n",
- v2.ieee.negative);
+ printf ("0.0+epsilon-epsilon is negative\n");
result = 1;
}
- v1.d = ld = 0.0;
- ld = nextafterl (ld, -1.0);
- v2.d = nextafterl (ld, 1.0);
+ v1 = 0.0;
+ v2 = nextafterl (v1, -1.0);
+ v2 = nextafterl (v2, 1.0);
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0L down: mantissa0 differs: %8x vs %8x\n",
- v1.ieee.mantissa0, v2.ieee.mantissa0);
- result = 1;
- }
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
+ if (v1 != v2)
{
- printf ("0.0L down: mantissa1 differs: %8x vs %8x\n",
- v1.ieee.mantissa1, v2.ieee.mantissa1);
- result = 1;
- }
- if (v1.ieee.exponent != v2.ieee.exponent)
- {
- printf ("0.0L down: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
+ printf ("0.0-epsilon+epsilon != 0.0L: %La vs %La\n", v2, v1);
result = 1;
}
- if (1 != v2.ieee.negative)
+ if (!signbit (v2))
{
- printf ("0.0L down: negative differs: 1 vs %d\n",
- v2.ieee.negative);
+ printf ("0.0-epsilon+epsilon is positive\n");
result = 1;
}
diff --git a/libc/misc/error.c b/libc/misc/error.c
index e3f8e0f00..5bd4cf9c4 100644
--- a/libc/misc/error.c
+++ b/libc/misc/error.c
@@ -167,7 +167,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (res != len)
break;
- if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+ if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
{
/* This really should not happen if everything is fine. */
res = (size_t) -1;
diff --git a/libc/misc/swapon.c b/libc/misc/swapon.c
index 61933b8bb..0e587d473 100644
--- a/libc/misc/swapon.c
+++ b/libc/misc/swapon.c
@@ -22,8 +22,7 @@
/* 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;
+swapon (const char *path, int flags)
{
__set_errno (ENOSYS);
return -1;
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 90824aec9..a08915382 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,25 @@
+2013-10-04 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * tst-mutex8.c (check_type) [ENABLE_PI]: Handle ENOTSUP failure
+ from pthread_mutex_init.
+
+2013-10-01 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #15988]
+ * pthread_cond_broadcast.c (__pthread_cond_broadcast)
+ [lll_futex_cmp_requeue_pi && __ASSUME_REQUEUE_PI]: Use
+ USE_REQUEUE_PI.
+ * pthread_cond_signal.c (__pthread_cond_signal)
+ [lll_futex_cmd_requeue_pi && __ASSUME_REQUEUE_PI]: Likewise.
+
+2013-09-27 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/pthread/bits/libc-lock.h [_LIBC && (!NOT_IN_libc ||
+ IS_IN_libpthread)] (__libc_lock_fini_recursive): Use the mutex
+ member of the argument.
+ (__libc_lock_trylock_recursive): Likewise.
+ (__libc_lock_unlock_recursive): Likewise.
+
2013-09-04 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/x86_64/cancellation.S
diff --git a/libc/nptl/pthread_cond_broadcast.c b/libc/nptl/pthread_cond_broadcast.c
index 0702ec0ec..7ba9efa0c 100644
--- a/libc/nptl/pthread_cond_broadcast.c
+++ b/libc/nptl/pthread_cond_broadcast.c
@@ -63,10 +63,7 @@ __pthread_cond_broadcast (cond)
#if (defined lll_futex_cmp_requeue_pi \
&& defined __ASSUME_REQUEUE_PI)
- int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
- pi_flag &= mut->__data.__kind;
-
- if (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP)
+ if (USE_REQUEUE_PI (mut))
{
if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
&mut->__data.__lock, futex_val,
diff --git a/libc/nptl/pthread_cond_signal.c b/libc/nptl/pthread_cond_signal.c
index 102d0b380..ffc35dc9e 100644
--- a/libc/nptl/pthread_cond_signal.c
+++ b/libc/nptl/pthread_cond_signal.c
@@ -49,14 +49,9 @@ __pthread_cond_signal (cond)
#if (defined lll_futex_cmp_requeue_pi \
&& defined __ASSUME_REQUEUE_PI)
- int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
pthread_mutex_t *mut = cond->__data.__mutex;
- /* Do not use requeue for pshared condvars. */
- if (mut != (void *) ~0l)
- pi_flag &= mut->__data.__kind;
-
- if (__builtin_expect (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP, 0)
+ if (USE_REQUEUE_PI (mut)
/* This can only really fail with a ENOSYS, since nobody can modify
futex while we have the cond_lock. */
&& lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,
diff --git a/libc/nptl/shlib-versions b/libc/nptl/shlib-versions
index e49e7ca41..495b240a5 100644
--- a/libc/nptl/shlib-versions
+++ b/libc/nptl/shlib-versions
@@ -2,4 +2,5 @@ sparc64.*-.*-linux.* libpthread=0 GLIBC_2.2
sh.*-.*-linux.* libpthread=0 GLIBC_2.2
s390x-.*-linux.* libpthread=0 GLIBC_2.2
powerpc64-.*-linux.* libpthread=0 GLIBC_2.3
+powerpc.*le-.*-linux.* libpthread=0 GLIBC_2.18
.*-.*-linux.* libpthread=0
diff --git a/libc/nptl/sysdeps/pthread/bits/libc-lock.h b/libc/nptl/sysdeps/pthread/bits/libc-lock.h
index 17a23aebf..674b6285f 100644
--- a/libc/nptl/sysdeps/pthread/bits/libc-lock.h
+++ b/libc/nptl/sysdeps/pthread/bits/libc-lock.h
@@ -95,7 +95,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
# define __libc_lock_fini_recursive(NAME) ((void) 0)
#else
# define __libc_lock_fini_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0)
+ __libc_maybe_call (__pthread_mutex_destroy, (&(NAME).mutex), 0)
#endif
/* Lock the recursive named lock variable. */
@@ -161,7 +161,7 @@ libc_hidden_proto (__libc_lock_trylock_recursive_fn);
# endif /* __OPTION_EGLIBC_BIG_MACROS */
#else
# define __libc_lock_trylock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0)
+ __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
#endif
/* Unlock the recursive named lock variable. */
@@ -189,7 +189,7 @@ libc_hidden_proto (__libc_lock_unlock_recursive_fn);
# endif /* __OPTION_EGLIBC_BIG_MACROS */
#else
# define __libc_lock_unlock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
+ __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
#endif
/* Note that for I/O cleanup handling we are using the old-style
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
index ace858fd1..4ac913c3b 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
@@ -41,13 +41,8 @@ void __novmx_longjmp (jmp_buf env, int val)
__novmx__libc_longjmp (env, val);
}
-# if __WORDSIZE == 64
-symbol_version (__novmx_longjmp,longjmp,GLIBC_2.3);
-symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.3);
-# else
-symbol_version (__novmx_longjmp,longjmp,GLIBC_2.0);
-symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.0);
-# endif
+compat_symbol (libpthread, __novmx_longjmp, longjmp, GLIBC_2_0);
+compat_symbol (libpthread, __novmx_siglongjmp, siglongjmp, GLIBC_2_0);
#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */
void
@@ -62,5 +57,5 @@ __vmx_siglongjmp (jmp_buf env, int val)
__libc_siglongjmp (env, val);
}
-versioned_symbol (libc, __vmx_longjmp, longjmp, GLIBC_2_3_4);
-versioned_symbol (libc, __vmx_siglongjmp, siglongjmp, GLIBC_2_3_4);
+versioned_symbol (libpthread, __vmx_longjmp, longjmp, GLIBC_2_3_4);
+versioned_symbol (libpthread, __vmx_siglongjmp, siglongjmp, GLIBC_2_3_4);
diff --git a/libc/nptl/tst-mutex8.c b/libc/nptl/tst-mutex8.c
index d2307e47e..c3d40faab 100644
--- a/libc/nptl/tst-mutex8.c
+++ b/libc/nptl/tst-mutex8.c
@@ -93,10 +93,18 @@ tf (void *arg)
static int
check_type (const char *mas, pthread_mutexattr_t *ma)
{
- int e __attribute__((unused));
+ int e;
- if (pthread_mutex_init (m, ma) != 0)
+ e = pthread_mutex_init (m, ma);
+ if (e != 0)
{
+#ifdef ENABLE_PI
+ if (e == ENOTSUP)
+ {
+ puts ("PI mutexes unsupported");
+ return 0;
+ }
+#endif
printf ("1st mutex_init failed for %s\n", mas);
return 1;
}
diff --git a/libc/nscd/aicache.c b/libc/nscd/aicache.c
index fd55852ed..713e41a2e 100644
--- a/libc/nscd/aicache.c
+++ b/libc/nscd/aicache.c
@@ -86,20 +86,19 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
}
static service_user *hosts_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
int rc6 = 0;
int rc4 = 0;
int herrno = 0;
- if (hosts_database != NULL)
- {
- nip = hosts_database;
- no_more = 0;
- }
- else
+ if (hosts_database == NULL)
no_more = __nss_database_lookup ("hosts", NULL,
- "dns [!UNAVAIL=return] files", &nip);
+ "dns [!UNAVAIL=return] files",
+ &hosts_database);
+ else
+ no_more = 0;
+ nip = hosts_database;
/* Initialize configurations. */
if (__glibc_unlikely (!_res_hconf.initialized))
diff --git a/libc/nscd/initgrcache.c b/libc/nscd/initgrcache.c
index 462780e62..4580884ea 100644
--- a/libc/nscd/initgrcache.c
+++ b/libc/nscd/initgrcache.c
@@ -80,17 +80,16 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
}
static service_user *group_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
- if (group_database != NULL)
- {
- nip = group_database;
- no_more = 0;
- }
- else
+ if (group_database == NULL)
no_more = __nss_database_lookup ("group", NULL,
- "compat [NOTFOUND=return] files", &nip);
+ "compat [NOTFOUND=return] files",
+ &group_database);
+ else
+ no_more = 0;
+ nip = group_database;
/* We always use sysconf even if NGROUPS_MAX is defined. That way, the
limit can be raised in the kernel configuration without having to
diff --git a/libc/nscd/netgroupcache.c b/libc/nscd/netgroupcache.c
index dd06ce4fa..a607dda0a 100644
--- a/libc/nscd/netgroupcache.c
+++ b/libc/nscd/netgroupcache.c
@@ -591,10 +591,10 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
# endif
}
else
+#endif
{
-# ifndef __ASSUME_SENDFILE
+#if defined HAVE_SENDFILE && !defined __ASSUME_SENDFILE
use_write:
-# endif
#endif
writeall (fd, &dataset->resp, sizeof (innetgroup_response_header));
}
diff --git a/libc/po/zh_TW.po b/libc/po/zh_TW.po
index 0caea2275..b8eb179a9 100644
--- a/libc/po/zh_TW.po
+++ b/libc/po/zh_TW.po
@@ -8,9 +8,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: libc 2.17-pre1\n"
-"POT-Creation-Date: 2012-12-07 15:10-0500\n"
-"PO-Revision-Date: 2013-06-11 08:59+0200\n"
+"Project-Id-Version: libc 2.17.90.20130724\n"
+"POT-Creation-Date: 2013-07-24 23:29-0700\n"
+"PO-Revision-Date: 2013-09-03 13:39+0800\n"
"Last-Translator: Wei-Lun Chao <bluebat@member.fsf.org>\n"
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
"Language: zh_TW\n"
@@ -68,32 +68,42 @@ msgstr "給出這個使用方å¼åˆ—表"
msgid "Give a short usage message"
msgstr "給出簡短的使用訊æ¯"
-#: argp/argp-parse.c:103
+#: argp/argp-parse.c:103 catgets/gencat.c:109 catgets/gencat.c:113
+#: iconv/iconv_prog.c:60 iconv/iconv_prog.c:61 nscd/nscd.c:115
+#: nss/makedb.c:120
+msgid "NAME"
+msgstr "å稱"
+
+#: argp/argp-parse.c:104
msgid "Set the program name"
msgstr "設定程å¼å稱"
#: argp/argp-parse.c:105
+msgid "SECS"
+msgstr "秒數"
+
+#: argp/argp-parse.c:106
msgid "Hang for SECS seconds (default 3600)"
msgstr "SECS 秒後掛斷 (é è¨­æ˜¯ 3600)"
-#: argp/argp-parse.c:166
+#: argp/argp-parse.c:167
msgid "Print program version"
msgstr "å°å‡ºç¨‹å¼ç‰ˆæœ¬"
-#: argp/argp-parse.c:182
+#: argp/argp-parse.c:183
msgid "(PROGRAM ERROR) No version known!?"
msgstr "(程å¼éŒ¯èª¤) 沒有èªå¾—的版本!?"
-#: argp/argp-parse.c:622
+#: argp/argp-parse.c:623
#, c-format
msgid "%s: Too many arguments\n"
msgstr "%s: 太多的引數\n"
-#: argp/argp-parse.c:765
+#: argp/argp-parse.c:766
msgid "(PROGRAM ERROR) Option should have been recognized!?"
msgstr "(程å¼éŒ¯èª¤) é¸é …應該已經å¯è¾¨è­˜!?"
-#: assert/assert-perr.c:36
+#: assert/assert-perr.c:35
#, c-format
msgid "%s%s%s:%u: %s%sUnexpected error: %s.\n"
msgstr "%s%s%s:%u: %s%s無法é æ–™çš„錯誤: %s。\n"
@@ -107,10 +117,6 @@ msgstr ""
"%s%s%s:%u:%s%så‡è¨­ã€Ž%sã€å¤±æ•—。\n"
"%n"
-#: catgets/gencat.c:109 catgets/gencat.c:113 nscd/nscd.c:115 nss/makedb.c:119
-msgid "NAME"
-msgstr "å稱"
-
#: catgets/gencat.c:110
msgid "Create C header file NAME containing symbol definitions"
msgstr "產生的 C 標頭檔åå…§å«ç¬¦è™Ÿå®šç¾©"
@@ -119,7 +125,7 @@ msgstr "產生的 C 標頭檔åå…§å«ç¬¦è™Ÿå®šç¾©"
msgid "Do not use existing catalog, force new output file"
msgstr "ä¸ä½¿ç”¨ç¾å­˜çš„ catalog, 強制使用新的輸出檔"
-#: catgets/gencat.c:113 nss/makedb.c:119
+#: catgets/gencat.c:113 nss/makedb.c:120
msgid "Write output to file NAME"
msgstr "將輸出寫到檔案 NAME 中"
@@ -139,11 +145,11 @@ msgstr ""
"-o 輸出檔案å稱 [輸入檔案å稱]...\n"
"[輸出檔案å稱 [輸入檔案å稱]...]"
-#: catgets/gencat.c:235 debug/pcprofiledump.c:208 elf/ldconfig.c:302
-#: elf/pldd.c:222 elf/sln.c:85 elf/sprof.c:371 iconv/iconv_prog.c:408
-#: iconv/iconvconfig.c:383 locale/programs/locale.c:279
-#: locale/programs/localedef.c:363 login/programs/pt_chown.c:88
-#: malloc/memusagestat.c:536 nscd/nscd.c:459 nss/getent.c:965 nss/makedb.c:371
+#: catgets/gencat.c:229 debug/pcprofiledump.c:209 elf/ldconfig.c:307
+#: elf/pldd.c:219 elf/sln.c:85 elf/sprof.c:372 iconv/iconv_prog.c:408
+#: iconv/iconvconfig.c:379 locale/programs/locale.c:277
+#: locale/programs/localedef.c:364 login/programs/pt_chown.c:88
+#: malloc/memusagestat.c:563 nscd/nscd.c:450 nss/getent.c:965 nss/makedb.c:369
#: posix/getconf.c:1121 sunrpc/rpcinfo.c:691
#: sysdeps/unix/sysv/linux/lddlibc4.c:61
#, c-format
@@ -154,12 +160,12 @@ msgstr ""
"è¦çŸ¥é“錯誤報告指令,請åƒçœ‹ï¼š\n"
"%s。\n"
-#: catgets/gencat.c:251 debug/pcprofiledump.c:224 debug/xtrace.sh:64
-#: elf/ldconfig.c:318 elf/ldd.bash.in:38 elf/pldd.c:238 elf/sotruss.ksh:75
-#: elf/sprof.c:388 iconv/iconv_prog.c:425 iconv/iconvconfig.c:400
-#: locale/programs/locale.c:296 locale/programs/localedef.c:389
+#: catgets/gencat.c:245 debug/pcprofiledump.c:225 debug/xtrace.sh:64
+#: elf/ldconfig.c:323 elf/ldd.bash.in:38 elf/pldd.c:235 elf/sotruss.ksh:75
+#: elf/sprof.c:389 iconv/iconv_prog.c:425 iconv/iconvconfig.c:396
+#: locale/programs/locale.c:294 locale/programs/localedef.c:390
#: login/programs/pt_chown.c:62 malloc/memusage.sh:71
-#: malloc/memusagestat.c:552 nscd/nscd.c:475 nss/getent.c:86 nss/makedb.c:387
+#: malloc/memusagestat.c:579 nscd/nscd.c:466 nss/getent.c:86 nss/makedb.c:385
#: posix/getconf.c:1103 sysdeps/unix/sysv/linux/lddlibc4.c:68
#, c-format
msgid ""
@@ -168,126 +174,126 @@ msgid ""
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
msgstr ""
"版權所有 (C) %s 自由軟體基金會。\n"
-"這是一個自由軟體;請見æºå§‹ç¢¼çš„授權æ¢æ¬¾ã€‚這沒有擔ä¿ï¼›ç”šè‡³ä¹Ÿæ²’有專為銷\n"
+"這是一個自由軟體;請見原始碼的授權æ¢æ¬¾ã€‚這沒有擔ä¿ï¼›ç”šè‡³ä¹Ÿæ²’有專為銷\n"
"售或者é©åˆæŸäº›ç‰¹æ®Šç›®çš„。\n"
-#: catgets/gencat.c:256 debug/pcprofiledump.c:229 debug/xtrace.sh:68
-#: elf/ldconfig.c:323 elf/pldd.c:243 elf/sprof.c:394 iconv/iconv_prog.c:430
-#: iconv/iconvconfig.c:405 locale/programs/locale.c:301
-#: locale/programs/localedef.c:394 malloc/memusage.sh:75
-#: malloc/memusagestat.c:557 nscd/nscd.c:480 nss/getent.c:91 nss/makedb.c:392
+#: catgets/gencat.c:250 debug/pcprofiledump.c:230 debug/xtrace.sh:68
+#: elf/ldconfig.c:328 elf/pldd.c:240 elf/sprof.c:395 iconv/iconv_prog.c:430
+#: iconv/iconvconfig.c:401 locale/programs/locale.c:299
+#: locale/programs/localedef.c:395 malloc/memusage.sh:75
+#: malloc/memusagestat.c:584 nscd/nscd.c:471 nss/getent.c:91 nss/makedb.c:390
#: posix/getconf.c:1108
#, c-format
msgid "Written by %s.\n"
msgstr "作者 %s。\n"
-#: catgets/gencat.c:287
+#: catgets/gencat.c:281
msgid "*standard input*"
msgstr "*標準輸入*"
-#: catgets/gencat.c:293 iconv/iconv_charmap.c:169 iconv/iconv_prog.c:293
-#: nss/makedb.c:248
+#: catgets/gencat.c:287 iconv/iconv_charmap.c:167 iconv/iconv_prog.c:293
+#: nss/makedb.c:246
#, c-format
msgid "cannot open input file `%s'"
msgstr "無法開啟輸入檔 `%s'"
-#: catgets/gencat.c:422 catgets/gencat.c:497
+#: catgets/gencat.c:416 catgets/gencat.c:491
msgid "illegal set number"
msgstr "ä¸åˆæ³•çš„集åˆç·¨è™Ÿ"
-#: catgets/gencat.c:449
+#: catgets/gencat.c:443
msgid "duplicate set definition"
msgstr "複製集åˆå®šç¾©"
-#: catgets/gencat.c:451 catgets/gencat.c:623 catgets/gencat.c:675
+#: catgets/gencat.c:445 catgets/gencat.c:617 catgets/gencat.c:669
msgid "this is the first definition"
msgstr "此為第一個定義"
-#: catgets/gencat.c:522
+#: catgets/gencat.c:516
#, c-format
msgid "unknown set `%s'"
msgstr "ä¸æ˜Žçš„é›†åˆ `%s'"
-#: catgets/gencat.c:563
+#: catgets/gencat.c:557
msgid "invalid quote character"
msgstr "ä¸é©ç”¨çš„引用字元"
-#: catgets/gencat.c:576
+#: catgets/gencat.c:570
#, c-format
msgid "unknown directive `%s': line ignored"
msgstr "ä¸æ˜Žçš„指令 `%s': 此列忽略"
-#: catgets/gencat.c:621
+#: catgets/gencat.c:615
msgid "duplicated message number"
msgstr "é‡è¤‡çš„訊æ¯ç·¨è™Ÿ"
-#: catgets/gencat.c:672
+#: catgets/gencat.c:666
msgid "duplicated message identifier"
msgstr "é‡è¤‡çš„訊æ¯è­˜åˆ¥ç¬¦è™Ÿ"
-#: catgets/gencat.c:729
+#: catgets/gencat.c:723
msgid "invalid character: message ignored"
msgstr "ä¸é©ç”¨çš„å­—å…ƒ: 忽略此訊æ¯"
-#: catgets/gencat.c:772
+#: catgets/gencat.c:766
msgid "invalid line"
msgstr "無效的輸入列"
-#: catgets/gencat.c:826
+#: catgets/gencat.c:820
msgid "malformed line ignored"
msgstr "忽略奇怪的列"
-#: catgets/gencat.c:990 catgets/gencat.c:1031
+#: catgets/gencat.c:984 catgets/gencat.c:1025
#, c-format
msgid "cannot open output file `%s'"
msgstr "無法開啟輸出檔 `%s'"
-#: catgets/gencat.c:1193 locale/programs/linereader.c:559
+#: catgets/gencat.c:1187 locale/programs/linereader.c:560
msgid "invalid escape sequence"
msgstr "無效的跳脫åºåˆ—"
-#: catgets/gencat.c:1215
+#: catgets/gencat.c:1209
msgid "unterminated message"
msgstr "沒有çµå°¾çš„訊æ¯"
-#: catgets/gencat.c:1239
+#: catgets/gencat.c:1233
#, c-format
msgid "while opening old catalog file"
msgstr "在開啟舊的類別檔案時"
-#: catgets/gencat.c:1330
+#: catgets/gencat.c:1324
#, c-format
msgid "conversion modules not available"
msgstr "轉æ›æ¨¡çµ„ä¸å­˜åœ¨"
-#: catgets/gencat.c:1356
+#: catgets/gencat.c:1350
#, c-format
msgid "cannot determine escape character"
msgstr "無法決定跳脫字元"
-#: debug/pcprofiledump.c:52
+#: debug/pcprofiledump.c:53
msgid "Don't buffer output"
msgstr "ä¸è¦å°‡è¼¸å…¥å­˜å…¥ç·©è¡å€"
-#: debug/pcprofiledump.c:57
+#: debug/pcprofiledump.c:58
msgid "Dump information generated by PC profiling."
msgstr "將產生於 PC 測速評估的資料傾å¸å‡ºä¾†"
-#: debug/pcprofiledump.c:60
+#: debug/pcprofiledump.c:61
msgid "[FILE]"
msgstr "[檔案]"
-#: debug/pcprofiledump.c:107
+#: debug/pcprofiledump.c:108
#, c-format
msgid "cannot open input file"
msgstr "無法開啟輸入檔"
-#: debug/pcprofiledump.c:114
+#: debug/pcprofiledump.c:115
#, c-format
msgid "cannot read header"
msgstr "無法讀å–標頭資料"
-#: debug/pcprofiledump.c:178
+#: debug/pcprofiledump.c:179
#, c-format
msgid "invalid pointer size"
msgstr "無效的指標大å°"
@@ -374,64 +380,64 @@ msgstr "無效的模å¼"
msgid "invalid mode parameter"
msgstr "無效的模å¼åƒæ•¸"
-#: elf/cache.c:68
+#: elf/cache.c:69
msgid "unknown"
msgstr "未知"
-#: elf/cache.c:121
+#: elf/cache.c:126
msgid "Unknown OS"
msgstr "未知的作業系統"
-#: elf/cache.c:126
+#: elf/cache.c:131
#, c-format
msgid ", OS ABI: %s %d.%d.%d"
msgstr ", OS ABI: %s %d.%d.%d"
-#: elf/cache.c:143 elf/ldconfig.c:1309
+#: elf/cache.c:148 elf/ldconfig.c:1318
#, c-format
msgid "Can't open cache file %s\n"
msgstr "無法開啟快å–檔 %s\n"
-#: elf/cache.c:157
+#: elf/cache.c:162
#, c-format
msgid "mmap of cache file failed.\n"
msgstr "å¿«å–檔案 mmap 失敗。\n"
-#: elf/cache.c:161 elf/cache.c:175
+#: elf/cache.c:166 elf/cache.c:180
#, c-format
msgid "File is not a cache file.\n"
msgstr "檔案並éžå¿«å–檔。\n"
-#: elf/cache.c:208 elf/cache.c:218
+#: elf/cache.c:213 elf/cache.c:223
#, c-format
msgid "%d libs found in cache `%s'\n"
msgstr "%d 函å¼åº«åœ¨å¿«å– `%s' 中找到\n"
-#: elf/cache.c:412
+#: elf/cache.c:417
#, c-format
msgid "Can't create temporary cache file %s"
msgstr "無法產生暫時的快å–檔 %s"
-#: elf/cache.c:420 elf/cache.c:430 elf/cache.c:434 elf/cache.c:439
+#: elf/cache.c:425 elf/cache.c:435 elf/cache.c:439 elf/cache.c:444
#, c-format
msgid "Writing of cache data failed"
msgstr "寫入快å–資料時發生錯誤"
-#: elf/cache.c:444
+#: elf/cache.c:449
#, c-format
msgid "Changing access rights of %s to %#o failed"
msgstr "更改 %s çš„å­˜å–權é™ç‚º %#o 失敗"
-#: elf/cache.c:449
+#: elf/cache.c:454
#, c-format
msgid "Renaming of %s to %s failed"
msgstr "å°‡ %s 改å為 %s 失敗"
-#: elf/dl-close.c:378 elf/dl-open.c:474
+#: elf/dl-close.c:384 elf/dl-open.c:470
msgid "cannot create scope list"
msgstr "無法建立作用域列表"
-#: elf/dl-close.c:771
+#: elf/dl-close.c:777
msgid "shared object not open"
msgstr "共用目的檔案沒有開啟"
@@ -448,15 +454,15 @@ msgstr "空的動態字串字組替æ›"
msgid "cannot load auxiliary `%s' because of empty dynamic string token substitution\n"
msgstr "由於空的動態字串字組替æ›è€Œç„¡æ³•è¼‰å…¥å¤–部的 `%s'\n"
-#: elf/dl-deps.c:483
+#: elf/dl-deps.c:479
msgid "cannot allocate dependency list"
msgstr "無法é…置相關性列表"
-#: elf/dl-deps.c:520 elf/dl-deps.c:580
+#: elf/dl-deps.c:516 elf/dl-deps.c:576
msgid "cannot allocate symbol search list"
msgstr "無法é…置符號æœå°‹åˆ—表"
-#: elf/dl-deps.c:560
+#: elf/dl-deps.c:556
msgid "Filters not supported with LD_TRACE_PRELINKING"
msgstr "éŽæ¿¾ç¨‹å¼ä¸æ”¯æ´èˆ‡ LD_TRACE_PRELINKING 共用"
@@ -480,23 +486,23 @@ msgstr "無法將é é¢å°æ˜ æ–¼ fptr 表格"
msgid "internal error: symidx out of range of fptr table"
msgstr "內部錯誤:symidx 超出 fptr 表格的範åœ"
-#: elf/dl-hwcaps.c:173 elf/dl-hwcaps.c:185
+#: elf/dl-hwcaps.c:184 elf/dl-hwcaps.c:196
msgid "cannot create capability list"
msgstr "無法建立 capability 列表"
-#: elf/dl-load.c:471
+#: elf/dl-load.c:465
msgid "cannot allocate name record"
msgstr "無法é…ç½®å稱紀錄"
-#: elf/dl-load.c:548 elf/dl-load.c:664 elf/dl-load.c:749 elf/dl-load.c:862
+#: elf/dl-load.c:542 elf/dl-load.c:658 elf/dl-load.c:743 elf/dl-load.c:862
msgid "cannot create cache for search path"
msgstr "無法為æœå°‹è·¯å¾‘建立快å–"
-#: elf/dl-load.c:639
+#: elf/dl-load.c:633
msgid "cannot create RUNPATH/RPATH copy"
msgstr "無法建立 RUNPATH/RPATH 的副本"
-#: elf/dl-load.c:735
+#: elf/dl-load.c:729
msgid "cannot create search path array"
msgstr "無法建立æœå°‹è·¯å¾‘陣列"
@@ -508,11 +514,11 @@ msgstr "無法 stat 共用目的檔"
msgid "cannot open zero fill device"
msgstr "無法開啟以零填滿的è£ç½®"
-#: elf/dl-load.c:1059 elf/dl-load.c:2339
+#: elf/dl-load.c:1059 elf/dl-load.c:2342
msgid "cannot create shared object descriptor"
msgstr "無法建立共用目的檔敘述項"
-#: elf/dl-load.c:1078 elf/dl-load.c:1751 elf/dl-load.c:1854
+#: elf/dl-load.c:1078 elf/dl-load.c:1755 elf/dl-load.c:1858
msgid "cannot read file data"
msgstr "無法讀å–檔案資料"
@@ -544,7 +550,7 @@ msgstr "從共用目的檔中å°æ˜ å€æ®µå¤±æ•—"
msgid "cannot dynamically load executable"
msgstr "無法動態載入執行檔"
-#: elf/dl-load.c:1383
+#: elf/dl-load.c:1383 elf/dl-load.c:1492
msgid "cannot change memory protections"
msgstr "無法改變記憶體ä¿è­·ç‹€æ…‹"
@@ -564,95 +570,95 @@ msgstr "共用目的檔無法被 dlopen()"
msgid "cannot allocate memory for program header"
msgstr "無法é…置記憶體給程å¼æ¨™é ­å€ä½¿ç”¨"
-#: elf/dl-load.c:1469 elf/dl-open.c:180
+#: elf/dl-load.c:1469 elf/dl-open.c:195
msgid "invalid caller"
msgstr "無效的呼å«è€…"
-#: elf/dl-load.c:1508
+#: elf/dl-load.c:1512
msgid "cannot enable executable stack as shared object requires"
msgstr "無法開啟å¯åŸ·è¡Œå †ç–Šåšç‚ºå…±ç”¨ç›®çš„檔"
-#: elf/dl-load.c:1521
+#: elf/dl-load.c:1525
msgid "cannot close file descriptor"
msgstr "無法關閉檔案æ述符號"
-#: elf/dl-load.c:1751
+#: elf/dl-load.c:1755
msgid "file too short"
msgstr "檔案太å°"
-#: elf/dl-load.c:1787
+#: elf/dl-load.c:1791
msgid "invalid ELF header"
msgstr "無效的 ELF 標頭"
-#: elf/dl-load.c:1799
+#: elf/dl-load.c:1803
msgid "ELF file data encoding not big-endian"
msgstr "ELF 檔資料編碼並éžå¤§å°¾åº"
-#: elf/dl-load.c:1801
+#: elf/dl-load.c:1805
msgid "ELF file data encoding not little-endian"
msgstr "ELF 檔資料編碼並éžå°å°¾åº"
-#: elf/dl-load.c:1805
+#: elf/dl-load.c:1809
msgid "ELF file version ident does not match current one"
msgstr "ELF 檔版本 ident ä¸ç¬¦åˆç›®å‰æ‰€ä½¿ç”¨çš„"
-#: elf/dl-load.c:1809
+#: elf/dl-load.c:1813
msgid "ELF file OS ABI invalid"
msgstr "ELF 檔 OS ABI 版本ä¸é©ç”¨"
-#: elf/dl-load.c:1812
+#: elf/dl-load.c:1816
msgid "ELF file ABI version invalid"
msgstr "ELF 檔 ABI 版本ä¸é©ç”¨"
-#: elf/dl-load.c:1815
+#: elf/dl-load.c:1819
msgid "nonzero padding in e_ident"
msgstr "在 e_ident 中填補éžé›¶å€¼"
-#: elf/dl-load.c:1818
+#: elf/dl-load.c:1822
msgid "internal error"
msgstr "內部錯誤"
-#: elf/dl-load.c:1825
+#: elf/dl-load.c:1829
msgid "ELF file version does not match current one"
msgstr "ELF 檔版本ä¸ç¬¦åˆç›®å‰çš„版本"
-#: elf/dl-load.c:1833
+#: elf/dl-load.c:1837
msgid "only ET_DYN and ET_EXEC can be loaded"
msgstr "åªæœ‰ ET_DYN ä»¥åŠ ET_EXEC å¯ä»¥è¼‰å…¥"
-#: elf/dl-load.c:1839
+#: elf/dl-load.c:1843
msgid "ELF file's phentsize not the expected size"
msgstr "ELF 檔的 phentsize 並ä¸æ˜¯é æœŸä¸­çš„大å°"
-#: elf/dl-load.c:2358
+#: elf/dl-load.c:2361
msgid "wrong ELF class: ELFCLASS64"
msgstr "錯誤 ELF 類別:ELFCLASS64"
-#: elf/dl-load.c:2359
+#: elf/dl-load.c:2362
msgid "wrong ELF class: ELFCLASS32"
msgstr "錯誤 ELF 類別:ELFCLASS32"
-#: elf/dl-load.c:2362
+#: elf/dl-load.c:2365
msgid "cannot open shared object file"
msgstr "無法開啟共用目的檔"
-#: elf/dl-lookup.c:757 ports/sysdeps/mips/dl-lookup.c:774
+#: elf/dl-lookup.c:753 ports/sysdeps/mips/dl-lookup.c:771
msgid "relocation error"
msgstr "é‡å®šå€éŒ¯èª¤"
-#: elf/dl-lookup.c:786 ports/sysdeps/mips/dl-lookup.c:803
+#: elf/dl-lookup.c:780 ports/sysdeps/mips/dl-lookup.c:798
msgid "symbol lookup error"
msgstr "符號查找錯誤"
-#: elf/dl-open.c:110
+#: elf/dl-open.c:102
msgid "cannot extend global scope"
msgstr "無法延展全域變數的作用域"
-#: elf/dl-open.c:524
+#: elf/dl-open.c:520
msgid "TLS generation counter wrapped! Please report this."
msgstr "TLS 產生計數器被轉æ›åŸ·è¡Œï¼ 請報告這個情æ³ã€‚"
-#: elf/dl-open.c:546
+#: elf/dl-open.c:542
msgid "cannot load any more object with static TLS"
msgstr "無法以éœæ…‹ TLS å†è¼‰å…¥ä»»ä½•ç‰©ä»¶"
@@ -672,29 +678,29 @@ msgstr "dlmopen() 中的無效目標命å空間"
msgid "cannot allocate memory in static TLS block"
msgstr "無法在éœæ…‹ TLS å€å¡Šä¸­é…置記憶體"
-#: elf/dl-reloc.c:213
+#: elf/dl-reloc.c:212
msgid "cannot make segment writable for relocation"
msgstr "在é‡æ–°å®šå€ä»¥å¾Œç„¡æ³•å°‡å€æ®µè¨­ç‚ºå¯å¯«å…¥ç‹€æ…‹"
-#: elf/dl-reloc.c:276
+#: elf/dl-reloc.c:275
#, c-format
msgid "%s: no PLTREL found in object %s\n"
msgstr "%s: 在目的檔 %s 中沒有找到 PLTREL\n"
-#: elf/dl-reloc.c:287
+#: elf/dl-reloc.c:286
#, c-format
msgid "%s: out of memory to store relocation results for %s\n"
msgstr "%s: 記憶體ä¸è¶³ä»¥å„²å­˜é‡å®šå€çµæžœç”¨æ–¼ %s\n"
-#: elf/dl-reloc.c:303
+#: elf/dl-reloc.c:302
msgid "cannot restore segment prot after reloc"
msgstr "在 reloc 之後無法復原 segment prot"
-#: elf/dl-reloc.c:332
+#: elf/dl-reloc.c:331
msgid "cannot apply additional memory protection after relocation"
msgstr "é‡å®šå€ä¹‹å¾Œç„¡æ³•å¥—用é¡å¤–記憶體ä¿è­·"
-#: elf/dl-sym.c:163
+#: elf/dl-sym.c:153
msgid "RTLD_NEXT used in code not dynamically loaded"
msgstr "程å¼ç¢¼æ‰€ä½¿ç”¨çš„ RTLD_NEXT 沒有動態載入"
@@ -706,224 +712,224 @@ msgstr "無法建立 TLS 資料çµæ§‹"
msgid "version lookup error"
msgstr "版本查找錯誤"
-#: elf/dl-version.c:297
+#: elf/dl-version.c:296
msgid "cannot allocate version reference table"
msgstr "無法é…置版本åƒç…§è¡¨"
-#: elf/ldconfig.c:140
+#: elf/ldconfig.c:141
msgid "Print cache"
msgstr "å°å‡ºå¿«å–"
-#: elf/ldconfig.c:141
+#: elf/ldconfig.c:142
msgid "Generate verbose messages"
msgstr "產生更多的訊æ¯"
-#: elf/ldconfig.c:142
+#: elf/ldconfig.c:143
msgid "Don't build cache"
msgstr "ä¸å»ºç«‹å¿«å–"
-#: elf/ldconfig.c:143
+#: elf/ldconfig.c:144
msgid "Don't generate links"
msgstr "ä¸ç”¢ç”Ÿé€£çµ"
-#: elf/ldconfig.c:144
+#: elf/ldconfig.c:145
msgid "Change to and use ROOT as root directory"
msgstr "變æ›åˆ° ROOT 目錄並以它åšç‚ºæ ¹ç›®éŒ„"
-#: elf/ldconfig.c:144
+#: elf/ldconfig.c:145
msgid "ROOT"
msgstr "ROOT"
-#: elf/ldconfig.c:145
+#: elf/ldconfig.c:146
msgid "CACHE"
msgstr "CACHE"
-#: elf/ldconfig.c:145
+#: elf/ldconfig.c:146
msgid "Use CACHE as cache file"
msgstr "使用 CACHE 當作快å–檔案"
-#: elf/ldconfig.c:146
+#: elf/ldconfig.c:147
msgid "CONF"
msgstr "CONF"
-#: elf/ldconfig.c:146
+#: elf/ldconfig.c:147
msgid "Use CONF as configuration file"
msgstr "使用 CONF 當作設定檔"
-#: elf/ldconfig.c:147
+#: elf/ldconfig.c:148
msgid "Only process directories specified on the command line. Don't build cache."
msgstr "åªè™•ç†åœ¨å‘½ä»¤åˆ—引數中有指定的目錄,ä¸å»ºç«‹å¿«å–檔案。"
-#: elf/ldconfig.c:148
+#: elf/ldconfig.c:149
msgid "Manually link individual libraries."
msgstr "手動個別連çµå‡½å¼åº«"
-#: elf/ldconfig.c:149
+#: elf/ldconfig.c:150
msgid "FORMAT"
msgstr "FORMAT"
-#: elf/ldconfig.c:149
+#: elf/ldconfig.c:150
msgid "Format to use: new, old or compat (default)"
msgstr "將使用格å¼: æ–°ã€èˆŠæˆ–相容 (é è¨­)"
-#: elf/ldconfig.c:150
+#: elf/ldconfig.c:151
msgid "Ignore auxiliary cache file"
msgstr "忽略輔助設備快å–檔案"
-#: elf/ldconfig.c:158
+#: elf/ldconfig.c:159
msgid "Configure Dynamic Linker Run Time Bindings."
msgstr "設定執行時期動態連接"
-#: elf/ldconfig.c:341
+#: elf/ldconfig.c:346
#, c-format
msgid "Path `%s' given more than once"
msgstr "路徑 `%s' 使用超éŽä¸€æ¬¡"
-#: elf/ldconfig.c:381
+#: elf/ldconfig.c:386
#, c-format
msgid "%s is not a known library type"
msgstr "%s ä¸æ˜¯ä¸€å€‹å·²çŸ¥çš„函å¼åº«åž‹æ…‹"
-#: elf/ldconfig.c:409
+#: elf/ldconfig.c:414
#, c-format
msgid "Can't stat %s"
msgstr "無法 stat %s"
-#: elf/ldconfig.c:483
+#: elf/ldconfig.c:488
#, c-format
msgid "Can't stat %s\n"
msgstr "無法 stat %s\n"
-#: elf/ldconfig.c:493
+#: elf/ldconfig.c:498
#, c-format
msgid "%s is not a symbolic link\n"
msgstr "%s ä¸æ˜¯ä¸€å€‹ç¬¦è™Ÿé€£æŽ¥æª”\n"
-#: elf/ldconfig.c:512
+#: elf/ldconfig.c:517
#, c-format
msgid "Can't unlink %s"
msgstr "無法å–æ¶ˆé€£çµ %s"
-#: elf/ldconfig.c:518
+#: elf/ldconfig.c:523
#, c-format
msgid "Can't link %s to %s"
msgstr "無法從 %s 連çµåˆ° %s"
-#: elf/ldconfig.c:524
+#: elf/ldconfig.c:529
msgid " (changed)\n"
msgstr " (已改變)\n"
-#: elf/ldconfig.c:526
+#: elf/ldconfig.c:531
msgid " (SKIPPED)\n"
msgstr " (已忽略)\n"
-#: elf/ldconfig.c:581
+#: elf/ldconfig.c:586
#, c-format
msgid "Can't find %s"
msgstr "找ä¸åˆ° %s"
-#: elf/ldconfig.c:597 elf/ldconfig.c:770 elf/ldconfig.c:829 elf/ldconfig.c:863
+#: elf/ldconfig.c:602 elf/ldconfig.c:775 elf/ldconfig.c:834 elf/ldconfig.c:868
#, c-format
msgid "Cannot lstat %s"
msgstr "無法 lstat %s"
-#: elf/ldconfig.c:604
+#: elf/ldconfig.c:609
#, c-format
msgid "Ignored file %s since it is not a regular file."
msgstr "忽略檔案 %s 因為它ä¸æ˜¯ä¸€å€‹æ­£å¸¸çš„檔案。"
-#: elf/ldconfig.c:613
+#: elf/ldconfig.c:618
#, c-format
msgid "No link created since soname could not be found for %s"
msgstr "由於找ä¸åˆ° %s 的共用目的檔å稱,連çµä¸¦æœªè¢«å»ºç«‹"
-#: elf/ldconfig.c:696
+#: elf/ldconfig.c:701
#, c-format
msgid "Can't open directory %s"
msgstr "無法開啟目錄 %s"
-#: elf/ldconfig.c:788 elf/ldconfig.c:850 elf/readlib.c:90
+#: elf/ldconfig.c:793 elf/ldconfig.c:855 elf/readlib.c:90
#, c-format
msgid "Input file %s not found.\n"
msgstr "輸入檔 %s 找ä¸åˆ°ã€‚\n"
-#: elf/ldconfig.c:795
+#: elf/ldconfig.c:800
#, c-format
msgid "Cannot stat %s"
msgstr "無法顯示狀態 %s"
-#: elf/ldconfig.c:924
+#: elf/ldconfig.c:929
#, c-format
msgid "libc5 library %s in wrong directory"
msgstr "libc5 函å¼åº« %s 擺錯目錄了"
-#: elf/ldconfig.c:927
+#: elf/ldconfig.c:932
#, c-format
msgid "libc6 library %s in wrong directory"
msgstr "libc6 函å¼åº« %s 擺錯目錄了"
-#: elf/ldconfig.c:930
+#: elf/ldconfig.c:935
#, c-format
msgid "libc4 library %s in wrong directory"
msgstr "libc4 函å¼åº« %s 擺錯目錄了"
-#: elf/ldconfig.c:958
+#: elf/ldconfig.c:963
#, c-format
msgid "libraries %s and %s in directory %s have same soname but different type."
msgstr "函å¼åº« %s è·Ÿ %s (在目錄 %s 底下) 有共åŒçš„共用函å¼åº«å稱,ä¸éŽå…¶æ ¼å¼å»ä¸åŒ"
-#: elf/ldconfig.c:1067
+#: elf/ldconfig.c:1072
#, c-format
msgid "Warning: ignoring configuration file that cannot be opened: %s"
msgstr "警告:正在忽略無法開啟的組態檔案:%s"
-#: elf/ldconfig.c:1133
+#: elf/ldconfig.c:1138
#, c-format
msgid "%s:%u: bad syntax in hwcap line"
msgstr "%s:%u: 在 hwcap 列中有ä¸ç•¶çš„語法"
-#: elf/ldconfig.c:1139
+#: elf/ldconfig.c:1144
#, c-format
msgid "%s:%u: hwcap index %lu above maximum %u"
msgstr "%s:%u: hwcap 索引 %lu 以上的最大值 %u"
-#: elf/ldconfig.c:1146 elf/ldconfig.c:1154
+#: elf/ldconfig.c:1151 elf/ldconfig.c:1159
#, c-format
msgid "%s:%u: hwcap index %lu already defined as %s"
msgstr "%s:%u: hwcap 索引 %lu 已經被定義為 %s"
-#: elf/ldconfig.c:1157
+#: elf/ldconfig.c:1162
#, c-format
msgid "%s:%u: duplicate hwcap %lu %s"
msgstr "%s:%u: é‡è£½ hwcap %lu %s"
-#: elf/ldconfig.c:1179
+#: elf/ldconfig.c:1184
#, c-format
msgid "need absolute file name for configuration file when using -r"
msgstr "需è¦çµ•å°æª”案å稱用於組態檔案時正在使用 -r"
-#: elf/ldconfig.c:1186 locale/programs/xmalloc.c:65 malloc/obstack.c:433
-#: malloc/obstack.c:435 posix/getconf.c:1076 posix/getconf.c:1296
+#: elf/ldconfig.c:1191 locale/programs/xmalloc.c:64 malloc/obstack.c:432
+#: malloc/obstack.c:434 posix/getconf.c:1076 posix/getconf.c:1296
#, c-format
msgid "memory exhausted"
msgstr "記憶體耗盡"
-#: elf/ldconfig.c:1218
+#: elf/ldconfig.c:1223
#, c-format
msgid "%s:%u: cannot read directory %s"
msgstr "%s:%u: 無法讀å–目錄 %s"
-#: elf/ldconfig.c:1262
+#: elf/ldconfig.c:1267
#, c-format
msgid "relative path `%s' used to build cache"
msgstr "用來建置快å–的相å°è·¯å¾‘ `%s'"
-#: elf/ldconfig.c:1288
+#: elf/ldconfig.c:1297
#, c-format
msgid "Can't chdir to /"
msgstr "無法變更目錄到 /"
-#: elf/ldconfig.c:1329
+#: elf/ldconfig.c:1338
#, c-format
msgid "Can't open cache file directory %s\n"
msgstr "無法開啟快å–檔案目錄 %s\n"
@@ -1028,55 +1034,55 @@ msgstr "無法讀å–éˆçµæ˜ å°„"
msgid "cannot read object name"
msgstr "無法讀å–物件å稱"
-#: elf/pldd.c:65
+#: elf/pldd.c:62
msgid "List dynamic shared objects loaded into process."
msgstr "列出已載入行程中的動態共用物件。"
-#: elf/pldd.c:69
+#: elf/pldd.c:66
msgid "PID"
msgstr "行程識別號"
-#: elf/pldd.c:100
+#: elf/pldd.c:97
#, c-format
msgid "Exactly one parameter with process ID required.\n"
msgstr "需è¦å‰›å¥½ä¸€å€‹é™„有行程識別號的åƒæ•¸ã€‚\n"
-#: elf/pldd.c:112
+#: elf/pldd.c:109
#, c-format
msgid "invalid process ID '%s'"
msgstr "無效的行程識別號 %s"
-#: elf/pldd.c:120
+#: elf/pldd.c:117
#, c-format
msgid "cannot open %s"
msgstr "無法開啟 %s"
-#: elf/pldd.c:145
+#: elf/pldd.c:142
#, c-format
msgid "cannot open %s/task"
msgstr "無法開啟 %s/任務"
-#: elf/pldd.c:148
+#: elf/pldd.c:145
#, c-format
msgid "cannot prepare reading %s/task"
msgstr "ç„¡æ³•æº–å‚™è®€å– %s/任務"
-#: elf/pldd.c:161
+#: elf/pldd.c:158
#, c-format
msgid "invalid thread ID '%s'"
msgstr "無效的執行緒識別號 %s"
-#: elf/pldd.c:172
+#: elf/pldd.c:169
#, c-format
msgid "cannot attach to process %lu"
msgstr "無法附加到行程 %lu"
-#: elf/pldd.c:264
+#: elf/pldd.c:261
#, c-format
msgid "cannot get information about process %lu"
msgstr "無法ç²å¾—行程 %lu 的相關資訊"
-#: elf/pldd.c:277
+#: elf/pldd.c:274
#, c-format
msgid "process %lu is no ELF program"
msgstr "行程 %lu ä¸¦éž ELF 程å¼"
@@ -1236,147 +1242,147 @@ msgstr ""
msgid "%s: unrecognized option '%c%s'\\n"
msgstr "%s:無法辨識的é¸é …『%c%sã€\\n"
-#: elf/sprof.c:76
+#: elf/sprof.c:77
msgid "Output selection:"
msgstr "輸出é¸æ“‡:"
-#: elf/sprof.c:78
+#: elf/sprof.c:79
msgid "print list of count paths and their number of use"
msgstr "列出計數的路徑以åŠå®ƒå€‘使用的次數"
-#: elf/sprof.c:80
+#: elf/sprof.c:81
msgid "generate flat profile with counts and ticks"
msgstr "從執行次數與經歷時間的資料中產生直接的測速çµæžœ"
-#: elf/sprof.c:81
+#: elf/sprof.c:82
msgid "generate call graph"
msgstr "產生函å¼å‘¼å«åœ–å½¢"
-#: elf/sprof.c:88
+#: elf/sprof.c:89
msgid "Read and display shared object profiling data."
msgstr "讀å–和顯示共用物件è¦ç¯„資料。"
-#: elf/sprof.c:93
+#: elf/sprof.c:94
msgid "SHOBJ [PROFDATA]"
msgstr "SHOBJ [PROFDATA]"
-#: elf/sprof.c:432
+#: elf/sprof.c:433
#, c-format
msgid "failed to load shared object `%s'"
msgstr "開啟共用目的檔 `%s' 失敗"
-#: elf/sprof.c:441
+#: elf/sprof.c:442
#, c-format
msgid "cannot create internal descriptors"
msgstr "無法建立內部敘述項"
-#: elf/sprof.c:553
+#: elf/sprof.c:554
#, c-format
msgid "Reopening shared object `%s' failed"
msgstr "é‡æ–°é–‹å•Ÿå…±ç”¨ç›®çš„檔 %s 失敗"
-#: elf/sprof.c:560 elf/sprof.c:655
+#: elf/sprof.c:561 elf/sprof.c:656
#, c-format
msgid "reading of section headers failed"
msgstr "讀å–å°ç¯€æ¨™é ­æ™‚失敗"
-#: elf/sprof.c:568 elf/sprof.c:663
+#: elf/sprof.c:569 elf/sprof.c:664
#, c-format
msgid "reading of section header string table failed"
msgstr "讀å–å°ç¯€æ¨™é ­å­—串表格時失敗"
-#: elf/sprof.c:594
+#: elf/sprof.c:595
#, c-format
msgid "*** Cannot read debuginfo file name: %m\n"
msgstr "*** 無法讀å–除錯資訊檔案å稱:%m\n"
-#: elf/sprof.c:615
+#: elf/sprof.c:616
#, c-format
msgid "cannot determine file name"
msgstr "無法決定檔案å稱"
-#: elf/sprof.c:648
+#: elf/sprof.c:649
#, c-format
msgid "reading of ELF header failed"
msgstr "è®€å– ELF 標頭時失敗"
-#: elf/sprof.c:684
+#: elf/sprof.c:685
#, c-format
msgid "*** The file `%s' is stripped: no detailed analysis possible\n"
msgstr "*** 檔案 `%s' 被è£å‰ªäº†: 無法åšè©³ç´°çš„分æž\n"
-#: elf/sprof.c:714
+#: elf/sprof.c:715
#, c-format
msgid "failed to load symbol data"
msgstr "載入函å¼ç¬¦è™Ÿè³‡æ–™å¤±æ•—"
-#: elf/sprof.c:779
+#: elf/sprof.c:780
#, c-format
msgid "cannot load profiling data"
msgstr "無法載入測試資料"
-#: elf/sprof.c:788
+#: elf/sprof.c:789
#, c-format
msgid "while stat'ing profiling data file"
msgstr "在å°æ¸¬è©¦è³‡æ–™æª”案進行統計的時候"
-#: elf/sprof.c:796
+#: elf/sprof.c:797
#, c-format
msgid "profiling data file `%s' does not match shared object `%s'"
msgstr "測試資料檔 `%s' 與共用目的檔 `%s' ä¸ç¬¦åˆ"
-#: elf/sprof.c:807
+#: elf/sprof.c:808
#, c-format
msgid "failed to mmap the profiling data file"
msgstr "測試資料檔案 mmap 失敗"
-#: elf/sprof.c:815
+#: elf/sprof.c:816
#, c-format
msgid "error while closing the profiling data file"
msgstr "正在關閉測試資料檔案時發生錯誤"
-#: elf/sprof.c:824 elf/sprof.c:922
+#: elf/sprof.c:825 elf/sprof.c:923
#, c-format
msgid "cannot create internal descriptor"
msgstr "無法建立內部敘述項"
-#: elf/sprof.c:898
+#: elf/sprof.c:899
#, c-format
msgid "`%s' is no correct profile data file for `%s'"
msgstr "`%s' ä¸æ˜¯ `%s' 中正確的測速評估資料檔"
-#: elf/sprof.c:1079 elf/sprof.c:1137
+#: elf/sprof.c:1080 elf/sprof.c:1138
#, c-format
msgid "cannot allocate symbol data"
msgstr "無法é…置函å¼ç¬¦è™Ÿè³‡æ–™"
-#: iconv/iconv_charmap.c:143 iconv/iconv_prog.c:448
+#: iconv/iconv_charmap.c:141 iconv/iconv_prog.c:448
#, c-format
msgid "cannot open output file"
msgstr "無法開啟輸出檔"
-#: iconv/iconv_charmap.c:189 iconv/iconv_prog.c:311
+#: iconv/iconv_charmap.c:187 iconv/iconv_prog.c:311
#, c-format
msgid "error while closing input `%s'"
msgstr "正在關閉輸入 `%s' 的時候發生錯誤"
-#: iconv/iconv_charmap.c:463
+#: iconv/iconv_charmap.c:461
#, c-format
msgid "illegal input sequence at position %Zd"
msgstr "ä½ç½® %Zd 有ä¸åˆæ³•çš„輸入åºåˆ—"
-#: iconv/iconv_charmap.c:482 iconv/iconv_prog.c:539
+#: iconv/iconv_charmap.c:480 iconv/iconv_prog.c:539
#, c-format
msgid "incomplete character or shift sequence at end of buffer"
msgstr "ç·©è¡å€çµå°¾æœ‰ä¸å®Œå…¨çš„字元或 shift sequence"
-#: iconv/iconv_charmap.c:527 iconv/iconv_charmap.c:563 iconv/iconv_prog.c:582
+#: iconv/iconv_charmap.c:525 iconv/iconv_charmap.c:561 iconv/iconv_prog.c:582
#: iconv/iconv_prog.c:618
#, c-format
msgid "error while reading the input"
msgstr "正在讀入資料的時候發生錯誤"
-#: iconv/iconv_charmap.c:545 iconv/iconv_prog.c:600
+#: iconv/iconv_charmap.c:543 iconv/iconv_prog.c:600
#, c-format
msgid "unable to allocate buffer for input"
msgstr "無法é…置輸入用的緩è¡å€"
@@ -1401,7 +1407,7 @@ msgstr "資料:"
msgid "list all known coded character sets"
msgstr "列出所有已知的編碼字元集"
-#: iconv/iconv_prog.c:64 locale/programs/localedef.c:126
+#: iconv/iconv_prog.c:64 locale/programs/localedef.c:127
msgid "Output control:"
msgstr "輸出控制:"
@@ -1409,6 +1415,13 @@ msgstr "輸出控制:"
msgid "omit invalid characters from output"
msgstr "çœç•¥ç„¡æ•ˆå­—元的輸出"
+#: iconv/iconv_prog.c:66 iconv/iconvconfig.c:128
+#: locale/programs/localedef.c:120 locale/programs/localedef.c:122
+#: locale/programs/localedef.c:124 locale/programs/localedef.c:145
+#: malloc/memusagestat.c:56
+msgid "FILE"
+msgstr "檔案"
+
#: iconv/iconv_prog.c:66
msgid "output file"
msgstr "輸出檔案"
@@ -1502,34 +1515,38 @@ msgstr "建立快速載入 iconv 模組的設定檔案。"
msgid "[DIR...]"
msgstr "[目錄…]"
-#: iconv/iconvconfig.c:126
+#: iconv/iconvconfig.c:126 locale/programs/localedef.c:131
+msgid "PATH"
+msgstr "路徑"
+
+#: iconv/iconvconfig.c:127
msgid "Prefix used for all file accesses"
msgstr "使用於所有檔案存å–時的å‰ç½®æ–‡å­—"
-#: iconv/iconvconfig.c:127
+#: iconv/iconvconfig.c:128
msgid "Put output in FILE instead of installed location (--prefix does not apply to FILE)"
msgstr "在 FILE 中置放輸出以代替已安è£çš„ä½ç½® (--prefix ä¸å¥—用到 FILE)"
-#: iconv/iconvconfig.c:131
+#: iconv/iconvconfig.c:132
msgid "Do not search standard directories, only those on the command line"
msgstr "ä¸æœå°‹æ¨™æº–目錄,åªæœ‰é‚£äº›åœ¨ä¹‹ä¸Šå‘½ä»¤åˆ—"
-#: iconv/iconvconfig.c:303
+#: iconv/iconvconfig.c:299
#, c-format
msgid "Directory arguments required when using --nostdlib"
msgstr "目錄引數必è¦é …時正在使用 --nostdlib"
-#: iconv/iconvconfig.c:345 locale/programs/localedef.c:287
+#: iconv/iconvconfig.c:341 locale/programs/localedef.c:288
#, c-format
msgid "no output file produced because warnings were issued"
msgstr "因為發出éŽè­¦å‘Šè¨Šæ¯ï¼Œæ‰€ä»¥æ²’有製造任何輸出檔"
-#: iconv/iconvconfig.c:434
+#: iconv/iconvconfig.c:430
#, c-format
msgid "while inserting in search tree"
msgstr "當æ’入於æœå°‹æ¨¹ä¹‹ä¸­"
-#: iconv/iconvconfig.c:1243
+#: iconv/iconvconfig.c:1239
#, c-format
msgid "cannot generate output file"
msgstr "無法產生輸出檔"
@@ -1616,789 +1633,789 @@ msgstr "移除密碼或讓他人無法讀å–檔案"
msgid "Unknown .netrc keyword %s"
msgstr "未知的 .netrc é—œéµå­— %s"
-#: libidn/nfkc.c:462
+#: libidn/nfkc.c:463
msgid "Character out of range for UTF-8"
msgstr "字元超出 UTF-8 範åœ"
-#: locale/programs/charmap-dir.c:58
+#: locale/programs/charmap-dir.c:57
#, c-format
msgid "cannot read character map directory `%s'"
msgstr "無法讀å–字集å°ç…§æª”目錄 `%s'"
-#: locale/programs/charmap.c:137
+#: locale/programs/charmap.c:138
#, c-format
msgid "character map file `%s' not found"
msgstr "找ä¸åˆ°å­—集å°ç…§æª” `%s'"
-#: locale/programs/charmap.c:194
+#: locale/programs/charmap.c:195
#, c-format
msgid "default character map file `%s' not found"
msgstr "找ä¸åˆ°é è¨­çš„字集å°ç…§æª” `%s'"
-#: locale/programs/charmap.c:257
+#: locale/programs/charmap.c:258
#, c-format
msgid "character map `%s' is not ASCII compatible, locale not ISO C compliant\n"
msgstr "å­—å…ƒå°æ‡‰ `%s' ä¸æ˜¯ ASCII 相容碼,å€åŸŸåŒ–資料庫ä¸ç¬¦åˆ ISO C\n"
-#: locale/programs/charmap.c:336
+#: locale/programs/charmap.c:337
#, c-format
msgid "%s: <mb_cur_max> must be greater than <mb_cur_min>\n"
msgstr "%s: <mb_cur_max> 必須大於 <mb_cur_min>\n"
-#: locale/programs/charmap.c:356 locale/programs/charmap.c:373
-#: locale/programs/repertoire.c:173
+#: locale/programs/charmap.c:357 locale/programs/charmap.c:374
+#: locale/programs/repertoire.c:174
#, c-format
msgid "syntax error in prolog: %s"
msgstr "prolog 中有語法錯誤: %s"
-#: locale/programs/charmap.c:357
+#: locale/programs/charmap.c:358
msgid "invalid definition"
msgstr "無效的定義"
-#: locale/programs/charmap.c:374 locale/programs/locfile.c:125
-#: locale/programs/locfile.c:152 locale/programs/repertoire.c:174
+#: locale/programs/charmap.c:375 locale/programs/locfile.c:125
+#: locale/programs/locfile.c:152 locale/programs/repertoire.c:175
msgid "bad argument"
msgstr "錯誤的引數"
-#: locale/programs/charmap.c:402
+#: locale/programs/charmap.c:403
#, c-format
msgid "duplicate definition of <%s>"
msgstr "<%s> 的定義é‡è¤‡äº†"
-#: locale/programs/charmap.c:409
+#: locale/programs/charmap.c:410
#, c-format
msgid "value for <%s> must be 1 or greater"
msgstr "<%s> 的值必須為 1 或者更大"
-#: locale/programs/charmap.c:421
+#: locale/programs/charmap.c:422
#, c-format
msgid "value of <%s> must be greater or equal than the value of <%s>"
msgstr "<%s> 的值必須等於或大於 <%s> 的值"
-#: locale/programs/charmap.c:444 locale/programs/repertoire.c:182
+#: locale/programs/charmap.c:445 locale/programs/repertoire.c:183
#, c-format
msgid "argument to <%s> must be a single character"
msgstr "給 <%s> 的引數必須是一個單字元"
-#: locale/programs/charmap.c:470
+#: locale/programs/charmap.c:471
msgid "character sets with locking states are not supported"
msgstr "ä¸æ”¯æ´ä½¿ç”¨ locking 狀態的字元集"
-#: locale/programs/charmap.c:497 locale/programs/charmap.c:551
-#: locale/programs/charmap.c:583 locale/programs/charmap.c:677
-#: locale/programs/charmap.c:732 locale/programs/charmap.c:773
-#: locale/programs/charmap.c:814
+#: locale/programs/charmap.c:498 locale/programs/charmap.c:552
+#: locale/programs/charmap.c:584 locale/programs/charmap.c:678
+#: locale/programs/charmap.c:733 locale/programs/charmap.c:774
+#: locale/programs/charmap.c:815
#, c-format
msgid "syntax error in %s definition: %s"
msgstr "定義 %s 的語法錯誤: %s"
-#: locale/programs/charmap.c:498 locale/programs/charmap.c:678
-#: locale/programs/charmap.c:774 locale/programs/repertoire.c:229
+#: locale/programs/charmap.c:499 locale/programs/charmap.c:679
+#: locale/programs/charmap.c:775 locale/programs/repertoire.c:230
msgid "no symbolic name given"
msgstr "沒有給予符號å稱"
-#: locale/programs/charmap.c:552
+#: locale/programs/charmap.c:553
msgid "invalid encoding given"
msgstr "給予的編碼是無效的"
-#: locale/programs/charmap.c:561
+#: locale/programs/charmap.c:562
msgid "too few bytes in character encoding"
msgstr "字元定義中的ä½å…ƒçµ„太少了"
-#: locale/programs/charmap.c:563
+#: locale/programs/charmap.c:564
msgid "too many bytes in character encoding"
msgstr "字元定義中的ä½å…ƒçµ„太多了"
-#: locale/programs/charmap.c:585 locale/programs/charmap.c:733
-#: locale/programs/charmap.c:816 locale/programs/repertoire.c:295
+#: locale/programs/charmap.c:586 locale/programs/charmap.c:734
+#: locale/programs/charmap.c:817 locale/programs/repertoire.c:296
msgid "no symbolic name given for end of range"
msgstr "沒有給此å€çš„最後一個字元符號å稱"
-#: locale/programs/charmap.c:609 locale/programs/ld-address.c:601
-#: locale/programs/ld-collate.c:2766 locale/programs/ld-collate.c:3924
-#: locale/programs/ld-ctype.c:2255 locale/programs/ld-ctype.c:3006
-#: locale/programs/ld-identification.c:451
-#: locale/programs/ld-measurement.c:237 locale/programs/ld-messages.c:331
-#: locale/programs/ld-monetary.c:942 locale/programs/ld-name.c:306
-#: locale/programs/ld-numeric.c:367 locale/programs/ld-paper.c:240
-#: locale/programs/ld-telephone.c:312 locale/programs/ld-time.c:1220
-#: locale/programs/repertoire.c:312
+#: locale/programs/charmap.c:610 locale/programs/ld-address.c:602
+#: locale/programs/ld-collate.c:2767 locale/programs/ld-collate.c:3925
+#: locale/programs/ld-ctype.c:2256 locale/programs/ld-ctype.c:3007
+#: locale/programs/ld-identification.c:452
+#: locale/programs/ld-measurement.c:238 locale/programs/ld-messages.c:332
+#: locale/programs/ld-monetary.c:942 locale/programs/ld-name.c:307
+#: locale/programs/ld-numeric.c:368 locale/programs/ld-paper.c:241
+#: locale/programs/ld-telephone.c:313 locale/programs/ld-time.c:1221
+#: locale/programs/repertoire.c:313
#, c-format
msgid "%1$s: definition does not end with `END %1$s'"
msgstr "%1$s: 定義並沒有以 `END %1$s' åšç‚ºçµæŸ"
-#: locale/programs/charmap.c:642
+#: locale/programs/charmap.c:643
msgid "only WIDTH definitions are allowed to follow the CHARMAP definition"
msgstr "åªæœ‰ WIDTH 定義æ‰èƒ½ç›´æŽ¥å¯«åœ¨ CHARMAP 定義之後"
-#: locale/programs/charmap.c:650 locale/programs/charmap.c:713
+#: locale/programs/charmap.c:651 locale/programs/charmap.c:714
#, c-format
msgid "value for %s must be an integer"
msgstr "%s 的值必須是整數æ‰è¡Œ"
-#: locale/programs/charmap.c:841
+#: locale/programs/charmap.c:842
#, c-format
msgid "%s: error in state machine"
msgstr "%s: 狀態機錯誤"
-#: locale/programs/charmap.c:849 locale/programs/ld-address.c:617
-#: locale/programs/ld-collate.c:2763 locale/programs/ld-collate.c:4117
-#: locale/programs/ld-ctype.c:2252 locale/programs/ld-ctype.c:3023
-#: locale/programs/ld-identification.c:467
-#: locale/programs/ld-measurement.c:253 locale/programs/ld-messages.c:347
-#: locale/programs/ld-monetary.c:958 locale/programs/ld-name.c:322
-#: locale/programs/ld-numeric.c:383 locale/programs/ld-paper.c:256
-#: locale/programs/ld-telephone.c:328 locale/programs/ld-time.c:1236
-#: locale/programs/locfile.c:825 locale/programs/repertoire.c:323
+#: locale/programs/charmap.c:850 locale/programs/ld-address.c:618
+#: locale/programs/ld-collate.c:2764 locale/programs/ld-collate.c:4118
+#: locale/programs/ld-ctype.c:2253 locale/programs/ld-ctype.c:3024
+#: locale/programs/ld-identification.c:468
+#: locale/programs/ld-measurement.c:254 locale/programs/ld-messages.c:348
+#: locale/programs/ld-monetary.c:958 locale/programs/ld-name.c:323
+#: locale/programs/ld-numeric.c:384 locale/programs/ld-paper.c:257
+#: locale/programs/ld-telephone.c:329 locale/programs/ld-time.c:1237
+#: locale/programs/locfile.c:825 locale/programs/repertoire.c:324
#, c-format
msgid "%s: premature end of file"
msgstr "%s: 未完æˆå·²é”檔案的末尾"
-#: locale/programs/charmap.c:868 locale/programs/charmap.c:879
+#: locale/programs/charmap.c:869 locale/programs/charmap.c:880
#, c-format
msgid "unknown character `%s'"
msgstr "ä¸æ˜Žçš„å­—å…ƒ `%s'"
-#: locale/programs/charmap.c:887
+#: locale/programs/charmap.c:888
#, c-format
msgid "number of bytes for byte sequence of beginning and end of range not the same: %d vs %d"
msgstr "在範åœèµ·å§‹èˆ‡çµæŸçš„ä½å…ƒçµ„åºåˆ—中,ä½å…ƒçµ„的數目並ä¸ä¸€è‡´: %d vs %d"
-#: locale/programs/charmap.c:992 locale/programs/ld-collate.c:3043
-#: locale/programs/repertoire.c:418
+#: locale/programs/charmap.c:993 locale/programs/ld-collate.c:3044
+#: locale/programs/repertoire.c:419
msgid "invalid names for character range"
msgstr "無效的字元範åœå稱"
-#: locale/programs/charmap.c:1004 locale/programs/repertoire.c:430
+#: locale/programs/charmap.c:1005 locale/programs/repertoire.c:431
msgid "hexadecimal range format should use only capital characters"
msgstr "在表示å六進ä½çš„範åœæ™‚åªèƒ½ç”¨å¤§å¯«çš„英文字æ¯è¡¨ç¤º"
-#: locale/programs/charmap.c:1022 locale/programs/repertoire.c:448
+#: locale/programs/charmap.c:1023 locale/programs/repertoire.c:449
#, c-format
msgid "<%s> and <%s> are invalid names for range"
msgstr "<%s> ä»¥åŠ <%s> 是ä¸é©ç”¨çš„範åœå稱"
-#: locale/programs/charmap.c:1028 locale/programs/repertoire.c:455
+#: locale/programs/charmap.c:1029 locale/programs/repertoire.c:456
msgid "upper limit in range is smaller than lower limit"
msgstr "範åœä¸­ä¸Šé™å°æ–¼ä¸‹é™"
-#: locale/programs/charmap.c:1086
+#: locale/programs/charmap.c:1087
msgid "resulting bytes for range not representable."
msgstr "用來定義範åœçš„ä½å…ƒçµ„無法被表述出來"
-#: locale/programs/ld-address.c:134 locale/programs/ld-collate.c:1557
-#: locale/programs/ld-ctype.c:420 locale/programs/ld-identification.c:132
-#: locale/programs/ld-measurement.c:93 locale/programs/ld-messages.c:96
-#: locale/programs/ld-monetary.c:193 locale/programs/ld-name.c:93
-#: locale/programs/ld-numeric.c:97 locale/programs/ld-paper.c:90
-#: locale/programs/ld-telephone.c:93 locale/programs/ld-time.c:158
+#: locale/programs/ld-address.c:135 locale/programs/ld-collate.c:1558
+#: locale/programs/ld-ctype.c:421 locale/programs/ld-identification.c:133
+#: locale/programs/ld-measurement.c:94 locale/programs/ld-messages.c:97
+#: locale/programs/ld-monetary.c:193 locale/programs/ld-name.c:94
+#: locale/programs/ld-numeric.c:98 locale/programs/ld-paper.c:91
+#: locale/programs/ld-telephone.c:94 locale/programs/ld-time.c:159
#, c-format
msgid "No definition for %s category found"
msgstr "找ä¸åˆ° %s 類別的定義"
-#: locale/programs/ld-address.c:145 locale/programs/ld-address.c:183
-#: locale/programs/ld-address.c:201 locale/programs/ld-address.c:230
-#: locale/programs/ld-address.c:302 locale/programs/ld-address.c:321
-#: locale/programs/ld-address.c:334 locale/programs/ld-identification.c:145
-#: locale/programs/ld-measurement.c:104 locale/programs/ld-monetary.c:205
+#: locale/programs/ld-address.c:146 locale/programs/ld-address.c:184
+#: locale/programs/ld-address.c:202 locale/programs/ld-address.c:231
+#: locale/programs/ld-address.c:303 locale/programs/ld-address.c:322
+#: locale/programs/ld-address.c:335 locale/programs/ld-identification.c:146
+#: locale/programs/ld-measurement.c:105 locale/programs/ld-monetary.c:205
#: locale/programs/ld-monetary.c:249 locale/programs/ld-monetary.c:265
-#: locale/programs/ld-monetary.c:277 locale/programs/ld-name.c:104
-#: locale/programs/ld-name.c:141 locale/programs/ld-numeric.c:111
-#: locale/programs/ld-numeric.c:125 locale/programs/ld-paper.c:101
-#: locale/programs/ld-paper.c:110 locale/programs/ld-telephone.c:104
-#: locale/programs/ld-telephone.c:161 locale/programs/ld-time.c:174
-#: locale/programs/ld-time.c:195
+#: locale/programs/ld-monetary.c:277 locale/programs/ld-name.c:105
+#: locale/programs/ld-name.c:142 locale/programs/ld-numeric.c:112
+#: locale/programs/ld-numeric.c:126 locale/programs/ld-paper.c:102
+#: locale/programs/ld-paper.c:111 locale/programs/ld-telephone.c:105
+#: locale/programs/ld-telephone.c:162 locale/programs/ld-time.c:175
+#: locale/programs/ld-time.c:196
#, c-format
msgid "%s: field `%s' not defined"
msgstr "%s: æ¬„ä½ `%s' 沒有定義"
-#: locale/programs/ld-address.c:157 locale/programs/ld-address.c:209
-#: locale/programs/ld-address.c:239 locale/programs/ld-address.c:277
-#: locale/programs/ld-name.c:116 locale/programs/ld-telephone.c:116
+#: locale/programs/ld-address.c:158 locale/programs/ld-address.c:210
+#: locale/programs/ld-address.c:240 locale/programs/ld-address.c:278
+#: locale/programs/ld-name.c:117 locale/programs/ld-telephone.c:117
#, c-format
msgid "%s: field `%s' must not be empty"
msgstr "%s: æ¬„ä½ `%s' ä¸å¯ä»¥ç©ºç™½"
-#: locale/programs/ld-address.c:169
+#: locale/programs/ld-address.c:170
#, c-format
msgid "%s: invalid escape `%%%c' sequence in field `%s'"
msgstr "%s: ä¸é©ç”¨çš„跳脫åºåˆ— `%%%c', åœ¨æ¬„ä½ `%s' 中"
-#: locale/programs/ld-address.c:220
+#: locale/programs/ld-address.c:221
#, c-format
msgid "%s: terminology language code `%s' not defined"
msgstr "%s: 術語語言編碼 `%s' 未定義"
-#: locale/programs/ld-address.c:245
+#: locale/programs/ld-address.c:246
#, c-format
msgid "%s: field `%s' must not be defined"
msgstr "%s: 欄ä½ã€Œ%sã€å¿…須未被定義"
-#: locale/programs/ld-address.c:259 locale/programs/ld-address.c:288
+#: locale/programs/ld-address.c:260 locale/programs/ld-address.c:289
#, c-format
msgid "%s: language abbreviation `%s' not defined"
msgstr "%s: 語言縮寫 `%s' 沒有定義"
-#: locale/programs/ld-address.c:266 locale/programs/ld-address.c:294
-#: locale/programs/ld-address.c:328 locale/programs/ld-address.c:340
+#: locale/programs/ld-address.c:267 locale/programs/ld-address.c:295
+#: locale/programs/ld-address.c:329 locale/programs/ld-address.c:341
#, c-format
msgid "%s: `%s' value does not match `%s' value"
msgstr "%s: `%s' 值與 `%s' 值ä¸ç¬¦åˆ"
-#: locale/programs/ld-address.c:313
+#: locale/programs/ld-address.c:314
#, c-format
msgid "%s: numeric country code `%d' not valid"
msgstr "%s: 國家數字代碼 `%d' 錯誤"
-#: locale/programs/ld-address.c:509 locale/programs/ld-address.c:546
-#: locale/programs/ld-address.c:584 locale/programs/ld-ctype.c:2630
-#: locale/programs/ld-identification.c:363
-#: locale/programs/ld-measurement.c:220 locale/programs/ld-messages.c:300
+#: locale/programs/ld-address.c:510 locale/programs/ld-address.c:547
+#: locale/programs/ld-address.c:585 locale/programs/ld-ctype.c:2631
+#: locale/programs/ld-identification.c:364
+#: locale/programs/ld-measurement.c:221 locale/programs/ld-messages.c:301
#: locale/programs/ld-monetary.c:700 locale/programs/ld-monetary.c:735
-#: locale/programs/ld-monetary.c:776 locale/programs/ld-name.c:279
-#: locale/programs/ld-numeric.c:262 locale/programs/ld-paper.c:223
-#: locale/programs/ld-telephone.c:287 locale/programs/ld-time.c:1125
-#: locale/programs/ld-time.c:1167
+#: locale/programs/ld-monetary.c:776 locale/programs/ld-name.c:280
+#: locale/programs/ld-numeric.c:263 locale/programs/ld-paper.c:224
+#: locale/programs/ld-telephone.c:288 locale/programs/ld-time.c:1126
+#: locale/programs/ld-time.c:1168
#, c-format
msgid "%s: field `%s' declared more than once"
msgstr "%s: `%s' 欄ä½ä¸åªä¸€æ¬¡åœ°å®£å‘Š"
-#: locale/programs/ld-address.c:513 locale/programs/ld-address.c:551
-#: locale/programs/ld-identification.c:367 locale/programs/ld-messages.c:310
+#: locale/programs/ld-address.c:514 locale/programs/ld-address.c:552
+#: locale/programs/ld-identification.c:368 locale/programs/ld-messages.c:311
#: locale/programs/ld-monetary.c:704 locale/programs/ld-monetary.c:739
-#: locale/programs/ld-name.c:283 locale/programs/ld-numeric.c:266
-#: locale/programs/ld-telephone.c:291 locale/programs/ld-time.c:1019
-#: locale/programs/ld-time.c:1088 locale/programs/ld-time.c:1130
+#: locale/programs/ld-name.c:284 locale/programs/ld-numeric.c:267
+#: locale/programs/ld-telephone.c:292 locale/programs/ld-time.c:1020
+#: locale/programs/ld-time.c:1089 locale/programs/ld-time.c:1131
#, c-format
msgid "%s: unknown character in field `%s'"
msgstr "%s: æœªçŸ¥çš„å­—å…ƒåœ¨æ¬„ä½ `%s' 中"
-#: locale/programs/ld-address.c:598 locale/programs/ld-collate.c:3922
-#: locale/programs/ld-ctype.c:3003 locale/programs/ld-identification.c:448
-#: locale/programs/ld-measurement.c:234 locale/programs/ld-messages.c:329
-#: locale/programs/ld-monetary.c:940 locale/programs/ld-name.c:304
-#: locale/programs/ld-numeric.c:365 locale/programs/ld-paper.c:238
-#: locale/programs/ld-telephone.c:310 locale/programs/ld-time.c:1218
+#: locale/programs/ld-address.c:599 locale/programs/ld-collate.c:3923
+#: locale/programs/ld-ctype.c:3004 locale/programs/ld-identification.c:449
+#: locale/programs/ld-measurement.c:235 locale/programs/ld-messages.c:330
+#: locale/programs/ld-monetary.c:940 locale/programs/ld-name.c:305
+#: locale/programs/ld-numeric.c:366 locale/programs/ld-paper.c:239
+#: locale/programs/ld-telephone.c:311 locale/programs/ld-time.c:1219
#, c-format
msgid "%s: incomplete `END' line"
msgstr "%s: ä¸å®Œæ•´çš„ `END' 列"
-#: locale/programs/ld-address.c:608 locale/programs/ld-collate.c:543
-#: locale/programs/ld-collate.c:595 locale/programs/ld-collate.c:891
-#: locale/programs/ld-collate.c:904 locale/programs/ld-collate.c:2732
-#: locale/programs/ld-collate.c:2753 locale/programs/ld-collate.c:4107
-#: locale/programs/ld-ctype.c:1984 locale/programs/ld-ctype.c:2242
-#: locale/programs/ld-ctype.c:2828 locale/programs/ld-ctype.c:3014
-#: locale/programs/ld-identification.c:458
-#: locale/programs/ld-measurement.c:244 locale/programs/ld-messages.c:338
-#: locale/programs/ld-monetary.c:949 locale/programs/ld-name.c:313
-#: locale/programs/ld-numeric.c:374 locale/programs/ld-paper.c:247
-#: locale/programs/ld-telephone.c:319 locale/programs/ld-time.c:1227
+#: locale/programs/ld-address.c:609 locale/programs/ld-collate.c:544
+#: locale/programs/ld-collate.c:596 locale/programs/ld-collate.c:892
+#: locale/programs/ld-collate.c:905 locale/programs/ld-collate.c:2733
+#: locale/programs/ld-collate.c:2754 locale/programs/ld-collate.c:4108
+#: locale/programs/ld-ctype.c:1985 locale/programs/ld-ctype.c:2243
+#: locale/programs/ld-ctype.c:2829 locale/programs/ld-ctype.c:3015
+#: locale/programs/ld-identification.c:459
+#: locale/programs/ld-measurement.c:245 locale/programs/ld-messages.c:339
+#: locale/programs/ld-monetary.c:949 locale/programs/ld-name.c:314
+#: locale/programs/ld-numeric.c:375 locale/programs/ld-paper.c:248
+#: locale/programs/ld-telephone.c:320 locale/programs/ld-time.c:1228
#, c-format
msgid "%s: syntax error"
msgstr "%s: 語法錯誤"
-#: locale/programs/ld-collate.c:418
+#: locale/programs/ld-collate.c:419
#, c-format
msgid "`%.*s' already defined in charmap"
msgstr "`%.*s' 在字集å°ç…§è¡¨ä¸­å·²ç¶“定義éŽäº†"
-#: locale/programs/ld-collate.c:427
+#: locale/programs/ld-collate.c:428
#, c-format
msgid "`%.*s' already defined in repertoire"
msgstr "`%.*s' 在編碼å°æ˜ æª”中已經被定義éŽäº†"
-#: locale/programs/ld-collate.c:434
+#: locale/programs/ld-collate.c:435
#, c-format
msgid "`%.*s' already defined as collating symbol"
msgstr "`%.*s' 已被定義為å°ç…§ç¬¦è™Ÿ"
-#: locale/programs/ld-collate.c:441
+#: locale/programs/ld-collate.c:442
#, c-format
msgid "`%.*s' already defined as collating element"
msgstr "`%.*s' 已被定義為å°ç…§å…ƒç´ "
-#: locale/programs/ld-collate.c:472 locale/programs/ld-collate.c:498
+#: locale/programs/ld-collate.c:473 locale/programs/ld-collate.c:499
#, c-format
msgid "%s: `forward' and `backward' are mutually excluding each other"
msgstr "%s: `forward' ä»¥åŠ `backward' 彼此互相排斥"
-#: locale/programs/ld-collate.c:482 locale/programs/ld-collate.c:508
-#: locale/programs/ld-collate.c:524
+#: locale/programs/ld-collate.c:483 locale/programs/ld-collate.c:509
+#: locale/programs/ld-collate.c:525
#, c-format
msgid "%s: `%s' mentioned more than once in definition of weight %d"
msgstr "%s: `%s' ä¸åªä¸€æ¬¡åœ°åœ¨æ¬Šé‡ %d 中被æ到"
-#: locale/programs/ld-collate.c:580
+#: locale/programs/ld-collate.c:581
#, c-format
msgid "%s: too many rules; first entry only had %d"
msgstr "%s: 太多è¦å‰‡ï¼›ç¬¬ä¸€å€‹é …ç›®åªåŒ…å« %d"
-#: locale/programs/ld-collate.c:616
+#: locale/programs/ld-collate.c:617
#, c-format
msgid "%s: not enough sorting rules"
msgstr "%s: 排åºè¦å‰‡ä¸è¶³"
-#: locale/programs/ld-collate.c:781
+#: locale/programs/ld-collate.c:782
#, c-format
msgid "%s: empty weight string not allowed"
msgstr "%s: 空白的權é‡å­—串是ä¸å…許的"
-#: locale/programs/ld-collate.c:876
+#: locale/programs/ld-collate.c:877
#, c-format
msgid "%s: weights must use the same ellipsis symbol as the name"
msgstr "%s: 權é‡å¿…須使用與å稱相åŒçš„çœç•¥ç¬¦è™Ÿ"
-#: locale/programs/ld-collate.c:932
+#: locale/programs/ld-collate.c:933
#, c-format
msgid "%s: too many values"
msgstr "%s: 太多變數值"
-#: locale/programs/ld-collate.c:1052 locale/programs/ld-collate.c:1227
+#: locale/programs/ld-collate.c:1053 locale/programs/ld-collate.c:1228
#, c-format
msgid "order for `%.*s' already defined at %s:%Zu"
msgstr "`%.*s' çš„é †åºå·²ç¶“在 %s:%Zu 裡é¢å®šç¾©äº†"
-#: locale/programs/ld-collate.c:1102
+#: locale/programs/ld-collate.c:1103
#, c-format
msgid "%s: the start and the end symbol of a range must stand for characters"
msgstr "%s: 啟始與çµæŸç¬¦è™Ÿç¯„åœå¿…須代表字元"
-#: locale/programs/ld-collate.c:1129
+#: locale/programs/ld-collate.c:1130
#, c-format
msgid "%s: byte sequences of first and last character must have the same length"
msgstr "%s: 第一個與最後一個字元的ä½å…ƒçµ„åºåˆ—必須有相åŒçš„長度"
-#: locale/programs/ld-collate.c:1171
+#: locale/programs/ld-collate.c:1172
#, c-format
msgid "%s: byte sequence of first character of range is not lower than that of the last character"
msgstr "%s: 範åœé¦–字元的ä½å…ƒçµ„åºåˆ—沒有低於末字元的ä½å…ƒçµ„åºåˆ—"
-#: locale/programs/ld-collate.c:1296
+#: locale/programs/ld-collate.c:1297
#, c-format
msgid "%s: symbolic range ellipsis must not directly follow `order_start'"
msgstr "%s: 符號範åœçš„çœç•¥ä¸å¯ä»¥ç›´æŽ¥åœ¨ `order_start' 之後"
-#: locale/programs/ld-collate.c:1300
+#: locale/programs/ld-collate.c:1301
#, c-format
msgid "%s: symbolic range ellipsis must not be directly followed by `order_end'"
msgstr "%s: 符號範åœçš„çœç•¥ä¸å¯ä»¥ç›´æŽ¥åœ¨ `order_end' 之å‰"
-#: locale/programs/ld-collate.c:1320 locale/programs/ld-ctype.c:1501
+#: locale/programs/ld-collate.c:1321 locale/programs/ld-ctype.c:1502
#, c-format
msgid "`%s' and `%.*s' are not valid names for symbolic range"
msgstr "`%s' å’Œ `%.*s' 皆éžç¬¦è™Ÿç¯„åœä¸­é©ç”¨çš„å稱"
-#: locale/programs/ld-collate.c:1370 locale/programs/ld-collate.c:3858
+#: locale/programs/ld-collate.c:1371 locale/programs/ld-collate.c:3859
#, c-format
msgid "%s: order for `%.*s' already defined at %s:%Zu"
msgstr "%s: `%.*s' çš„é †åºå·²åœ¨ %s:%Zu 中定義"
-#: locale/programs/ld-collate.c:1379
+#: locale/programs/ld-collate.c:1380
#, c-format
msgid "%s: `%s' must be a character"
msgstr "%s: `%s' 必須是一個字元"
-#: locale/programs/ld-collate.c:1574
+#: locale/programs/ld-collate.c:1575
#, c-format
msgid "%s: `position' must be used for a specific level in all sections or none"
msgstr "%s: `position' 必須在所有å€å¡Šè£¡ç‰¹å®šçš„等級中使用,å¦å‰‡ä¸èƒ½ä½¿ç”¨"
-#: locale/programs/ld-collate.c:1599
+#: locale/programs/ld-collate.c:1600
#, c-format
msgid "symbol `%s' not defined"
msgstr "並未定義 `%s' 符號"
-#: locale/programs/ld-collate.c:1675 locale/programs/ld-collate.c:1781
+#: locale/programs/ld-collate.c:1676 locale/programs/ld-collate.c:1782
#, c-format
msgid "symbol `%s' has the same encoding as"
msgstr "跟符號 `%s' 有相åŒçš„編碼: "
-#: locale/programs/ld-collate.c:1679 locale/programs/ld-collate.c:1785
+#: locale/programs/ld-collate.c:1680 locale/programs/ld-collate.c:1786
#, c-format
msgid "symbol `%s'"
msgstr "符號 `%s'"
-#: locale/programs/ld-collate.c:1827
+#: locale/programs/ld-collate.c:1828
#, c-format
msgid "no definition of `UNDEFINED'"
msgstr "沒有找到 `UNDEFINED' 的定義"
-#: locale/programs/ld-collate.c:1856
+#: locale/programs/ld-collate.c:1857
#, c-format
msgid "too many errors; giving up"
msgstr "發生太多錯誤;放棄中"
-#: locale/programs/ld-collate.c:2658 locale/programs/ld-collate.c:4046
+#: locale/programs/ld-collate.c:2659 locale/programs/ld-collate.c:4047
#, c-format
msgid "%s: nested conditionals not supported"
msgstr "%s: ä¸æ”¯æ´å·¢ç‹€æ¢ä»¶"
-#: locale/programs/ld-collate.c:2676
+#: locale/programs/ld-collate.c:2677
#, c-format
msgid "%s: more then one 'else'"
msgstr "%s: 使用多於一個「elseã€"
-#: locale/programs/ld-collate.c:2851
+#: locale/programs/ld-collate.c:2852
#, c-format
msgid "%s: duplicate definition of `%s'"
msgstr "%s: é‡è¤‡çš„定義 `%s'"
-#: locale/programs/ld-collate.c:2887
+#: locale/programs/ld-collate.c:2888
#, c-format
msgid "%s: duplicate declaration of section `%s'"
msgstr "%s: é‡è¤‡çš„ `%s' å€å¡Šå®£å‘Š"
-#: locale/programs/ld-collate.c:3023
+#: locale/programs/ld-collate.c:3024
#, c-format
msgid "%s: unknown character in collating symbol name"
msgstr "%s: 未知的字元在å°ç…§ç¬¦è™Ÿå稱中"
-#: locale/programs/ld-collate.c:3152
+#: locale/programs/ld-collate.c:3153
#, c-format
msgid "%s: unknown character in equivalent definition name"
msgstr "%s: 未知的字元在åŒç¾©å®šç¾©å稱中"
-#: locale/programs/ld-collate.c:3163
+#: locale/programs/ld-collate.c:3164
#, c-format
msgid "%s: unknown character in equivalent definition value"
msgstr "%s: 未知的字元在åŒç¾©å®šç¾©å€¼ä¸­"
-#: locale/programs/ld-collate.c:3173
+#: locale/programs/ld-collate.c:3174
#, c-format
msgid "%s: unknown symbol `%s' in equivalent definition"
msgstr "%s: 未知的符號 `%s' 在åŒç¾©å®šç¾©ä¸­"
-#: locale/programs/ld-collate.c:3182
+#: locale/programs/ld-collate.c:3183
msgid "error while adding equivalent collating symbol"
msgstr "正在加入åŒç¾©å°ç…§ç¬¦è™Ÿæ™‚發生錯誤"
-#: locale/programs/ld-collate.c:3220
+#: locale/programs/ld-collate.c:3221
#, c-format
msgid "duplicate definition of script `%s'"
msgstr "敘述 `%s' 的定義é‡è¤‡äº†"
-#: locale/programs/ld-collate.c:3268
+#: locale/programs/ld-collate.c:3269
#, c-format
msgid "%s: unknown section name `%.*s'"
msgstr "%s: ä¸æ˜Žçš„節段å稱「%.*sã€"
-#: locale/programs/ld-collate.c:3297
+#: locale/programs/ld-collate.c:3298
#, c-format
msgid "%s: multiple order definitions for section `%s'"
msgstr "%s: `%s' å€å¡Šä¸­æœ‰å¤šå€‹é †åºå®šç¾©"
-#: locale/programs/ld-collate.c:3325
+#: locale/programs/ld-collate.c:3326
#, c-format
msgid "%s: invalid number of sorting rules"
msgstr "%s: ä¸é©ç”¨çš„排åºè¦å‰‡æ•¸ç›®"
-#: locale/programs/ld-collate.c:3352
+#: locale/programs/ld-collate.c:3353
#, c-format
msgid "%s: multiple order definitions for unnamed section"
msgstr "%s: 未命åçš„å€å¡Šä¸­æœ‰å¤šå€‹é †åºå®šç¾©"
-#: locale/programs/ld-collate.c:3407 locale/programs/ld-collate.c:3537
-#: locale/programs/ld-collate.c:3900
+#: locale/programs/ld-collate.c:3408 locale/programs/ld-collate.c:3538
+#: locale/programs/ld-collate.c:3901
#, c-format
msgid "%s: missing `order_end' keyword"
msgstr "%s: 缺少 `order_end' é—œéµå­—"
-#: locale/programs/ld-collate.c:3470
+#: locale/programs/ld-collate.c:3471
#, c-format
msgid "%s: order for collating symbol %.*s not yet defined"
msgstr "%s: å°ç…§ç¬¦è™Ÿ %.*s çš„é †åºå°šæœªå®šç¾©"
-#: locale/programs/ld-collate.c:3488
+#: locale/programs/ld-collate.c:3489
#, c-format
msgid "%s: order for collating element %.*s not yet defined"
msgstr "%s: å°ç…§å…ƒç´  %.*s çš„é †åºå°šæœªå®šç¾©"
-#: locale/programs/ld-collate.c:3499
+#: locale/programs/ld-collate.c:3500
#, c-format
msgid "%s: cannot reorder after %.*s: symbol not known"
msgstr "%s: 無法é‡æ–°æŽ’列在 %.*s 之後: 未知的符號"
-#: locale/programs/ld-collate.c:3551 locale/programs/ld-collate.c:3912
+#: locale/programs/ld-collate.c:3552 locale/programs/ld-collate.c:3913
#, c-format
msgid "%s: missing `reorder-end' keyword"
msgstr "%s: 缺少 `reorder-end' é—œéµå­—"
-#: locale/programs/ld-collate.c:3585 locale/programs/ld-collate.c:3783
+#: locale/programs/ld-collate.c:3586 locale/programs/ld-collate.c:3784
#, c-format
msgid "%s: section `%.*s' not known"
msgstr "%s: 未知的å€å¡Š `%.*s'"
-#: locale/programs/ld-collate.c:3650
+#: locale/programs/ld-collate.c:3651
#, c-format
msgid "%s: bad symbol <%.*s>"
msgstr "%s: ä¸ç•¶çš„符號 <%.*s>"
-#: locale/programs/ld-collate.c:3846
+#: locale/programs/ld-collate.c:3847
#, c-format
msgid "%s: cannot have `%s' as end of ellipsis range"
msgstr "%s: 無法用 `%s' åšç‚ºçœç•¥å€æ®µçš„çµå°¾"
-#: locale/programs/ld-collate.c:3896
+#: locale/programs/ld-collate.c:3897
#, c-format
msgid "%s: empty category description not allowed"
msgstr "%s: 空白的類別æ述是ä¸å…許的"
-#: locale/programs/ld-collate.c:3915
+#: locale/programs/ld-collate.c:3916
#, c-format
msgid "%s: missing `reorder-sections-end' keyword"
msgstr "%s: 缺少 `reorder-sections-end' é—œéµå­—"
-#: locale/programs/ld-collate.c:4079
+#: locale/programs/ld-collate.c:4080
#, c-format
msgid "%s: '%s' without matching 'ifdef' or 'ifndef'"
msgstr "%s:「%sã€è€Œä¸éœ€å»åˆä¸­ã€Œifdefã€æˆ–「ifndefã€"
-#: locale/programs/ld-collate.c:4097
+#: locale/programs/ld-collate.c:4098
#, c-format
msgid "%s: 'endif' without matching 'ifdef' or 'ifndef'"
msgstr "%s:「endifã€è€Œä¸éœ€å»åˆä¸­ã€Œifdefã€æˆ–「ifndefã€"
-#: locale/programs/ld-ctype.c:439
+#: locale/programs/ld-ctype.c:440
#, c-format
msgid "No character set name specified in charmap"
msgstr "在字元å°æ‡‰ (charmap) 中沒有設定字集å稱"
-#: locale/programs/ld-ctype.c:468
+#: locale/programs/ld-ctype.c:469
#, c-format
msgid "character L'\\u%0*x' in class `%s' must be in class `%s'"
msgstr "character L'\\u%0*x' (放在類別 `%s' 之中) 必須在類別 `%s' 裡é¢"
-#: locale/programs/ld-ctype.c:483
+#: locale/programs/ld-ctype.c:484
#, c-format
msgid "character L'\\u%0*x' in class `%s' must not be in class `%s'"
msgstr "character L'\\u%0*x' (放在類別 `%s' 之中) ä¸èƒ½åœ¨é¡žåˆ¥ `%s' 裡é¢"
-#: locale/programs/ld-ctype.c:497 locale/programs/ld-ctype.c:555
+#: locale/programs/ld-ctype.c:498 locale/programs/ld-ctype.c:556
#, c-format
msgid "internal error in %s, line %u"
msgstr "%s 的第 %u 列發生內部錯誤"
-#: locale/programs/ld-ctype.c:526
+#: locale/programs/ld-ctype.c:527
#, c-format
msgid "character '%s' in class `%s' must be in class `%s'"
msgstr "å­—å…ƒ '%s' (放在類別 `%s' 之中) 必須在類別 `%s' 裡é¢"
-#: locale/programs/ld-ctype.c:542
+#: locale/programs/ld-ctype.c:543
#, c-format
msgid "character '%s' in class `%s' must not be in class `%s'"
msgstr "å­—å…ƒ '%s' (放在類別 `%s' 之中) ä¸èƒ½åœ¨é¡žåˆ¥ `%s' 裡é¢"
-#: locale/programs/ld-ctype.c:572 locale/programs/ld-ctype.c:610
+#: locale/programs/ld-ctype.c:573 locale/programs/ld-ctype.c:611
#, c-format
msgid "<SP> character not in class `%s'"
msgstr "<SP> å­—å…ƒä¸åœ¨é¡žåˆ¥ `%s' 中"
-#: locale/programs/ld-ctype.c:584 locale/programs/ld-ctype.c:621
+#: locale/programs/ld-ctype.c:585 locale/programs/ld-ctype.c:622
#, c-format
msgid "<SP> character must not be in class `%s'"
msgstr "<SP> å­—å…ƒä¸å¯ä»¥åœ¨é¡žåˆ¥ `%s' 中"
-#: locale/programs/ld-ctype.c:599
+#: locale/programs/ld-ctype.c:600
#, c-format
msgid "character <SP> not defined in character map"
msgstr "å­—å…ƒ <SP> 在字集å°ç…§æª”中沒有定義"
-#: locale/programs/ld-ctype.c:735
+#: locale/programs/ld-ctype.c:736
#, c-format
msgid "`digit' category has not entries in groups of ten"
msgstr "`digit' 類別在群組 \"å\" 中沒有項目"
-#: locale/programs/ld-ctype.c:784
+#: locale/programs/ld-ctype.c:785
#, c-format
msgid "no input digits defined and none of the standard names in the charmap"
msgstr "沒有定義輸入數字,在字集å°ç…§æª”中也找ä¸åˆ°ç›¸ç¬¦çš„標準å稱"
-#: locale/programs/ld-ctype.c:849
+#: locale/programs/ld-ctype.c:850
#, c-format
msgid "not all characters used in `outdigit' are available in the charmap"
msgstr "在字集å°ç…§è¡¨ä¸­ç„¡æ³•æ‰¾åˆ°æŸäº›åœ¨ `outdigit' 中用到的字元"
-#: locale/programs/ld-ctype.c:866
+#: locale/programs/ld-ctype.c:867
#, c-format
msgid "not all characters used in `outdigit' are available in the repertoire"
msgstr "在編碼å°æ˜ æª”中無法找到æŸäº›åœ¨ `outdigit' 中用到的字元"
-#: locale/programs/ld-ctype.c:1269
+#: locale/programs/ld-ctype.c:1270
#, c-format
msgid "character class `%s' already defined"
msgstr "字元類別 `%s' 已經定義éŽäº†"
-#: locale/programs/ld-ctype.c:1275
+#: locale/programs/ld-ctype.c:1276
#, c-format
msgid "implementation limit: no more than %Zd character classes allowed"
msgstr "程å¼å¯¦ä½œçš„é™åˆ¶: ä¸èƒ½ä½¿ç”¨è¶…éŽ %Zd 個字集類別"
-#: locale/programs/ld-ctype.c:1301
+#: locale/programs/ld-ctype.c:1302
#, c-format
msgid "character map `%s' already defined"
msgstr "字集å°ç…§æª” `%s' 已經定義éŽäº†"
-#: locale/programs/ld-ctype.c:1307
+#: locale/programs/ld-ctype.c:1308
#, c-format
msgid "implementation limit: no more than %d character maps allowed"
msgstr "程å¼å¯¦ä½œçš„é™åˆ¶: ä¸èƒ½ä½¿ç”¨è¶…éŽ %d 個字集å°ç…§æª”"
-#: locale/programs/ld-ctype.c:1572 locale/programs/ld-ctype.c:1697
-#: locale/programs/ld-ctype.c:1803 locale/programs/ld-ctype.c:2493
-#: locale/programs/ld-ctype.c:3489
+#: locale/programs/ld-ctype.c:1573 locale/programs/ld-ctype.c:1698
+#: locale/programs/ld-ctype.c:1804 locale/programs/ld-ctype.c:2494
+#: locale/programs/ld-ctype.c:3490
#, c-format
msgid "%s: field `%s' does not contain exactly ten entries"
msgstr "%s: `%s' 欄ä½æ²’有精確包å«å個項目"
-#: locale/programs/ld-ctype.c:1600 locale/programs/ld-ctype.c:2174
+#: locale/programs/ld-ctype.c:1601 locale/programs/ld-ctype.c:2175
#, c-format
msgid "to-value <U%0*X> of range is smaller than from-value <U%0*X>"
msgstr "å€åŸŸå®šç¾©çš„çµå°¾å€¼ <U%0*X> 比起始值 <U%0*X> é‚„è¦å°"
-#: locale/programs/ld-ctype.c:1727
+#: locale/programs/ld-ctype.c:1728
msgid "start and end character sequence of range must have the same length"
msgstr "從起始到çµæŸä¹‹é–“çš„å­—å…ƒåºåˆ—長度跟編碼範åœå¿…須相åŒ"
-#: locale/programs/ld-ctype.c:1734
+#: locale/programs/ld-ctype.c:1735
msgid "to-value character sequence is smaller than from-value sequence"
msgstr "å­—å…ƒåºåˆ—定義的çµå°¾å€¼æ¯”起始值還è¦å°"
-#: locale/programs/ld-ctype.c:2094 locale/programs/ld-ctype.c:2145
+#: locale/programs/ld-ctype.c:2095 locale/programs/ld-ctype.c:2146
msgid "premature end of `translit_ignore' definition"
msgstr "`translit_ignore' 定義沒有按時çµæŸ"
-#: locale/programs/ld-ctype.c:2100 locale/programs/ld-ctype.c:2151
-#: locale/programs/ld-ctype.c:2193
+#: locale/programs/ld-ctype.c:2101 locale/programs/ld-ctype.c:2152
+#: locale/programs/ld-ctype.c:2194
msgid "syntax error"
msgstr "語法錯誤"
-#: locale/programs/ld-ctype.c:2326
+#: locale/programs/ld-ctype.c:2327
#, c-format
msgid "%s: syntax error in definition of new character class"
msgstr "%s: 在定義新字元類別時語法錯誤"
-#: locale/programs/ld-ctype.c:2341
+#: locale/programs/ld-ctype.c:2342
#, c-format
msgid "%s: syntax error in definition of new character map"
msgstr "%s: 在定義新字元å°æ‡‰æ™‚語法錯誤"
-#: locale/programs/ld-ctype.c:2515
+#: locale/programs/ld-ctype.c:2516
msgid "ellipsis range must be marked by two operands of same type"
msgstr "çœç•¥å€åŸŸå¿…須用兩個型別相åŒçš„é‹ç®—元標示出來"
-#: locale/programs/ld-ctype.c:2524
+#: locale/programs/ld-ctype.c:2525
msgid "with symbolic name range values the absolute ellipsis `...' must not be used"
msgstr "用符號å稱來指定字元編碼範åœæ™‚ä¸å¯ä»¥ç”¨çµ•å°ä½ç½®çš„çœç•¥ç¬¦è™Ÿ `…'"
-#: locale/programs/ld-ctype.c:2539
+#: locale/programs/ld-ctype.c:2540
msgid "with UCS range values one must use the hexadecimal symbolic ellipsis `..'"
msgstr "用來指定 UCS 值的範åœæ™‚得用å六進ä½è¡¨ç¤ºçš„çœç•¥ç¬¦è™Ÿ `..'"
-#: locale/programs/ld-ctype.c:2553
+#: locale/programs/ld-ctype.c:2554
msgid "with character code range values one must use the absolute ellipsis `...'"
msgstr "用來指定字元編碼值的範åœæ™‚得用絕å°ä½ç½®çš„çœç•¥ç¬¦è™Ÿ `…'"
-#: locale/programs/ld-ctype.c:2704
+#: locale/programs/ld-ctype.c:2705
#, c-format
msgid "duplicated definition for mapping `%s'"
msgstr "å°æ˜  `%s' 的定義é‡è¤‡äº†"
-#: locale/programs/ld-ctype.c:2790 locale/programs/ld-ctype.c:2934
+#: locale/programs/ld-ctype.c:2791 locale/programs/ld-ctype.c:2935
#, c-format
msgid "%s: `translit_start' section does not end with `translit_end'"
msgstr "%s: `translit_start' å°ç¯€ä¸¦æ²’有以 `translit_end' åšç‚ºçµæŸ"
-#: locale/programs/ld-ctype.c:2885
+#: locale/programs/ld-ctype.c:2886
#, c-format
msgid "%s: duplicate `default_missing' definition"
msgstr "%s: é‡è¤‡çš„ `default_missing' 定義"
-#: locale/programs/ld-ctype.c:2890
+#: locale/programs/ld-ctype.c:2891
msgid "previous definition was here"
msgstr "å…ˆå‰çš„設定在此"
-#: locale/programs/ld-ctype.c:2912
+#: locale/programs/ld-ctype.c:2913
#, c-format
msgid "%s: no representable `default_missing' definition found"
msgstr "%s: 找ä¸åˆ°å¯è¡¨ç¤ºç‚º `default_missing' 的定義"
-#: locale/programs/ld-ctype.c:3065 locale/programs/ld-ctype.c:3149
-#: locale/programs/ld-ctype.c:3169 locale/programs/ld-ctype.c:3190
-#: locale/programs/ld-ctype.c:3211 locale/programs/ld-ctype.c:3232
-#: locale/programs/ld-ctype.c:3253 locale/programs/ld-ctype.c:3293
-#: locale/programs/ld-ctype.c:3314 locale/programs/ld-ctype.c:3381
-#: locale/programs/ld-ctype.c:3423 locale/programs/ld-ctype.c:3448
+#: locale/programs/ld-ctype.c:3066 locale/programs/ld-ctype.c:3150
+#: locale/programs/ld-ctype.c:3170 locale/programs/ld-ctype.c:3191
+#: locale/programs/ld-ctype.c:3212 locale/programs/ld-ctype.c:3233
+#: locale/programs/ld-ctype.c:3254 locale/programs/ld-ctype.c:3294
+#: locale/programs/ld-ctype.c:3315 locale/programs/ld-ctype.c:3382
+#: locale/programs/ld-ctype.c:3424 locale/programs/ld-ctype.c:3449
#, c-format
msgid "%s: character `%s' not defined while needed as default value"
msgstr "%s: å­—å…ƒ `%s' 沒有定義,但它是必需的é è¨­å€¼"
-#: locale/programs/ld-ctype.c:3070 locale/programs/ld-ctype.c:3154
-#: locale/programs/ld-ctype.c:3174 locale/programs/ld-ctype.c:3195
-#: locale/programs/ld-ctype.c:3216 locale/programs/ld-ctype.c:3237
-#: locale/programs/ld-ctype.c:3258 locale/programs/ld-ctype.c:3298
-#: locale/programs/ld-ctype.c:3319 locale/programs/ld-ctype.c:3386
+#: locale/programs/ld-ctype.c:3071 locale/programs/ld-ctype.c:3155
+#: locale/programs/ld-ctype.c:3175 locale/programs/ld-ctype.c:3196
+#: locale/programs/ld-ctype.c:3217 locale/programs/ld-ctype.c:3238
+#: locale/programs/ld-ctype.c:3259 locale/programs/ld-ctype.c:3299
+#: locale/programs/ld-ctype.c:3320 locale/programs/ld-ctype.c:3387
#, c-format
msgid "%s: character `%s' in charmap not representable with one byte"
msgstr "%s: 字集å°ç…§è¡¨ä¸­çš„å­—å…ƒ `%s' 無法表示為單一ä½å…ƒçµ„"
-#: locale/programs/ld-ctype.c:3430 locale/programs/ld-ctype.c:3455
+#: locale/programs/ld-ctype.c:3431 locale/programs/ld-ctype.c:3456
#, c-format
msgid "%s: character `%s' needed as default value not representable with one byte"
msgstr "%s: åšç‚ºé è¨­å€¼æ‰€éœ€çš„å­—å…ƒ `%s' 無法表示為單一ä½å…ƒçµ„"
-#: locale/programs/ld-ctype.c:3511
+#: locale/programs/ld-ctype.c:3512
#, c-format
msgid "no output digits defined and none of the standard names in the charmap"
msgstr "沒有定義輸出數字,在字集å°ç…§æª”中也找ä¸åˆ°ç›¸ç¬¦çš„標準å稱"
-#: locale/programs/ld-ctype.c:3802
+#: locale/programs/ld-ctype.c:3803
#, c-format
msgid "%s: transliteration data from locale `%s' not available"
msgstr "%s: 語å€è³‡æ–™`%s' 的音譯資料ä¸å­˜åœ¨"
-#: locale/programs/ld-ctype.c:3903
+#: locale/programs/ld-ctype.c:3904
#, c-format
msgid "%s: table for class \"%s\": %lu bytes\n"
msgstr "%s: 類別 \"%s\" 表格: %lu ä½å…ƒçµ„\n"
-#: locale/programs/ld-ctype.c:3972
+#: locale/programs/ld-ctype.c:3973
#, c-format
msgid "%s: table for map \"%s\": %lu bytes\n"
msgstr "%s: å°æ˜ è¡¨ \"%s\" 表格: %lu ä½å…ƒçµ„\n"
-#: locale/programs/ld-ctype.c:4105
+#: locale/programs/ld-ctype.c:4106
#, c-format
msgid "%s: table for width: %lu bytes\n"
msgstr "%s: 寬度表格: %lu ä½å…ƒçµ„\n"
-#: locale/programs/ld-identification.c:169
+#: locale/programs/ld-identification.c:170
#, c-format
msgid "%s: no identification for category `%s'"
msgstr "%s: 類別 `%s' 沒有èªè­‰"
-#: locale/programs/ld-identification.c:434
+#: locale/programs/ld-identification.c:435
#, c-format
msgid "%s: duplicate category version definition"
msgstr "%s: é‡è¤‡çš„類別版本定義"
-#: locale/programs/ld-measurement.c:112
+#: locale/programs/ld-measurement.c:113
#, c-format
msgid "%s: invalid value for field `%s'"
msgstr "%s: åœ¨æ¬„ä½ `%s' 中的值ä¸é©ç”¨"
-#: locale/programs/ld-messages.c:113 locale/programs/ld-messages.c:147
+#: locale/programs/ld-messages.c:114 locale/programs/ld-messages.c:148
#, c-format
msgid "%s: field `%s' undefined"
msgstr "%s: æ¬„ä½ `%s' 沒有定義"
-#: locale/programs/ld-messages.c:120 locale/programs/ld-messages.c:154
-#: locale/programs/ld-monetary.c:255 locale/programs/ld-numeric.c:117
+#: locale/programs/ld-messages.c:121 locale/programs/ld-messages.c:155
+#: locale/programs/ld-monetary.c:255 locale/programs/ld-numeric.c:118
#, c-format
msgid "%s: value for field `%s' must not be an empty string"
msgstr "%s: æ¬„ä½ `%s' 值ä¸å¯ä»¥æ˜¯ç©ºå­—串"
-#: locale/programs/ld-messages.c:136 locale/programs/ld-messages.c:170
+#: locale/programs/ld-messages.c:137 locale/programs/ld-messages.c:171
#, c-format
msgid "%s: no correct regular expression for field `%s': %s"
msgstr "%s: æ²’æœ‰çµ¦æ¬„ä½ `%s' 正確的常è¦è¡¨ç¤ºå¼ï¼š %s"
@@ -2418,17 +2435,17 @@ msgstr "%s: æ¬„ä½ `int_curr_symbol' 值並ä¸æ˜¯ ISO 4217 中åˆæ³•çš„å稱"
msgid "%s: value for field `%s' must be in range %d...%d"
msgstr "%s: æ¬„ä½ `%s' çš„å€¼å¿…é ˆåœ¨ç¯„åœ %d…%d"
-#: locale/programs/ld-monetary.c:746 locale/programs/ld-numeric.c:273
+#: locale/programs/ld-monetary.c:746 locale/programs/ld-numeric.c:274
#, c-format
msgid "%s: value for field `%s' must be a single character"
msgstr "%s: æ¬„ä½ `%s' 的值必須是個單一字元"
-#: locale/programs/ld-monetary.c:843 locale/programs/ld-numeric.c:317
+#: locale/programs/ld-monetary.c:843 locale/programs/ld-numeric.c:318
#, c-format
msgid "%s: `-1' must be last entry in `%s' field"
msgstr "%s: `-1' 在 `%s' 欄ä½ä¸­å¿…須是最後一個項目"
-#: locale/programs/ld-monetary.c:865 locale/programs/ld-numeric.c:334
+#: locale/programs/ld-monetary.c:865 locale/programs/ld-numeric.c:335
#, c-format
msgid "%s: values for field `%s' must be smaller than 127"
msgstr "%s: æ¬„ä½ `%s' 的值必須å°æ–¼ 127"
@@ -2437,126 +2454,126 @@ msgstr "%s: æ¬„ä½ `%s' 的值必須å°æ–¼ 127"
msgid "conversion rate value cannot be zero"
msgstr "轉æ›çŽ‡çš„值ä¸å¯ä»¥æ˜¯é›¶"
-#: locale/programs/ld-name.c:128 locale/programs/ld-telephone.c:125
-#: locale/programs/ld-telephone.c:148
+#: locale/programs/ld-name.c:129 locale/programs/ld-telephone.c:126
+#: locale/programs/ld-telephone.c:149
#, c-format
msgid "%s: invalid escape sequence in field `%s'"
msgstr "%s: åœ¨æ¬„ä½ `%s' 中的跳脫åºåˆ—ä¸é©ç”¨"
-#: locale/programs/ld-time.c:246
+#: locale/programs/ld-time.c:247
#, c-format
msgid "%s: direction flag in string %Zd in `era' field is not '+' nor '-'"
msgstr "%s: 在 `era' 欄ä½çš„字串 %Zd 中,方å‘旗標既ä¸æ˜¯ '+' 也ä¸æ˜¯ '-'"
-#: locale/programs/ld-time.c:257
+#: locale/programs/ld-time.c:258
#, c-format
msgid "%s: direction flag in string %Zd in `era' field is not a single character"
msgstr "%s: 在 `era' 欄ä½çš„字串 %Zd 中,方å‘旗標ä¸æ˜¯ä¸€å€‹å–®ä¸€å­—å…ƒ"
-#: locale/programs/ld-time.c:270
+#: locale/programs/ld-time.c:271
#, c-format
msgid "%s: invalid number for offset in string %Zd in `era' field"
msgstr "%s: 在 `era' 欄ä½ã€å­—串 %Zd 中的ä½ç§»æ•¸å­—ä¸é©ç”¨"
-#: locale/programs/ld-time.c:278
+#: locale/programs/ld-time.c:279
#, c-format
msgid "%s: garbage at end of offset value in string %Zd in `era' field"
msgstr "%s: 無用的資料,在 `era' 欄ä½ã€å­—串 %Zd 中末尾的ä½ç§»å€¼"
-#: locale/programs/ld-time.c:329
+#: locale/programs/ld-time.c:330
#, c-format
msgid "%s: invalid starting date in string %Zd in `era' field"
msgstr "%s: 在 `era' 欄ä½ã€å­—串 %Zd 中的起始日期ä¸é©ç”¨"
-#: locale/programs/ld-time.c:338
+#: locale/programs/ld-time.c:339
#, c-format
msgid "%s: garbage at end of starting date in string %Zd in `era' field "
msgstr "%s: 無用的資料,在 `era' 欄ä½ã€å­—串 %Zd 中末尾的起始日期"
-#: locale/programs/ld-time.c:357
+#: locale/programs/ld-time.c:358
#, c-format
msgid "%s: starting date is invalid in string %Zd in `era' field"
msgstr "%s: 在 `era' å€åŸŸçš„字串 %Zd 中的啟始日期是ä¸é©ç”¨çš„"
-#: locale/programs/ld-time.c:406 locale/programs/ld-time.c:434
+#: locale/programs/ld-time.c:407 locale/programs/ld-time.c:435
#, c-format
msgid "%s: invalid stopping date in string %Zd in `era' field"
msgstr "%s: 在 `era' 欄ä½ã€å­—串 %Zd 中的çµæŸæ—¥æœŸä¸é©ç”¨"
-#: locale/programs/ld-time.c:415
+#: locale/programs/ld-time.c:416
#, c-format
msgid "%s: garbage at end of stopping date in string %Zd in `era' field"
msgstr "%s: 無用的資料,在 `era' å€åŸŸã€å­—串 %Zd 中末尾的çµæŸæ—¥æœŸ"
-#: locale/programs/ld-time.c:443
+#: locale/programs/ld-time.c:444
#, c-format
msgid "%s: missing era name in string %Zd in `era' field"
msgstr "%s: 缺少 era å稱,在 `era' 欄ä½ã€å­—串 %Zd 中"
-#: locale/programs/ld-time.c:455
+#: locale/programs/ld-time.c:456
#, c-format
msgid "%s: missing era format in string %Zd in `era' field"
msgstr "%s: 缺少 era æ ¼å¼ï¼Œåœ¨ `era' 欄ä½ã€å­—串 %Zd 中"
-#: locale/programs/ld-time.c:496
+#: locale/programs/ld-time.c:497
#, c-format
msgid "%s: third operand for value of field `%s' must not be larger than %d"
msgstr "%s: æ¬„ä½ `%s' 值的第三個é‹ç®—å…ƒä¸å¯ä»¥æ¯” %d 大"
-#: locale/programs/ld-time.c:504 locale/programs/ld-time.c:512
-#: locale/programs/ld-time.c:520
+#: locale/programs/ld-time.c:505 locale/programs/ld-time.c:513
+#: locale/programs/ld-time.c:521
#, c-format
msgid "%s: values for field `%s' must not be larger than %d"
msgstr "%s: æ¬„ä½ `%s' 的值ä¸å¯ä»¥å¤§æ–¼ %d"
-#: locale/programs/ld-time.c:1003
+#: locale/programs/ld-time.c:1004
#, c-format
msgid "%s: too few values for field `%s'"
msgstr "%s: æ¬„ä½ `%s' 中的值太少"
-#: locale/programs/ld-time.c:1048
+#: locale/programs/ld-time.c:1049
msgid "extra trailing semicolon"
msgstr "多出的尾端分號"
-#: locale/programs/ld-time.c:1051
+#: locale/programs/ld-time.c:1052
#, c-format
msgid "%s: too many values for field `%s'"
msgstr "%s: æ¬„ä½ `%s' 中的值太多"
-#: locale/programs/linereader.c:129
+#: locale/programs/linereader.c:130
msgid "trailing garbage at end of line"
msgstr "列çµå°¾çš„無用字元"
-#: locale/programs/linereader.c:297
+#: locale/programs/linereader.c:298
msgid "garbage at end of number"
msgstr "號碼çµæŸä½ç½®çš„無用資料"
-#: locale/programs/linereader.c:409
+#: locale/programs/linereader.c:410
msgid "garbage at end of character code specification"
msgstr "字元編碼設定çµæŸä½ç½®çš„無用資料"
-#: locale/programs/linereader.c:495
+#: locale/programs/linereader.c:496
msgid "unterminated symbolic name"
msgstr "沒有çµå°¾çš„符號å稱"
-#: locale/programs/linereader.c:622
+#: locale/programs/linereader.c:623
msgid "illegal escape sequence at end of string"
msgstr "字串çµå°¾æœ‰ä¸åˆæ³•çš„跳脫åºåˆ—"
-#: locale/programs/linereader.c:626 locale/programs/linereader.c:854
+#: locale/programs/linereader.c:627 locale/programs/linereader.c:855
msgid "unterminated string"
msgstr "沒有çµå°¾çš„字串"
-#: locale/programs/linereader.c:668
+#: locale/programs/linereader.c:669
msgid "non-symbolic character value should not be used"
msgstr "éžç¬¦è™Ÿæ€§çš„字元值ä¸æ‡‰è©²è¢«ä½¿ç”¨æ‰å°"
-#: locale/programs/linereader.c:815
+#: locale/programs/linereader.c:816
#, c-format
msgid "symbol `%.*s' not in charmap"
msgstr "符號 `%.*s' 並ä¸åœ¨å­—集å°ç…§è¡¨ä¸­"
-#: locale/programs/linereader.c:836
+#: locale/programs/linereader.c:837
#, c-format
msgid "symbol `%.*s' not in repertoire map"
msgstr "符號 `%.*s' 並ä¸åœ¨ç·¨ç¢¼å°æ˜ æª”中"
@@ -2566,39 +2583,39 @@ msgstr "符號 `%.*s' 並ä¸åœ¨ç·¨ç¢¼å°æ˜ æª”中"
msgid "unknown name \"%s\""
msgstr "ä¸æ˜Žå稱「%sã€"
-#: locale/programs/locale.c:74
+#: locale/programs/locale.c:72
msgid "System information:"
msgstr "系統相關資訊:"
-#: locale/programs/locale.c:76
+#: locale/programs/locale.c:74
msgid "Write names of available locales"
msgstr "寫出存在的語å€è³‡æ–™å稱"
-#: locale/programs/locale.c:78
+#: locale/programs/locale.c:76
msgid "Write names of available charmaps"
msgstr "寫出存在的字集å°ç…§è¡¨å稱"
-#: locale/programs/locale.c:79
+#: locale/programs/locale.c:77
msgid "Modify output format:"
msgstr "修改輸出格å¼:"
-#: locale/programs/locale.c:80
+#: locale/programs/locale.c:78
msgid "Write names of selected categories"
msgstr "寫出é¸å–的類別å稱"
-#: locale/programs/locale.c:81
+#: locale/programs/locale.c:79
msgid "Write names of selected keywords"
msgstr "寫出é¸å–çš„é—œéµå­—å稱"
-#: locale/programs/locale.c:82
+#: locale/programs/locale.c:80
msgid "Print more information"
msgstr "å°å‡ºæ›´å¤šçš„資訊"
-#: locale/programs/locale.c:87
+#: locale/programs/locale.c:85
msgid "Get locale-specific information."
msgstr "å–得語å€è³‡æ–™ç‰¹å®šçš„資訊"
-#: locale/programs/locale.c:90
+#: locale/programs/locale.c:88
msgid ""
"NAME\n"
"[-a|-m]"
@@ -2606,27 +2623,27 @@ msgstr ""
"å稱\n"
"[-a|-m]"
-#: locale/programs/locale.c:194
+#: locale/programs/locale.c:192
#, c-format
msgid "Cannot set LC_CTYPE to default locale"
msgstr "無法將 LC_CTYPE 設置為é è¨­çš„語å€"
-#: locale/programs/locale.c:196
+#: locale/programs/locale.c:194
#, c-format
msgid "Cannot set LC_MESSAGES to default locale"
msgstr "無法將 LC_MESSAGES 設置為é è¨­çš„語å€"
-#: locale/programs/locale.c:209
+#: locale/programs/locale.c:207
#, c-format
msgid "Cannot set LC_COLLATE to default locale"
msgstr "無法將 LC_COLLATE 設置為é è¨­çš„語å€"
-#: locale/programs/locale.c:225
+#: locale/programs/locale.c:223
#, c-format
msgid "Cannot set LC_ALL to default locale"
msgstr "無法將 LC_ALL 設置為é è¨­çš„語å€"
-#: locale/programs/locale.c:521
+#: locale/programs/locale.c:519
#, c-format
msgid "while preparing output"
msgstr "在準備輸出時"
@@ -2639,71 +2656,71 @@ msgstr "輸入檔:"
msgid "Symbolic character names defined in FILE"
msgstr "符號字元的å稱定義在檔案 FILE 中"
-#: locale/programs/localedef.c:122
+#: locale/programs/localedef.c:123
msgid "Source definitions are found in FILE"
msgstr "原始資料定義在檔案 FILE 中"
-#: locale/programs/localedef.c:124
+#: locale/programs/localedef.c:125
msgid "FILE contains mapping from symbolic names to UCS4 values"
msgstr "檔案 FILE å…§å«ç¬¦è™Ÿå與 UCS4 編碼之間的å°æ˜ "
-#: locale/programs/localedef.c:128
+#: locale/programs/localedef.c:129
msgid "Create output even if warning messages were issued"
msgstr "產生輸出å³ä½¿æ˜¯æœ‰è­¦å‘Šè¨Šæ¯"
-#: locale/programs/localedef.c:129
+#: locale/programs/localedef.c:130
msgid "Create old-style tables"
msgstr "產生舊格å¼çš„表格"
-#: locale/programs/localedef.c:130
+#: locale/programs/localedef.c:131
msgid "Optional output file prefix"
msgstr "å¯æœ‰å¯ç„¡çš„輸出檔路徑"
-#: locale/programs/localedef.c:131
-msgid "Be strictly POSIX conform"
+#: locale/programs/localedef.c:132
+msgid "Strictly conform to POSIX"
msgstr "åš´æ ¼éµå¾ž POSIX"
-#: locale/programs/localedef.c:133
+#: locale/programs/localedef.c:134
msgid "Suppress warnings and information messages"
msgstr "忽略警告與æ示訊æ¯"
-#: locale/programs/localedef.c:134
+#: locale/programs/localedef.c:135
msgid "Print more messages"
msgstr "å°å‡ºæ›´å¤šçš„訊æ¯"
-#: locale/programs/localedef.c:135
+#: locale/programs/localedef.c:136
msgid "Archive control:"
msgstr "ä¿å­˜æª”控制:"
-#: locale/programs/localedef.c:137
+#: locale/programs/localedef.c:138
msgid "Don't add new data to archive"
msgstr "ä¸è¦åŠ å…¥æ–°è³‡æ–™åˆ°ä¿å­˜æª”"
-#: locale/programs/localedef.c:139
+#: locale/programs/localedef.c:140
msgid "Add locales named by parameters to archive"
msgstr "藉由åƒæ•¸åŠ å…¥èªžå€å稱到ä¿å­˜æª”"
-#: locale/programs/localedef.c:140
+#: locale/programs/localedef.c:141
msgid "Replace existing archive content"
msgstr "替æ›å·²æœ‰çš„ä¿å­˜æª”內容"
-#: locale/programs/localedef.c:142
+#: locale/programs/localedef.c:143
msgid "Remove locales named by parameters from archive"
msgstr "藉由åƒæ•¸å¾žä¿å­˜æª”中刪除語å€å稱"
-#: locale/programs/localedef.c:143
+#: locale/programs/localedef.c:144
msgid "List content of archive"
msgstr "列出ä¿å­˜æª”的內容"
-#: locale/programs/localedef.c:145
+#: locale/programs/localedef.c:146
msgid "locale.alias file to consult when making archive"
msgstr "製作ä¿å­˜æª”時查閱 locale.alias 檔案"
-#: locale/programs/localedef.c:150
+#: locale/programs/localedef.c:151
msgid "Compile locale specification"
msgstr "編譯語å€è³‡æ–™è¦æ ¼"
-#: locale/programs/localedef.c:153
+#: locale/programs/localedef.c:154
msgid ""
"NAME\n"
"[--add-to-archive|--delete-from-archive] FILE...\n"
@@ -2713,28 +2730,28 @@ msgstr ""
"[--add-to-archive|--delete-from-archive] 檔案...\n"
"--list-archive [檔案]"
-#: locale/programs/localedef.c:228
+#: locale/programs/localedef.c:229
#, c-format
msgid "cannot create directory for output files"
msgstr "無法為輸出檔建立目錄"
-#: locale/programs/localedef.c:239
+#: locale/programs/localedef.c:240
#, c-format
msgid "FATAL: system does not define `_POSIX2_LOCALEDEF'"
msgstr "åš´é‡éŒ¯èª¤: 系統沒有定義 `_POSIX2_LOCALEDEF'"
-#: locale/programs/localedef.c:253 locale/programs/localedef.c:269
-#: locale/programs/localedef.c:601 locale/programs/localedef.c:621
+#: locale/programs/localedef.c:254 locale/programs/localedef.c:270
+#: locale/programs/localedef.c:602 locale/programs/localedef.c:622
#, c-format
msgid "cannot open locale definition file `%s'"
msgstr "無法開啟語å€è³‡æ–™å®šç¾©æª” `%s'"
-#: locale/programs/localedef.c:281
+#: locale/programs/localedef.c:282
#, c-format
msgid "cannot write output files to `%s'"
msgstr "無法將輸出檔案寫入 `%s'"
-#: locale/programs/localedef.c:367
+#: locale/programs/localedef.c:368
#, c-format
msgid ""
"System's directory for character maps : %s\n"
@@ -2747,146 +2764,145 @@ msgstr ""
"\t\t 語å€è·¯å¾‘ :%s\n"
"%s"
-#: locale/programs/localedef.c:569
+#: locale/programs/localedef.c:570
#, c-format
msgid "circular dependencies between locale definitions"
msgstr "有語å€è³‡æ–™åœ¨å®šç¾©æ™‚發生循環相關的情æ³"
-#: locale/programs/localedef.c:575
+#: locale/programs/localedef.c:576
#, c-format
msgid "cannot add already read locale `%s' a second time"
msgstr " `%s' 語å€è³‡æ–™å·²ç¶“用éŽï¼Œä¸èƒ½é‡è¤‡åŠ å…¥"
-#: locale/programs/locarchive.c:113 locale/programs/locarchive.c:347
-#: nss/makedb.c:290
+#: locale/programs/locarchive.c:125 locale/programs/locarchive.c:367
#, c-format
-msgid "cannot create temporary file"
-msgstr "無法產生暫時檔"
+msgid "cannot create temporary file: %s"
+msgstr "無法產生暫時檔:%s"
-#: locale/programs/locarchive.c:143 locale/programs/locarchive.c:393
+#: locale/programs/locarchive.c:155 locale/programs/locarchive.c:413
#, c-format
msgid "cannot initialize archive file"
msgstr "無法起始ä¿å­˜æª”"
-#: locale/programs/locarchive.c:150 locale/programs/locarchive.c:400
+#: locale/programs/locarchive.c:162 locale/programs/locarchive.c:420
#, c-format
msgid "cannot resize archive file"
msgstr "無法改變ä¿å­˜æª”大å°"
-#: locale/programs/locarchive.c:163 locale/programs/locarchive.c:413
-#: locale/programs/locarchive.c:619
+#: locale/programs/locarchive.c:177 locale/programs/locarchive.c:435
+#: locale/programs/locarchive.c:645
#, c-format
msgid "cannot map archive header"
msgstr "無法註記ä¿å­˜æª”表頭"
-#: locale/programs/locarchive.c:185
+#: locale/programs/locarchive.c:199
#, c-format
msgid "failed to create new locale archive"
msgstr "無法建立新的語å€ä¿å­˜æª”"
-#: locale/programs/locarchive.c:197
+#: locale/programs/locarchive.c:211
#, c-format
msgid "cannot change mode of new locale archive"
msgstr "無法改變新的語å€è³‡æ–™ä¿å­˜æª”狀態"
-#: locale/programs/locarchive.c:296
+#: locale/programs/locarchive.c:311
#, c-format
msgid "cannot read data from locale archive"
msgstr "無法從語å€æ­¸æª”讀å–資料"
-#: locale/programs/locarchive.c:327
+#: locale/programs/locarchive.c:342
#, c-format
msgid "cannot map locale archive file"
msgstr "無法映射語å€è³‡æ–™ä¿å­˜æª”"
-#: locale/programs/locarchive.c:421
+#: locale/programs/locarchive.c:443
#, c-format
msgid "cannot lock new archive"
msgstr "無法鎖定新的ä¿å­˜æª”"
-#: locale/programs/locarchive.c:485
+#: locale/programs/locarchive.c:509
#, c-format
msgid "cannot extend locale archive file"
msgstr "無法延展語å€è³‡æ–™ä¿å­˜æª”"
-#: locale/programs/locarchive.c:494
+#: locale/programs/locarchive.c:518
#, c-format
msgid "cannot change mode of resized locale archive"
msgstr "無法改變已變更大å°çš„語å€è³‡æ–™ä¿å­˜æª”狀態"
-#: locale/programs/locarchive.c:502
+#: locale/programs/locarchive.c:526
#, c-format
msgid "cannot rename new archive"
msgstr "無法更改新ä¿å­˜æª”å稱"
-#: locale/programs/locarchive.c:555
+#: locale/programs/locarchive.c:579
#, c-format
msgid "cannot open locale archive \"%s\""
msgstr "無法開啟語å€è³‡æ–™ä¿å­˜æª” \"%s\""
-#: locale/programs/locarchive.c:560
+#: locale/programs/locarchive.c:584
#, c-format
msgid "cannot stat locale archive \"%s\""
msgstr "無法統計語å€è³‡æ–™ä¿å­˜æª” \"%s\""
-#: locale/programs/locarchive.c:579
+#: locale/programs/locarchive.c:603
#, c-format
msgid "cannot lock locale archive \"%s\""
msgstr "無法鎖定語å€è³‡æ–™ä¿å­˜æª” \"%s\""
-#: locale/programs/locarchive.c:602
+#: locale/programs/locarchive.c:626
#, c-format
msgid "cannot read archive header"
msgstr "無法讀å–ä¿å­˜æª”表頭資料"
-#: locale/programs/locarchive.c:666
+#: locale/programs/locarchive.c:697
#, c-format
msgid "locale '%s' already exists"
msgstr "語å€è³‡æ–™ `%s' 已經存在"
-#: locale/programs/locarchive.c:928 locale/programs/locarchive.c:943
-#: locale/programs/locarchive.c:955 locale/programs/locarchive.c:967
+#: locale/programs/locarchive.c:959 locale/programs/locarchive.c:974
+#: locale/programs/locarchive.c:986 locale/programs/locarchive.c:998
#: locale/programs/locfile.c:343
#, c-format
msgid "cannot add to locale archive"
msgstr "無法加入語å€è³‡æ–™ä¿å­˜æª”"
-#: locale/programs/locarchive.c:1125
+#: locale/programs/locarchive.c:1156
#, c-format
msgid "locale alias file `%s' not found"
msgstr "找ä¸åˆ°èªžå€è³‡æ–™åˆ¥å檔 `%s'"
-#: locale/programs/locarchive.c:1275
+#: locale/programs/locarchive.c:1306
#, c-format
msgid "Adding %s\n"
msgstr "加入 %s 中\n"
-#: locale/programs/locarchive.c:1281
+#: locale/programs/locarchive.c:1312
#, c-format
msgid "stat of \"%s\" failed: %s: ignored"
msgstr "å–å¾— \"%s\" 的資訊時失敗: %s: 已忽略"
-#: locale/programs/locarchive.c:1287
+#: locale/programs/locarchive.c:1318
#, c-format
msgid "\"%s\" is no directory; ignored"
msgstr "\"%s\" 並éžç›®éŒ„; 已忽略"
-#: locale/programs/locarchive.c:1294
+#: locale/programs/locarchive.c:1325
#, c-format
msgid "cannot open directory \"%s\": %s: ignored"
msgstr "無法開啟目錄 \"%s\": %s: 已忽略"
-#: locale/programs/locarchive.c:1366
+#: locale/programs/locarchive.c:1397
#, c-format
msgid "incomplete set of locale files in \"%s\""
msgstr "ä¸å®Œæ•´çš„一組語å€è³‡æ–™æª”案存在於 \"%s\" 之中"
-#: locale/programs/locarchive.c:1430
+#: locale/programs/locarchive.c:1461
#, c-format
msgid "cannot read all files in \"%s\": ignored"
msgstr "ç„¡æ³•è®€å– \"%s\" 中的所有檔案: 已忽略"
-#: locale/programs/locarchive.c:1500
+#: locale/programs/locarchive.c:1531
#, c-format
msgid "locale \"%s\" not in archive"
msgstr "語å€è³‡æ–™ \"%s\" ä¸åœ¨ä¿å­˜æª”中"
@@ -2932,22 +2948,22 @@ msgstr "使用 `copy' 的時候ä¸æ‡‰è©²å†ç”¨åˆ°ä»»ä½•å…¶ä»–çš„é—œéµå­—了"
msgid "`%1$s' definition does not end with `END %1$s'"
msgstr "`%1$s' 定義沒有以 `END %1$s' çµæŸ"
-#: locale/programs/repertoire.c:228 locale/programs/repertoire.c:269
-#: locale/programs/repertoire.c:294
+#: locale/programs/repertoire.c:229 locale/programs/repertoire.c:270
+#: locale/programs/repertoire.c:295
#, c-format
msgid "syntax error in repertoire map definition: %s"
msgstr "編碼å°æ˜ æª”中的定義有語法錯誤: %s"
-#: locale/programs/repertoire.c:270
+#: locale/programs/repertoire.c:271
msgid "no <Uxxxx> or <Uxxxxxxxx> value given"
msgstr "沒有給定 <Uxxxx> 或 <Uxxxxxxxx> 的值"
-#: locale/programs/repertoire.c:330
+#: locale/programs/repertoire.c:331
#, c-format
msgid "cannot save new repertoire map"
msgstr "無法儲存新的編碼å°æ˜ æª”"
-#: locale/programs/repertoire.c:341
+#: locale/programs/repertoire.c:342
#, c-format
msgid "repertoire map file `%s' not found"
msgstr "找ä¸åˆ°ç·¨ç¢¼å°æ˜ æª” `%s'"
@@ -2978,23 +2994,23 @@ msgstr "太多引數"
msgid "needs to be installed setuid `root'"
msgstr "需è¦æ˜¯å·²å®‰è£çš„ setuid「根ã€"
-#: malloc/mcheck.c:348
+#: malloc/mcheck.c:347
msgid "memory is consistent, library is buggy\n"
msgstr "記憶體內容一致,函å¼åº«æœ‰å•é¡Œ\n"
-#: malloc/mcheck.c:351
+#: malloc/mcheck.c:350
msgid "memory clobbered before allocated block\n"
msgstr "記憶體在é…ç½®å€å¡Šä¹‹å‰å°± clobbered 了\n"
-#: malloc/mcheck.c:354
+#: malloc/mcheck.c:353
msgid "memory clobbered past end of allocated block\n"
msgstr "記憶體在經éŽé…置的å€å¡Šå°¾éƒ¨æ™‚ clobbered 了\n"
-#: malloc/mcheck.c:357
+#: malloc/mcheck.c:356
msgid "block freed twice\n"
msgstr "æ­¤å€å¡Šè¢«ç”¨ free 指令釋放了兩次\n"
-#: malloc/mcheck.c:360
+#: malloc/mcheck.c:359
msgid "bogus mcheck_status, library is buggy\n"
msgstr "記憶體檢查狀態 (mcheck_ststus) 有誤,您所用的函å¼åº«æœ‰å•é¡Œ\n"
@@ -3079,35 +3095,43 @@ msgstr "memusage:無法辨識的é¸é …「$1ã€"
msgid "No program name given"
msgstr "未給定程å¼å稱"
-#: malloc/memusagestat.c:55
+#: malloc/memusagestat.c:56
msgid "Name output file"
msgstr "å稱輸出檔"
-#: malloc/memusagestat.c:56
+#: malloc/memusagestat.c:57
+msgid "STRING"
+msgstr "字串"
+
+#: malloc/memusagestat.c:57
msgid "Title string used in output graphic"
msgstr "在輸出的圖åƒä¸­ä½¿ç”¨æœ‰æ¨™é ­çš„字串"
-#: malloc/memusagestat.c:57
+#: malloc/memusagestat.c:58
msgid "Generate output linear to time (default is linear to number of function calls)"
msgstr "產生輸出與時間呈線性關係 (é è¨­æ˜¯èˆ‡å‡½å¼å‘¼å«æ•¸ç›®å‘ˆç·šæ€§é—œä¿‚)"
-#: malloc/memusagestat.c:59
+#: malloc/memusagestat.c:62
msgid "Also draw graph for total memory consumption"
msgstr "åŒæ™‚å°ç¸½è¨˜æ†¶é«”用é‡ä½œåœ–"
-#: malloc/memusagestat.c:60
+#: malloc/memusagestat.c:63
+msgid "VALUE"
+msgstr "åƒç´ å€¼"
+
+#: malloc/memusagestat.c:64
msgid "Make output graphic VALUE pixels wide"
-msgstr "定製輸出圖形的寬度åƒç´  VALUE"
+msgstr "定製輸出圖形的寬度åƒç´ å€¼"
-#: malloc/memusagestat.c:61
+#: malloc/memusagestat.c:65
msgid "Make output graphic VALUE pixels high"
-msgstr "定製輸出圖形的高度åƒç´  VALUE"
+msgstr "定製輸出圖形的高度åƒç´ å€¼"
-#: malloc/memusagestat.c:66
+#: malloc/memusagestat.c:70
msgid "Generate graphic from memory profiling data"
msgstr "從記憶體性能測試資料產生圖åƒ"
-#: malloc/memusagestat.c:69
+#: malloc/memusagestat.c:73
msgid "DATAFILE [OUTFILE]"
msgstr "資料檔 [輸出檔]"
@@ -3119,7 +3143,7 @@ msgstr "未知的系統錯誤"
msgid "unable to free arguments"
msgstr "無法釋放åƒæ•¸"
-#: nis/nis_error.h:1 nis/ypclnt.c:832 nis/ypclnt.c:920 posix/regcomp.c:131
+#: nis/nis_error.h:1 nis/ypclnt.c:831 nis/ypclnt.c:919 posix/regcomp.c:133
#: sysdeps/gnu/errlist.c:20
msgid "Success"
msgstr "æˆåŠŸ"
@@ -3161,7 +3185,7 @@ msgid "First/next chain broken"
msgstr "第一個/下一個åºåˆ—壞掉了"
#. TRANS Permission denied; the file permissions do not allow the attempted operation.
-#: nis/nis_error.h:11 nis/ypclnt.c:877 sysdeps/gnu/errlist.c:157
+#: nis/nis_error.h:11 nis/ypclnt.c:876 sysdeps/gnu/errlist.c:157
msgid "Permission denied"
msgstr "拒絕ä¸ç¬¦æ¬Šé™çš„æ“作"
@@ -3318,123 +3342,123 @@ msgstr "主è¦ä¼ºæœå™¨å¿™ç¢Œä¸­ï¼Œé‡æ–°é€²è¡Œå®Œæ•´è³‡æ–™å‚¾å¸æŽ’程。"
msgid "LOCAL entry for UID %d in directory %s not unique\n"
msgstr "UID 為 %d 的項目在本地端中並ä¸æ˜¯å”¯ä¸€çš„ (在 %s 目錄裡é¢)\n"
-#: nis/nis_print.c:50
+#: nis/nis_print.c:51
msgid "UNKNOWN"
msgstr "ä¸æ˜Ž"
-#: nis/nis_print.c:108
+#: nis/nis_print.c:109
msgid "BOGUS OBJECT\n"
msgstr "å‡çš„物件\n"
-#: nis/nis_print.c:111
+#: nis/nis_print.c:112
msgid "NO OBJECT\n"
msgstr "沒有物件\n"
-#: nis/nis_print.c:114
+#: nis/nis_print.c:115
msgid "DIRECTORY\n"
msgstr "目錄\n"
-#: nis/nis_print.c:117
+#: nis/nis_print.c:118
msgid "GROUP\n"
msgstr "群組\n"
-#: nis/nis_print.c:120
+#: nis/nis_print.c:121
msgid "TABLE\n"
msgstr "表格\n"
-#: nis/nis_print.c:123
+#: nis/nis_print.c:124
msgid "ENTRY\n"
msgstr "é …ç›®\n"
-#: nis/nis_print.c:126
+#: nis/nis_print.c:127
msgid "LINK\n"
msgstr "連çµ\n"
-#: nis/nis_print.c:129
+#: nis/nis_print.c:130
msgid "PRIVATE\n"
msgstr "ç§æœ‰çš„\n"
-#: nis/nis_print.c:132
+#: nis/nis_print.c:133
msgid "(Unknown object)\n"
msgstr "(未知的物件)\n"
-#: nis/nis_print.c:166
+#: nis/nis_print.c:167
#, c-format
msgid "Name : `%s'\n"
msgstr "å稱 : `%s'\n"
-#: nis/nis_print.c:167
+#: nis/nis_print.c:168
#, c-format
msgid "Type : %s\n"
msgstr "æ ¼å¼ : %s\n"
-#: nis/nis_print.c:172
+#: nis/nis_print.c:173
msgid "Master Server :\n"
msgstr "主è¦ä¼ºæœå™¨ :\n"
-#: nis/nis_print.c:174
+#: nis/nis_print.c:175
msgid "Replicate :\n"
msgstr "複製 :\n"
-#: nis/nis_print.c:175
+#: nis/nis_print.c:176
#, c-format
msgid "\tName : %s\n"
msgstr "\tå稱 : %s\n"
-#: nis/nis_print.c:176
+#: nis/nis_print.c:177
msgid "\tPublic Key : "
msgstr "\t公共鑰匙 : "
-#: nis/nis_print.c:180
+#: nis/nis_print.c:181
msgid "None.\n"
msgstr "ç„¡\n"
-#: nis/nis_print.c:183
+#: nis/nis_print.c:184
#, c-format
msgid "Diffie-Hellmann (%d bits)\n"
msgstr "Diffie-Hellmann (%d ä½å…ƒ)\n"
-#: nis/nis_print.c:188
+#: nis/nis_print.c:189
#, c-format
msgid "RSA (%d bits)\n"
msgstr "RSA (%d ä½å…ƒ)\n"
-#: nis/nis_print.c:191
+#: nis/nis_print.c:192
msgid "Kerberos.\n"
msgstr "Kerberos.\n"
-#: nis/nis_print.c:194
+#: nis/nis_print.c:195
#, c-format
msgid "Unknown (type = %d, bits = %d)\n"
msgstr "未知的 (åž‹æ…‹ = %d,ä½å…ƒ = %d)\n"
-#: nis/nis_print.c:205
+#: nis/nis_print.c:206
#, c-format
msgid "\tUniversal addresses (%u)\n"
msgstr "\t絕å°ä½å€ (%u)\n"
-#: nis/nis_print.c:227
+#: nis/nis_print.c:228
msgid "Time to live : "
msgstr "存在時間 : "
-#: nis/nis_print.c:229
+#: nis/nis_print.c:230
msgid "Default Access rights :\n"
msgstr "é è¨­çš„å­˜å–æ¬Šé™ :\n"
-#: nis/nis_print.c:238
+#: nis/nis_print.c:239
#, c-format
msgid "\tType : %s\n"
msgstr "\t型別 : %s\n"
-#: nis/nis_print.c:239
+#: nis/nis_print.c:240
msgid "\tAccess rights: "
msgstr "\tå­˜å–權é™: "
-#: nis/nis_print.c:253
+#: nis/nis_print.c:254
msgid "Group Flags :"
msgstr "群組旗標 :"
-#: nis/nis_print.c:256
+#: nis/nis_print.c:257
msgid ""
"\n"
"Group Members :\n"
@@ -3442,95 +3466,95 @@ msgstr ""
"\n"
"群組的æˆå“¡ :\n"
-#: nis/nis_print.c:268
+#: nis/nis_print.c:269
#, c-format
msgid "Table Type : %s\n"
msgstr "è¡¨æ ¼å½¢å¼ : %s\n"
-#: nis/nis_print.c:269
+#: nis/nis_print.c:270
#, c-format
msgid "Number of Columns : %d\n"
msgstr "欄ä½çš„數目 : %d\n"
-#: nis/nis_print.c:270
+#: nis/nis_print.c:271
#, c-format
msgid "Character Separator : %c\n"
msgstr "字元分隔號 : %c\n"
-#: nis/nis_print.c:271
+#: nis/nis_print.c:272
#, c-format
msgid "Search Path : %s\n"
msgstr "æœå°‹è·¯å¾‘ : %s\n"
-#: nis/nis_print.c:272
+#: nis/nis_print.c:273
msgid "Columns :\n"
msgstr "行 :\n"
-#: nis/nis_print.c:275
+#: nis/nis_print.c:276
#, c-format
msgid "\t[%d]\tName : %s\n"
msgstr "\t[%d]\tå稱 : %s\n"
-#: nis/nis_print.c:277
+#: nis/nis_print.c:278
msgid "\t\tAttributes : "
msgstr "\t\t屬性 : "
-#: nis/nis_print.c:279
+#: nis/nis_print.c:280
msgid "\t\tAccess Rights : "
msgstr "\t\tå­˜å–æ¬Šé™ : "
-#: nis/nis_print.c:289
+#: nis/nis_print.c:290
msgid "Linked Object Type : "
msgstr "連çµçš„物件型態 : "
-#: nis/nis_print.c:291
+#: nis/nis_print.c:292
#, c-format
msgid "Linked to : %s\n"
msgstr "連çµåˆ° : %s\n"
-#: nis/nis_print.c:301
+#: nis/nis_print.c:302
#, c-format
msgid "\tEntry data of type %s\n"
msgstr "\t型別為 %s 的項目資料\n"
-#: nis/nis_print.c:304
+#: nis/nis_print.c:305
#, c-format
msgid "\t[%u] - [%u bytes] "
msgstr "\t[%u] - [%u ä½å…ƒçµ„] "
-#: nis/nis_print.c:307
+#: nis/nis_print.c:308
msgid "Encrypted data\n"
msgstr "編碼資料\n"
-#: nis/nis_print.c:309
+#: nis/nis_print.c:310
msgid "Binary data\n"
msgstr "二進ä½è³‡æ–™\n"
-#: nis/nis_print.c:325
+#: nis/nis_print.c:326
#, c-format
msgid "Object Name : %s\n"
msgstr "物件å稱 : %s\n"
-#: nis/nis_print.c:326
+#: nis/nis_print.c:327
#, c-format
msgid "Directory : %s\n"
msgstr "目錄 : %s\n"
-#: nis/nis_print.c:327
+#: nis/nis_print.c:328
#, c-format
msgid "Owner : %s\n"
msgstr "æ“有者 : %s\n"
-#: nis/nis_print.c:328
+#: nis/nis_print.c:329
#, c-format
msgid "Group : %s\n"
msgstr "群組 : %s\n"
-#: nis/nis_print.c:329
+#: nis/nis_print.c:330
msgid "Access Rights : "
msgstr "å­˜å–æ¬Šé™ : "
-#: nis/nis_print.c:331
+#: nis/nis_print.c:332
#, c-format
msgid ""
"\n"
@@ -3539,90 +3563,90 @@ msgstr ""
"\n"
"存在的時間 : "
-#: nis/nis_print.c:334
+#: nis/nis_print.c:335
#, c-format
msgid "Creation Time : %s"
msgstr "產生時間 : %s"
-#: nis/nis_print.c:336
+#: nis/nis_print.c:337
#, c-format
msgid "Mod. Time : %s"
msgstr "修改時間 : %s"
-#: nis/nis_print.c:337
+#: nis/nis_print.c:338
msgid "Object Type : "
msgstr "物件型別 : "
-#: nis/nis_print.c:357
+#: nis/nis_print.c:358
#, c-format
msgid " Data Length = %u\n"
msgstr " 資料長度 = %u\n"
-#: nis/nis_print.c:371
+#: nis/nis_print.c:372
#, c-format
msgid "Status : %s\n"
msgstr "狀態 : %s\n"
-#: nis/nis_print.c:372
+#: nis/nis_print.c:373
#, c-format
msgid "Number of objects : %u\n"
msgstr "物件的數目 : %u\n"
-#: nis/nis_print.c:376
+#: nis/nis_print.c:377
#, c-format
msgid "Object #%d:\n"
msgstr "目的檔 #%d:\n"
-#: nis/nis_print_group_entry.c:117
+#: nis/nis_print_group_entry.c:116
#, c-format
msgid "Group entry for \"%s.%s\" group:\n"
msgstr "群組 \"%s.%s\" 群組項目:\n"
-#: nis/nis_print_group_entry.c:125
+#: nis/nis_print_group_entry.c:124
msgid " Explicit members:\n"
msgstr " 明確的æˆå“¡:\n"
-#: nis/nis_print_group_entry.c:130
+#: nis/nis_print_group_entry.c:129
msgid " No explicit members\n"
msgstr " 沒有明確的æˆå“¡\n"
-#: nis/nis_print_group_entry.c:133
+#: nis/nis_print_group_entry.c:132
msgid " Implicit members:\n"
msgstr " ä¸æ˜Žç¢ºçš„æˆå“¡:\n"
-#: nis/nis_print_group_entry.c:138
+#: nis/nis_print_group_entry.c:137
msgid " No implicit members\n"
msgstr " 沒有ä¸æ˜Žç¢ºçš„æˆå“¡\n"
-#: nis/nis_print_group_entry.c:141
+#: nis/nis_print_group_entry.c:140
msgid " Recursive members:\n"
msgstr " éžè¿´çš„æˆå“¡:\n"
-#: nis/nis_print_group_entry.c:146
+#: nis/nis_print_group_entry.c:145
msgid " No recursive members\n"
msgstr " 沒有éžè¿´çš„æˆå“¡\n"
-#: nis/nis_print_group_entry.c:149
+#: nis/nis_print_group_entry.c:148
msgid " Explicit nonmembers:\n"
msgstr " 明確的éžæˆå“¡:\n"
-#: nis/nis_print_group_entry.c:154
+#: nis/nis_print_group_entry.c:153
msgid " No explicit nonmembers\n"
msgstr " 沒有明確的éžæˆå“¡\n"
-#: nis/nis_print_group_entry.c:157
+#: nis/nis_print_group_entry.c:156
msgid " Implicit nonmembers:\n"
msgstr " ä¸æ˜Žç¢ºçš„éžæˆå“¡:\n"
-#: nis/nis_print_group_entry.c:162
+#: nis/nis_print_group_entry.c:161
msgid " No implicit nonmembers\n"
msgstr " 沒有ä¸æ˜Žç¢ºçš„éžæˆå“¡\n"
-#: nis/nis_print_group_entry.c:165
+#: nis/nis_print_group_entry.c:164
msgid " Recursive nonmembers:\n"
msgstr " éžè¿´çš„éžæˆå“¡ï¼š\n"
-#: nis/nis_print_group_entry.c:170
+#: nis/nis_print_group_entry.c:169
msgid " No recursive nonmembers\n"
msgstr " 沒有éžè¿´çš„éžæˆå“¡\n"
@@ -3664,100 +3688,100 @@ msgstr "netname2user: %s 的本地端項目在 %s 目錄下並ä¸æ˜¯å”¯ä¸€çš„"
msgid "netname2user: should not have uid 0"
msgstr "netname2user: ä¸èƒ½æœ‰ä½¿ç”¨è€… id 為 0 的情æ³"
-#: nis/ypclnt.c:835
+#: nis/ypclnt.c:834
msgid "Request arguments bad"
msgstr "必須引數有錯誤"
-#: nis/ypclnt.c:838
+#: nis/ypclnt.c:837
msgid "RPC failure on NIS operation"
msgstr "NIS é‹ä½œ RPC 失敗"
-#: nis/ypclnt.c:841
+#: nis/ypclnt.c:840
msgid "Can't bind to server which serves this domain"
msgstr "無法與æœå‹™æ–¼æ­¤ç¶²åŸŸçš„伺æœå™¨è¯ç¹«"
-#: nis/ypclnt.c:844
+#: nis/ypclnt.c:843
msgid "No such map in server's domain"
msgstr "在伺æœå™¨çš„領域資料中找ä¸åˆ°æ­¤ä¸€å°æ˜ è¡¨"
-#: nis/ypclnt.c:847
+#: nis/ypclnt.c:846
msgid "No such key in map"
msgstr "在å°æ˜ è¡¨ä¸­æ²’有此一éµå€¼"
-#: nis/ypclnt.c:850
+#: nis/ypclnt.c:849
msgid "Internal NIS error"
msgstr "內部 NIS 錯誤"
-#: nis/ypclnt.c:853
+#: nis/ypclnt.c:852
msgid "Local resource allocation failure"
msgstr "å€åŸŸè³‡æºé…置失敗"
-#: nis/ypclnt.c:856
+#: nis/ypclnt.c:855
msgid "No more records in map database"
msgstr "在å°æ˜ è¡¨è³‡æ–™åº«ä¸­æ²’有其他紀錄了"
-#: nis/ypclnt.c:859
+#: nis/ypclnt.c:858
msgid "Can't communicate with portmapper"
msgstr "無法與 portmapper 通訊"
-#: nis/ypclnt.c:862
+#: nis/ypclnt.c:861
msgid "Can't communicate with ypbind"
msgstr "無法與 ypbind 通訊"
-#: nis/ypclnt.c:865
+#: nis/ypclnt.c:864
msgid "Can't communicate with ypserv"
msgstr "無法與 ypserv 通訊"
-#: nis/ypclnt.c:868
+#: nis/ypclnt.c:867
msgid "Local domain name not set"
msgstr "å€åŸŸç¶²åŸŸå稱沒有設定"
-#: nis/ypclnt.c:871
+#: nis/ypclnt.c:870
msgid "NIS map database is bad"
msgstr "NIS å°æ˜ è³‡æ–™åº«æ˜¯å£žçš„"
-#: nis/ypclnt.c:874
+#: nis/ypclnt.c:873
msgid "NIS client/server version mismatch - can't supply service"
msgstr "NIS 請求端/伺æœç«¯ç‰ˆæœ¬ä¸ç¬¦åˆ - 無法æä¾›æœå‹™"
-#: nis/ypclnt.c:880
+#: nis/ypclnt.c:879
msgid "Database is busy"
msgstr "資料庫正在忙碌"
-#: nis/ypclnt.c:883
+#: nis/ypclnt.c:882
msgid "Unknown NIS error code"
msgstr "未知的 NIS 錯誤碼"
-#: nis/ypclnt.c:923
+#: nis/ypclnt.c:922
msgid "Internal ypbind error"
msgstr "內部 ypbind 錯誤"
-#: nis/ypclnt.c:926
+#: nis/ypclnt.c:925
msgid "Domain not bound"
msgstr "網域找ä¸åˆ°"
-#: nis/ypclnt.c:929
+#: nis/ypclnt.c:928
msgid "System resource allocation failure"
msgstr "系統資æºé…置失敗"
-#: nis/ypclnt.c:932
+#: nis/ypclnt.c:931
msgid "Unknown ypbind error"
msgstr "未知的 ypbind 錯誤"
-#: nis/ypclnt.c:973
+#: nis/ypclnt.c:972
msgid "yp_update: cannot convert host to netname\n"
msgstr "yp_update: 無法轉æ›ä¸»æ©Ÿçš„網路å稱\n"
-#: nis/ypclnt.c:991
+#: nis/ypclnt.c:990
msgid "yp_update: cannot get server address\n"
msgstr "yp_update: 無法å–得伺æœå™¨ä½å€\n"
-#: nscd/aicache.c:82 nscd/hstcache.c:493
+#: nscd/aicache.c:82 nscd/hstcache.c:494
#, c-format
msgid "Haven't found \"%s\" in hosts cache!"
msgstr "尚未在 hosts å¿«å–中找到 \"%s\"!"
-#: nscd/aicache.c:84 nscd/hstcache.c:495
+#: nscd/aicache.c:84 nscd/hstcache.c:496
#, c-format
msgid "Reloading \"%s\" in hosts cache!"
msgstr "é‡æ–°è¼‰å…¥ã€Œ%sã€æ–¼ä¸»æ©Ÿå¿«å–ï¼"
@@ -3771,7 +3795,7 @@ msgstr "加入新的項目「%sã€çš„åž‹æ…‹ %s 用於 %s 到 cache%s"
msgid " (first)"
msgstr " (å…ˆ)"
-#: nscd/cache.c:285 nscd/connections.c:1002
+#: nscd/cache.c:285 nscd/connections.c:1019
#, c-format
msgid "cannot stat() file `%s': %s"
msgstr "無法 stat() 檔案 `%s': %s"
@@ -3786,242 +3810,242 @@ msgstr "pruning %s å¿«å–;時間 %ld"
msgid "considering %s entry \"%s\", timeout %<PRIu64>"
msgstr "èªç‚ºä¸­ %s 項目「%sã€ï¼Œé€¾æ™‚ %<PRIu64>"
-#: nscd/connections.c:570
+#: nscd/connections.c:571
#, c-format
msgid "invalid persistent database file \"%s\": %s"
msgstr "無效的永久性的資料庫檔案「%sã€ï¼š%s"
-#: nscd/connections.c:578
+#: nscd/connections.c:579
msgid "uninitialized header"
msgstr "未起始的標頭"
-#: nscd/connections.c:583
+#: nscd/connections.c:584
msgid "header size does not match"
msgstr "é é¦–大å°ä¸å»åˆ"
-#: nscd/connections.c:593
+#: nscd/connections.c:594
msgid "file size does not match"
msgstr "檔案大å°ä¸å»åˆ"
-#: nscd/connections.c:610
+#: nscd/connections.c:611
msgid "verification failed"
msgstr "查核失敗"
-#: nscd/connections.c:624
+#: nscd/connections.c:625
#, c-format
msgid "suggested size of table for database %s larger than the persistent database's table"
msgstr "用於資料庫 %s 的建議表格大å°å¤§æ–¼æ°¸ä¹…性的資料庫表格"
-#: nscd/connections.c:635 nscd/connections.c:720
+#: nscd/connections.c:636 nscd/connections.c:721
#, c-format
msgid "cannot create read-only descriptor for \"%s\"; no mmap"
msgstr "無法建立用於「%sã€çš„唯讀æ述元;無 mmap"
-#: nscd/connections.c:651
+#: nscd/connections.c:652
#, c-format
msgid "cannot access '%s'"
msgstr "無法存å–『%sã€"
-#: nscd/connections.c:699
+#: nscd/connections.c:700
#, c-format
msgid "database for %s corrupted or simultaneously used; remove %s manually if necessary and restart"
msgstr "資料庫用於 %s å·²æ壞或åŒæ­¥åœ°ä½¿ç”¨ï¼›ç§»é™¤ %s 手動地如果必è¦çš„話和é‡æ–°å•Ÿå‹•"
-#: nscd/connections.c:706
+#: nscd/connections.c:707
#, c-format
msgid "cannot create %s; no persistent database used"
msgstr "無法建立 %s; 未使用永久性的資料庫"
-#: nscd/connections.c:709
+#: nscd/connections.c:710
#, c-format
msgid "cannot create %s; no sharing possible"
msgstr "無法建立 %s; ä¸å¯èƒ½å…±äº«"
-#: nscd/connections.c:780
+#: nscd/connections.c:781
#, c-format
msgid "cannot write to database file %s: %s"
msgstr "無法寫入資料庫檔案 %s: %s"
-#: nscd/connections.c:819
+#: nscd/connections.c:820
#, c-format
msgid "cannot set socket to close on exec: %s; disabling paranoia mode"
msgstr "無法設定通訊端到關閉於 exec:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:868
+#: nscd/connections.c:869
#, c-format
msgid "cannot open socket: %s"
msgstr "無法開啟 socket: %s"
-#: nscd/connections.c:888 nscd/connections.c:952
+#: nscd/connections.c:889 nscd/connections.c:953
#, c-format
msgid "cannot change socket to nonblocking mode: %s"
msgstr "無法變更通訊端為éžå€å¡Šæ¨¡å¼ï¼š%s"
-#: nscd/connections.c:896 nscd/connections.c:962
+#: nscd/connections.c:897 nscd/connections.c:963
#, c-format
msgid "cannot set socket to close on exec: %s"
msgstr "無法設定通訊端於 exec:%s 時關閉"
-#: nscd/connections.c:909
+#: nscd/connections.c:910
#, c-format
msgid "cannot enable socket to accept connections: %s"
msgstr "無法開啟 socket 來接å—連線: %s"
-#: nscd/connections.c:986
+#: nscd/connections.c:1003
#, c-format
msgid "register trace file %s for database %s"
msgstr "註冊追蹤檔案 %s 用於資料庫 %s"
-#: nscd/connections.c:1116
+#: nscd/connections.c:1133
#, c-format
msgid "provide access to FD %d, for %s"
msgstr "æ供存å–到 FD %d, 用於 %s"
-#: nscd/connections.c:1128
+#: nscd/connections.c:1145
#, c-format
msgid "cannot handle old request version %d; current version is %d"
msgstr "ä¸èƒ½è™•ç†èˆŠ %d 版的請求;目å‰ä½¿ç”¨çš„版本是 %d"
-#: nscd/connections.c:1150
+#: nscd/connections.c:1167
#, c-format
msgid "request from %ld not handled due to missing permission"
msgstr "由於缺少權é™è€Œç„¡æ³•è™•ç†ä¾†è‡ª %ld çš„è¦æ±‚"
-#: nscd/connections.c:1155
+#: nscd/connections.c:1172
#, c-format
msgid "request from '%s' [%ld] not handled due to missing permission"
msgstr "由於缺少權é™è€Œç„¡æ³•è™•ç†ä¾†è‡ª '%s' [%ld] çš„è¦æ±‚"
-#: nscd/connections.c:1160
+#: nscd/connections.c:1177
msgid "request not handled due to missing permission"
msgstr "è¦æ±‚無法控柄的由於缺少權é™"
-#: nscd/connections.c:1198 nscd/connections.c:1251
+#: nscd/connections.c:1215 nscd/connections.c:1268
#, c-format
msgid "cannot write result: %s"
msgstr "無法寫入çµæžœ: %s"
-#: nscd/connections.c:1342
+#: nscd/connections.c:1359
#, c-format
msgid "error getting caller's id: %s"
msgstr "å–得呼å«ç¨‹å¼è­˜åˆ¥ç¢¼æ™‚發生錯誤: %s"
-#: nscd/connections.c:1402
+#: nscd/connections.c:1419
#, c-format
msgid "cannot open /proc/self/cmdline: %s; disabling paranoia mode"
msgstr "無法開啟/proc/self/cmdline:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1416
+#: nscd/connections.c:1433
#, c-format
msgid "cannot read /proc/self/cmdline: %s; disabling paranoia mode"
msgstr "無法讀å–/proc/self/cmdline:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1456
+#: nscd/connections.c:1473
#, c-format
msgid "cannot change to old UID: %s; disabling paranoia mode"
msgstr "無法變更為舊的 UID:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1466
+#: nscd/connections.c:1483
#, c-format
msgid "cannot change to old GID: %s; disabling paranoia mode"
msgstr "無法變更為舊的 GID:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1479
+#: nscd/connections.c:1496
#, c-format
msgid "cannot change to old working directory: %s; disabling paranoia mode"
msgstr "無法變更為舊的工作目錄:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1525
+#: nscd/connections.c:1542
#, c-format
msgid "re-exec failed: %s; disabling paranoia mode"
msgstr "re-exec 失敗:%s; åœç”¨ paranoia 模å¼"
-#: nscd/connections.c:1534
+#: nscd/connections.c:1551
#, c-format
msgid "cannot change current working directory to \"/\": %s"
msgstr "無法變更目å‰çš„工作目錄到「/ã€ï¼š%s"
-#: nscd/connections.c:1727
+#: nscd/connections.c:1744
#, c-format
msgid "short read while reading request: %s"
msgstr "讀å–請求時發ç¾è¼¸å…¥å€¼éŽçŸ­: %s"
-#: nscd/connections.c:1760
+#: nscd/connections.c:1777
#, c-format
msgid "key length in request too long: %d"
msgstr "在此請求中使用的éµå€¼å¤ªé•·äº†: %d"
-#: nscd/connections.c:1773
+#: nscd/connections.c:1790
#, c-format
msgid "short read while reading request key: %s"
msgstr "讀å–請求的éµå€¼æ™‚發ç¾è¼¸å…¥å€¼éŽçŸ­: %s"
-#: nscd/connections.c:1782
+#: nscd/connections.c:1800
#, c-format
msgid "handle_request: request received (Version = %d) from PID %ld"
msgstr "handle_request: è«‹æ±‚å·²è¢«æŽ¥å— (版本為 %d) 來自於 PID %ld"
-#: nscd/connections.c:1787
+#: nscd/connections.c:1805
#, c-format
msgid "handle_request: request received (Version = %d)"
msgstr "handle_request: è«‹æ±‚å·²è¢«æŽ¥å— (版本為 %d)"
-#: nscd/connections.c:1999 nscd/connections.c:2227
+#: nscd/connections.c:2069 nscd/connections.c:2271
#, c-format
msgid "disabled inotify after read error %d"
msgstr "è®€å– %d 錯誤之後已åœç”¨ inotify"
-#: nscd/connections.c:2374
+#: nscd/connections.c:2394
msgid "could not initialize conditional variable"
msgstr "無法åˆå§‹åŒ–æ¢ä»¶è®Šæ•¸"
-#: nscd/connections.c:2382
+#: nscd/connections.c:2402
msgid "could not start clean-up thread; terminating"
msgstr "無法開始清ç†åŸ·è¡Œç·’;終止中"
-#: nscd/connections.c:2396
+#: nscd/connections.c:2416
msgid "could not start any worker thread; terminating"
msgstr "無法開始任何背景工作執行緒;終止中"
-#: nscd/connections.c:2447 nscd/connections.c:2448 nscd/connections.c:2465
-#: nscd/connections.c:2474 nscd/connections.c:2492 nscd/connections.c:2503
-#: nscd/connections.c:2514
+#: nscd/connections.c:2467 nscd/connections.c:2468 nscd/connections.c:2485
+#: nscd/connections.c:2494 nscd/connections.c:2512 nscd/connections.c:2523
+#: nscd/connections.c:2534
#, c-format
msgid "Failed to run nscd as user '%s'"
msgstr "以使用者 '%s' 的身分執行 nscd 失敗"
-#: nscd/connections.c:2466
+#: nscd/connections.c:2486
#, c-format
msgid "initial getgrouplist failed"
msgstr "åˆå§‹ getgrouplist 失敗"
-#: nscd/connections.c:2475
+#: nscd/connections.c:2495
#, c-format
msgid "getgrouplist failed"
msgstr "getgrouplist 失敗"
-#: nscd/connections.c:2493
+#: nscd/connections.c:2513
#, c-format
msgid "setgroups failed"
msgstr "setgroups 失敗"
-#: nscd/grpcache.c:407 nscd/hstcache.c:440 nscd/initgrcache.c:411
-#: nscd/pwdcache.c:383 nscd/servicescache.c:338
+#: nscd/grpcache.c:413 nscd/hstcache.c:441 nscd/initgrcache.c:419
+#: nscd/pwdcache.c:391 nscd/servicescache.c:346
#, c-format
msgid "short write in %s: %s"
msgstr "寫入 %s 的資料éŽçŸ­: %s"
-#: nscd/grpcache.c:452 nscd/initgrcache.c:77
+#: nscd/grpcache.c:458 nscd/initgrcache.c:77
#, c-format
msgid "Haven't found \"%s\" in group cache!"
msgstr "尚未在群組快å–中找到 \"%s\"!"
-#: nscd/grpcache.c:454 nscd/initgrcache.c:79
+#: nscd/grpcache.c:460 nscd/initgrcache.c:79
#, c-format
msgid "Reloading \"%s\" in group cache!"
msgstr "é‡æ–°è¼‰å…¥ã€Œ%sã€æ–¼ç¾¤çµ„å¿«å–ï¼"
-#: nscd/grpcache.c:533
+#: nscd/grpcache.c:539
#, c-format
msgid "Invalid numeric gid \"%s\"!"
msgstr "無效的 gid 數值 \"%s\"!"
@@ -4046,12 +4070,12 @@ msgstr "尚未在網路群組快å–中找到「%sã€ï¼"
msgid "Reloading \"%s\" in netgroup cache!"
msgstr "é‡æ–°åœ¨ç¶²è·¯ç¾¤çµ„å¿«å–中載入「%sã€ï¼"
-#: nscd/netgroupcache.c:467
+#: nscd/netgroupcache.c:475
#, c-format
msgid "Haven't found \"%s (%s,%s,%s)\" in netgroup cache!"
msgstr "尚未在網路群組快å–中找到「%s (%s,%s,%s)ã€ï¼"
-#: nscd/netgroupcache.c:470
+#: nscd/netgroupcache.c:478
#, c-format
msgid "Reloading \"%s (%s,%s,%s)\" in netgroup cache!"
msgstr "é‡æ–°åœ¨ç¶²è·¯ç¾¤çµ„å¿«å–中載入「%s (%s,%s,%s)ã€ï¼"
@@ -4104,7 +4128,7 @@ msgstr "å°ä¸åŒä½¿ç”¨è€…使用ä¸åŒçš„å¿«å–檔案"
msgid "Name Service Cache Daemon."
msgstr "網域å稱快å–ç²¾éˆ"
-#: nscd/nscd.c:164 nss/getent.c:999 nss/makedb.c:208
+#: nscd/nscd.c:164 nss/getent.c:999 nss/makedb.c:206
#, c-format
msgid "wrong number of arguments"
msgstr "åƒæ•¸æ•¸ç›®ä¸å°"
@@ -4119,46 +4143,46 @@ msgstr "讀å–組態檔案時失敗;這是一個嚴é‡éŒ¯èª¤"
msgid "already running"
msgstr "已在執行"
-#: nscd/nscd.c:201 nscd/nscd.c:259
+#: nscd/nscd.c:201
#, c-format
msgid "cannot fork"
msgstr "無法è¡ç”Ÿ"
-#: nscd/nscd.c:268
+#: nscd/nscd.c:259
#, c-format
msgid "cannot change current working directory to \"/\""
msgstr "無法變更目å‰çš„工作目錄到「/ã€"
-#: nscd/nscd.c:276
+#: nscd/nscd.c:267
msgid "Could not create log file"
msgstr "無法建立記錄檔"
-#: nscd/nscd.c:348 nscd/nscd.c:373 nscd/nscd_stat.c:173
+#: nscd/nscd.c:339 nscd/nscd.c:364 nscd/nscd_stat.c:173
#, c-format
msgid "Only root is allowed to use this option!"
msgstr "åªæœ‰ root æ‰å¯ä»¥ä½¿ç”¨æ­¤ä¸€é¸é …!"
-#: nscd/nscd.c:388
+#: nscd/nscd.c:379
#, c-format
msgid "'%s' is not a known database"
msgstr "『%sã€ä¸¦éžä¸€å·²çŸ¥è³‡æ–™åº«"
-#: nscd/nscd.c:413 nscd/nscd_stat.c:192
+#: nscd/nscd.c:404 nscd/nscd_stat.c:192
#, c-format
msgid "write incomplete"
msgstr "寫入ä¸å®Œå…¨"
-#: nscd/nscd.c:424
+#: nscd/nscd.c:415
#, c-format
msgid "cannot read invalidate ACK"
msgstr "無法讀å–設為無效的 ACK"
-#: nscd/nscd.c:430
+#: nscd/nscd.c:421
#, c-format
msgid "invalidation failed"
msgstr "無效化失敗"
-#: nscd/nscd.c:440
+#: nscd/nscd.c:431
#, c-format
msgid "secure services not implemented anymore"
msgstr "安全æœå‹™ä¸å†å¯¦ä½œ"
@@ -4330,17 +4354,17 @@ msgstr ""
"%15<PRIuMAX> 記憶體é…置失敗\n"
"%15s 檢查 /etc/%s 的變更\n"
-#: nscd/pwdcache.c:428
+#: nscd/pwdcache.c:436
#, c-format
msgid "Haven't found \"%s\" in password cache!"
msgstr "尚未在密碼快å–中找到 \"%s\"!"
-#: nscd/pwdcache.c:430
+#: nscd/pwdcache.c:438
#, c-format
msgid "Reloading \"%s\" in password cache!"
msgstr "é‡æ–°è¼‰å…¥ã€Œ%sã€æ–¼å¯†ç¢¼å¿«å–ï¼"
-#: nscd/pwdcache.c:511
+#: nscd/pwdcache.c:519
#, c-format
msgid "Invalid numeric uid \"%s\"!"
msgstr "無效的 uid 數值 \"%s\"!"
@@ -4447,12 +4471,12 @@ msgstr ""
"%15u CAV 探查\n"
"%15u CAV 缺少\n"
-#: nscd/servicescache.c:387
+#: nscd/servicescache.c:395
#, c-format
msgid "Haven't found \"%s\" in services cache!"
msgstr "尚未在æœå‹™å¿«å–中找到「%sã€!"
-#: nscd/servicescache.c:389
+#: nscd/servicescache.c:397
#, c-format
msgid "Reloading \"%s\" in services cache!"
msgstr "é‡æ–°è¼‰å…¥ã€Œ%sã€æ–¼æœå‹™å¿«å–ï¼"
@@ -4462,8 +4486,12 @@ msgid "database [key ...]"
msgstr "資料庫 [éµå€¼â€¦]"
#: nss/getent.c:58
+msgid "CONFIG"
+msgstr "組態"
+
+#: nss/getent.c:58
msgid "Service configuration to be used"
-msgstr "å°‡è¦ä½¿ç”¨çš„æœå‹™è¨­å®š"
+msgstr "å°‡è¦ä½¿ç”¨çš„æœå‹™çµ„æ…‹"
#: nss/getent.c:59
msgid "disable IDN encoding"
@@ -4492,31 +4520,31 @@ msgstr "支æ´çš„資料庫:\n"
msgid "Unknown database: %s\n"
msgstr "未知的資料庫: %s\n"
-#: nss/makedb.c:118
+#: nss/makedb.c:119
msgid "Convert key to lower case"
msgstr "轉æ›éµè½‰æ›ç‚ºå°å¯«"
-#: nss/makedb.c:121
+#: nss/makedb.c:122
msgid "Do not print messages while building database"
msgstr "ä¸å°å‡ºè¨Šæ¯ç•¶å»ºç«‹è³‡æ–™åº«"
-#: nss/makedb.c:123
+#: nss/makedb.c:124
msgid "Print content of database file, one entry a line"
msgstr "å°å‡ºå…§å®¹çš„資料庫檔案,一個項目列"
-#: nss/makedb.c:124
+#: nss/makedb.c:125
msgid "CHAR"
msgstr "å­—å…ƒ"
-#: nss/makedb.c:125
+#: nss/makedb.c:126
msgid "Generated line not part of iteration"
msgstr "產生的列並éžè¿­ä»£çš„部分"
-#: nss/makedb.c:130
+#: nss/makedb.c:131
msgid "Create simple database from textual input."
msgstr "從文字輸入建立簡單的資料庫。"
-#: nss/makedb.c:133
+#: nss/makedb.c:134
msgid ""
"INPUT-FILE OUTPUT-FILE\n"
"-o OUTPUT-FILE INPUT-FILE\n"
@@ -4526,71 +4554,76 @@ msgstr ""
"-o 輸出檔案å稱 輸入檔案å稱\n"
"-u 輸入檔案å稱"
-#: nss/makedb.c:229
+#: nss/makedb.c:227
#, c-format
msgid "cannot open database file `%s'"
msgstr "無法開啟資料庫檔案 %s"
-#: nss/makedb.c:274
+#: nss/makedb.c:272
#, c-format
msgid "no entries to be processed"
msgstr "沒有æ¢ç›®å¯ä¾›è™•ç†"
-#: nss/makedb.c:284
+#: nss/makedb.c:282
#, c-format
msgid "cannot create temporary file name"
msgstr "無法建立暫存檔案å稱"
-#: nss/makedb.c:306
+#: nss/makedb.c:288
+#, c-format
+msgid "cannot create temporary file"
+msgstr "無法產生暫時檔"
+
+#: nss/makedb.c:304
#, c-format
msgid "cannot stat newly created file"
msgstr "無法å–得新建立檔案的狀態"
-#: nss/makedb.c:317
+#: nss/makedb.c:315
#, c-format
msgid "cannot rename temporary file"
msgstr "無法é‡æ–°å‘½å暫存檔案"
-#: nss/makedb.c:533 nss/makedb.c:556
+#: nss/makedb.c:531 nss/makedb.c:554
#, c-format
msgid "cannot create search tree"
msgstr "無法建立æœå°‹æ¨¹"
-#: nss/makedb.c:562
+#: nss/makedb.c:560
msgid "duplicate key"
msgstr "é‡è¤‡éµå€¼"
-#: nss/makedb.c:574
+#: nss/makedb.c:572
#, c-format
msgid "problems while reading `%s'"
msgstr "讀å–「%sã€æ™‚發生å•é¡Œ"
-#: nss/makedb.c:801
+#: nss/makedb.c:799
#, c-format
msgid "failed to write new database file"
msgstr "寫入新資料庫檔案時失敗"
-#: nss/makedb.c:814
+#: nss/makedb.c:812
#, c-format
msgid "cannot stat database file"
msgstr "無法å–得資料庫檔案的狀態"
-#: nss/makedb.c:819
+#: nss/makedb.c:817
#, c-format
msgid "cannot map database file"
msgstr "無法映射資料庫檔案"
-#: nss/makedb.c:822
+#: nss/makedb.c:820
#, c-format
msgid "file not a database file"
msgstr "檔案ä¸æ˜¯è³‡æ–™åº«æª”案"
-#: nss/makedb.c:873
+#: nss/makedb.c:871
#, c-format
msgid "cannot set file creation context for `%s'"
msgstr "無法為 %s 設定檔案建立語境"
-#: ports/sysdeps/unix/sysv/linux/ia64/makecontext.c:62
+#: ports/sysdeps/unix/sysv/linux/ia64/makecontext.c:58
#, c-format
msgid "makecontext: does not know how to handle more than 8 arguments\n"
msgstr "makecontext: ä¸çŸ¥è¦å¦‚何處ç†è¶…éŽå…«å€‹å¼•æ•¸\n"
@@ -4643,131 +4676,131 @@ msgstr "未定義"
msgid "Unrecognized variable `%s'"
msgstr "無法識別的變數 `%s'"
-#: posix/getopt.c:593 posix/getopt.c:622
+#: posix/getopt.c:592 posix/getopt.c:621
#, c-format
msgid "%s: option '%s' is ambiguous; possibilities:"
msgstr "%s:é¸é …『%sã€æ˜¯æ¨¡ç¨œå…©å¯çš„ï¼›å¯èƒ½æ˜¯ï¼š"
-#: posix/getopt.c:663 posix/getopt.c:667
+#: posix/getopt.c:662 posix/getopt.c:666
#, c-format
msgid "%s: option '--%s' doesn't allow an argument\n"
msgstr "%s: é¸é … `--%s' ä¸å…許附加引數\n"
-#: posix/getopt.c:676 posix/getopt.c:681
+#: posix/getopt.c:675 posix/getopt.c:680
#, c-format
msgid "%s: option '%c%s' doesn't allow an argument\n"
msgstr "%s: é¸é … `%c%s' ä¸å…許附加引數\n"
-#: posix/getopt.c:724 posix/getopt.c:743
+#: posix/getopt.c:723 posix/getopt.c:742
#, c-format
msgid "%s: option '--%s' requires an argument\n"
msgstr "%s:é¸é …『--%sã€éœ€è¦ä¸€å€‹å¼•æ•¸\n"
-#: posix/getopt.c:781 posix/getopt.c:784
+#: posix/getopt.c:780 posix/getopt.c:783
#, c-format
msgid "%s: unrecognized option '--%s'\n"
msgstr "%s: 未知的é¸é … `--%s'\n"
-#: posix/getopt.c:792 posix/getopt.c:795
+#: posix/getopt.c:791 posix/getopt.c:794
#, c-format
msgid "%s: unrecognized option '%c%s'\n"
msgstr "%s: 未知的é¸é … `%c%s'\n"
-#: posix/getopt.c:844 posix/getopt.c:847
+#: posix/getopt.c:843 posix/getopt.c:846
#, c-format
msgid "%s: invalid option -- '%c'\n"
msgstr "%s: ä¸é©ç”¨çš„é¸é … -- %c\n"
-#: posix/getopt.c:900 posix/getopt.c:917 posix/getopt.c:1127
-#: posix/getopt.c:1145
+#: posix/getopt.c:899 posix/getopt.c:916 posix/getopt.c:1126
+#: posix/getopt.c:1144
#, c-format
msgid "%s: option requires an argument -- '%c'\n"
msgstr "%s: é¸é …需è¦ä¸€å€‹å¼•æ•¸ -- %c\n"
-#: posix/getopt.c:973 posix/getopt.c:989
+#: posix/getopt.c:972 posix/getopt.c:988
#, c-format
msgid "%s: option '-W %s' is ambiguous\n"
msgstr "%s: é¸é … `-W %s' å«ç¾©ä¸æ¸…\n"
-#: posix/getopt.c:1013 posix/getopt.c:1031
+#: posix/getopt.c:1012 posix/getopt.c:1030
#, c-format
msgid "%s: option '-W %s' doesn't allow an argument\n"
msgstr "%s: é¸é … `-W %s' ä¸å…許附加引數\n"
-#: posix/getopt.c:1052 posix/getopt.c:1070
+#: posix/getopt.c:1051 posix/getopt.c:1069
#, c-format
msgid "%s: option '-W %s' requires an argument\n"
msgstr "%s:é¸é …『-W %sã€éœ€è¦ä¸€å€‹å¼•æ•¸\n"
-#: posix/regcomp.c:134
+#: posix/regcomp.c:136
msgid "No match"
msgstr "沒有符åˆçš„é …ç›®"
-#: posix/regcomp.c:137
+#: posix/regcomp.c:139
msgid "Invalid regular expression"
msgstr "ä¸é©ç”¨çš„常è¦è¡¨ç¤ºå¼"
-#: posix/regcomp.c:140
+#: posix/regcomp.c:142
msgid "Invalid collation character"
msgstr "ä¸é©ç”¨çš„å°ç…§å­—å…ƒ"
-#: posix/regcomp.c:143
+#: posix/regcomp.c:145
msgid "Invalid character class name"
msgstr "ä¸é©ç”¨çš„字元類別å"
-#: posix/regcomp.c:146
+#: posix/regcomp.c:148
msgid "Trailing backslash"
msgstr "尾端的å斜線"
-#: posix/regcomp.c:149
+#: posix/regcomp.c:151
msgid "Invalid back reference"
msgstr "ä¸é©ç”¨çš„後部索引"
-#: posix/regcomp.c:152
+#: posix/regcomp.c:154
msgid "Unmatched [ or [^"
msgstr "[ 或 [^ ä¸èƒ½åŒ¹é…"
-#: posix/regcomp.c:155
+#: posix/regcomp.c:157
msgid "Unmatched ( or \\("
msgstr "( 或 \\( ä¸èƒ½åŒ¹é…"
-#: posix/regcomp.c:158
+#: posix/regcomp.c:160
msgid "Unmatched \\{"
msgstr "\\{ ä¸èƒ½åŒ¹é…"
-#: posix/regcomp.c:161
+#: posix/regcomp.c:163
msgid "Invalid content of \\{\\}"
msgstr "ä¸é©ç”¨çš„ \\{\\} 內容"
-#: posix/regcomp.c:164
+#: posix/regcomp.c:166
msgid "Invalid range end"
msgstr "ä¸é©ç”¨çš„範åœçµæŸ"
-#: posix/regcomp.c:167
+#: posix/regcomp.c:169
msgid "Memory exhausted"
msgstr "記憶體用完了"
-#: posix/regcomp.c:170
+#: posix/regcomp.c:172
msgid "Invalid preceding regular expression"
msgstr "ä¸é©ç”¨çš„å‰ç½®å¸¸è¦è¡¨ç¤ºå¼"
-#: posix/regcomp.c:173
+#: posix/regcomp.c:175
msgid "Premature end of regular expression"
msgstr "常è¦è¡¨ç¤ºå¼å¤ªæ—©çµæŸäº†"
-#: posix/regcomp.c:176
+#: posix/regcomp.c:178
msgid "Regular expression too big"
msgstr "æ­£è¦è¡¨ç¤ºå¼å¤ªé•·äº†"
-#: posix/regcomp.c:179
+#: posix/regcomp.c:181
msgid "Unmatched ) or \\)"
msgstr ") 或 \\) ä¸èƒ½åŒ¹é…"
-#: posix/regcomp.c:679
+#: posix/regcomp.c:681
msgid "No previous regular expression"
msgstr "å…ˆå‰ä¸¦æœªä½¿ç”¨éŽå¸¸è¦è¡¨ç¤ºå¼"
-#: posix/wordexp.c:1830
+#: posix/wordexp.c:1840
msgid "parameter null or not set"
msgstr "åƒæ•¸ç‚ºç©ºå­—元或是未設置"
@@ -4799,27 +4832,27 @@ msgstr "內部解讀錯誤"
msgid "Unknown resolver error"
msgstr "未知的解讀錯誤"
-#: resolv/res_hconf.c:122
+#: resolv/res_hconf.c:121
#, c-format
msgid "%s: line %d: cannot specify more than %d trim domains"
msgstr "%s: 第 %d 列: ç„¡æ³•æŒ‡å®šè¶…éŽ %d 個修剪範åœ"
-#: resolv/res_hconf.c:143
+#: resolv/res_hconf.c:142
#, c-format
msgid "%s: line %d: list delimiter not followed by domain"
msgstr "%s: 第 %d 列: 範åœä¸å¯è·Ÿåœ¨è¡¨åˆ—分隔字元之後"
-#: resolv/res_hconf.c:202
+#: resolv/res_hconf.c:201
#, c-format
msgid "%s: line %d: expected `on' or `off', found `%s'\n"
msgstr "%s: 第 %d 列: é æœŸç‚º `on' 或 `off',å»ç™¼ç¾ `%s'\n"
-#: resolv/res_hconf.c:245
+#: resolv/res_hconf.c:244
#, c-format
msgid "%s: line %d: bad command `%s'\n"
msgstr "%s: 第 %d 列: ä¸ç•¶çš„命令 `%s'\n"
-#: resolv/res_hconf.c:280
+#: resolv/res_hconf.c:279
#, c-format
msgid "%s: line %d: ignoring trailing garbage `%s'\n"
msgstr "%s: 第 %d 列: 正在忽略尾端的無用資料 `%s'\n"
@@ -5014,7 +5047,7 @@ msgstr "%s%s未知的信號 %d\n"
msgid "Unknown signal"
msgstr "ä¸æ˜Žçš„信號"
-#: string/_strerror.c:46 sysdeps/mach/_strerror.c:86
+#: string/_strerror.c:45 sysdeps/mach/_strerror.c:86
msgid "Unknown error "
msgstr "未知的錯誤 "
@@ -5032,11 +5065,11 @@ msgstr "å³æ™‚的信號 %d"
msgid "Unknown signal %d"
msgstr "未知的信號 %d"
-#: sunrpc/auth_unix.c:111 sunrpc/clnt_tcp.c:123 sunrpc/clnt_udp.c:134
+#: sunrpc/auth_unix.c:111 sunrpc/clnt_tcp.c:123 sunrpc/clnt_udp.c:135
#: sunrpc/clnt_unix.c:124 sunrpc/svc_tcp.c:188 sunrpc/svc_tcp.c:233
#: sunrpc/svc_udp.c:162 sunrpc/svc_unix.c:188 sunrpc/svc_unix.c:229
-#: sunrpc/xdr.c:630 sunrpc/xdr.c:790 sunrpc/xdr_array.c:97
-#: sunrpc/xdr_rec.c:151 sunrpc/xdr_ref.c:76
+#: sunrpc/xdr.c:631 sunrpc/xdr.c:791 sunrpc/xdr_array.c:97
+#: sunrpc/xdr_rec.c:152 sunrpc/xdr_ref.c:76
msgid "out of memory\n"
msgstr "記憶體ä¸è¶³\n"
@@ -5199,239 +5232,239 @@ msgstr "Broadcast 調查有å•é¡Œ"
msgid "Cannot receive reply to broadcast"
msgstr "無法接å—廣播後的回應"
-#: sunrpc/rpc_main.c:277
+#: sunrpc/rpc_main.c:281
#, c-format
msgid "%s: output would overwrite %s\n"
msgstr "%s: 輸出將會覆蓋 %s\n"
-#: sunrpc/rpc_main.c:284
+#: sunrpc/rpc_main.c:288
#, c-format
msgid "%s: unable to open %s: %m\n"
msgstr "%s: 無法開啟 %s: %m\n"
-#: sunrpc/rpc_main.c:296
+#: sunrpc/rpc_main.c:300
#, c-format
msgid "%s: while writing output %s: %m"
msgstr "%s: 當在寫出輸出 %s 時: %m"
-#: sunrpc/rpc_main.c:332 sunrpc/rpc_main.c:371
+#: sunrpc/rpc_main.c:336 sunrpc/rpc_main.c:375
#, c-format
msgid "cannot find C preprocessor: %s\n"
msgstr "找ä¸åˆ° C å‰ç½®è™•ç†å™¨ï¼š%s\n"
-#: sunrpc/rpc_main.c:407
+#: sunrpc/rpc_main.c:411
#, c-format
msgid "%s: C preprocessor failed with signal %d\n"
msgstr "%s: C å‰ç½®è™•ç†å™¨å¤±æ•ˆï¼Œå…¶è¨Šè™Ÿå€¼ç‚º %d\n"
-#: sunrpc/rpc_main.c:410
+#: sunrpc/rpc_main.c:414
#, c-format
msgid "%s: C preprocessor failed with exit code %d\n"
msgstr "%s: C å‰ç½®è™•ç†å™¨å¤±æ•ˆï¼Œå…¶çµæŸç¢¼ç‚º %d\n"
-#: sunrpc/rpc_main.c:450
+#: sunrpc/rpc_main.c:454
#, c-format
msgid "illegal nettype: `%s'\n"
msgstr "ä¸åˆæ³•çš„ nettype:「%sã€\n"
-#: sunrpc/rpc_main.c:1085
+#: sunrpc/rpc_main.c:1089
#, c-format
msgid "rpcgen: too many defines\n"
msgstr "rpcgen: 太多 define 了\n"
-#: sunrpc/rpc_main.c:1097
+#: sunrpc/rpc_main.c:1101
#, c-format
msgid "rpcgen: arglist coding error\n"
msgstr "rpcgen: arglist 編碼錯誤\n"
#. TRANS: the file will not be removed; this is an
#. TRANS: informative message.
-#: sunrpc/rpc_main.c:1130
+#: sunrpc/rpc_main.c:1134
#, c-format
msgid "file `%s' already exists and may be overwritten\n"
msgstr "檔案 `%s' 已經存在並有å¯èƒ½æœƒè¢«è¦†è“‹æŽ‰\n"
-#: sunrpc/rpc_main.c:1175
+#: sunrpc/rpc_main.c:1179
#, c-format
msgid "Cannot specify more than one input file!\n"
msgstr "無法指定超éŽä¸€å€‹è¼¸å…¥æª”!\n"
-#: sunrpc/rpc_main.c:1345
+#: sunrpc/rpc_main.c:1349
#, c-format
msgid "This implementation doesn't support newstyle or MT-safe code!\n"
msgstr "此實作方å¼ä¸æ”¯æ´æ–°çš„å½¢å¼æˆ–多安全執行åºçš„程å¼!\n"
-#: sunrpc/rpc_main.c:1354
+#: sunrpc/rpc_main.c:1358
#, c-format
msgid "Cannot use netid flag with inetd flag!\n"
msgstr "無法將 netid 旗標與 inetd 旗標一起使用!\n"
-#: sunrpc/rpc_main.c:1363
+#: sunrpc/rpc_main.c:1367
#, c-format
msgid "Cannot use netid flag without TIRPC!\n"
msgstr "無法在沒有 TIRPC 時使用 netid 旗標!\n"
-#: sunrpc/rpc_main.c:1370
+#: sunrpc/rpc_main.c:1374
#, c-format
msgid "Cannot use table flags with newstyle!\n"
msgstr "無法將表格旗標與 newstyle 一起使用!\n"
-#: sunrpc/rpc_main.c:1389
+#: sunrpc/rpc_main.c:1393
#, c-format
msgid "\"infile\" is required for template generation flags.\n"
msgstr "\"infile\" 是樣版產生旗標所需的\n"
-#: sunrpc/rpc_main.c:1394
+#: sunrpc/rpc_main.c:1398
#, c-format
msgid "Cannot have more than one file generation flag!\n"
msgstr "無法使用超éŽä¸€å€‹çš„檔案產生旗標!\n"
-#: sunrpc/rpc_main.c:1403
+#: sunrpc/rpc_main.c:1407
#, c-format
msgid "usage: %s infile\n"
msgstr "用法: %s infile\n"
-#: sunrpc/rpc_main.c:1404
+#: sunrpc/rpc_main.c:1408
#, c-format
msgid "\t%s [-abkCLNTM][-Dname[=value]] [-i size] [-I [-K seconds]] [-Y path] infile\n"
msgstr "\t%s [-abkCLNTM][-Då稱[=值]] [-i 大å°] [-I [-K 秒數]] [-Y 路徑] 輸入檔案\n"
-#: sunrpc/rpc_main.c:1406
+#: sunrpc/rpc_main.c:1410
#, c-format
msgid "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] [-o outfile] [infile]\n"
msgstr "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] [-o 輸出檔案] [輸入檔案]\n"
-#: sunrpc/rpc_main.c:1408
+#: sunrpc/rpc_main.c:1412
#, c-format
msgid "\t%s [-s nettype]* [-o outfile] [infile]\n"
msgstr "\t%s [-s 網路型態]* [-o 輸出檔案] [輸入檔案]\n"
-#: sunrpc/rpc_main.c:1409
+#: sunrpc/rpc_main.c:1413
#, c-format
msgid "\t%s [-n netid]* [-o outfile] [infile]\n"
msgstr "\t%s [-n 網路識別符號]* [-o 輸出檔案] [輸入檔案]\n"
-#: sunrpc/rpc_main.c:1417
+#: sunrpc/rpc_main.c:1421
#, c-format
msgid "options:\n"
msgstr "é¸é …:\n"
-#: sunrpc/rpc_main.c:1418
+#: sunrpc/rpc_main.c:1422
#, c-format
msgid "-a\t\tgenerate all files, including samples\n"
msgstr "-a\t\t產生所有檔案,包å«æ¨£æœ¬\n"
-#: sunrpc/rpc_main.c:1419
+#: sunrpc/rpc_main.c:1423
#, c-format
msgid "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n"
msgstr "-b\t\tå›žæº¯ç›¸å®¹æ¨¡å¼ (產生用於 SunOS 4.1 的編碼)\n"
-#: sunrpc/rpc_main.c:1420
+#: sunrpc/rpc_main.c:1424
#, c-format
msgid "-c\t\tgenerate XDR routines\n"
msgstr "-c\t\t產生 XDR 常å¼\n"
-#: sunrpc/rpc_main.c:1421
+#: sunrpc/rpc_main.c:1425
#, c-format
msgid "-C\t\tANSI C mode\n"
msgstr "-C\t\tANSI C 模å¼\n"
-#: sunrpc/rpc_main.c:1422
+#: sunrpc/rpc_main.c:1426
#, c-format
msgid "-Dname[=value]\tdefine a symbol (same as #define)\n"
msgstr "-Då稱[=值]\t定義一個符號 (å¦‚åŒ #define)\n"
-#: sunrpc/rpc_main.c:1423
+#: sunrpc/rpc_main.c:1427
#, c-format
msgid "-h\t\tgenerate header file\n"
msgstr "-h\t\t產生標頭檔\n"
-#: sunrpc/rpc_main.c:1424
+#: sunrpc/rpc_main.c:1428
#, c-format
msgid "-i size\t\tsize at which to start generating inline code\n"
msgstr "-i 大å°\t\t啟始產生內è¯ç·¨ç¢¼çš„大å°\n"
-#: sunrpc/rpc_main.c:1425
+#: sunrpc/rpc_main.c:1429
#, c-format
msgid "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n"
msgstr "-I\t\t產生在伺æœå™¨ä¸­æ”¯æ´çš„ inetd 編碼 (用於 SunOS 4.1)\n"
-#: sunrpc/rpc_main.c:1426
+#: sunrpc/rpc_main.c:1430
#, c-format
msgid "-K seconds\tserver exits after K seconds of inactivity\n"
msgstr "-K 秒\tä¸ä½œç”¨ K 秒之後離開伺æœå™¨\n"
-#: sunrpc/rpc_main.c:1427
+#: sunrpc/rpc_main.c:1431
#, c-format
msgid "-l\t\tgenerate client side stubs\n"
msgstr "-l\t\t產生客戶端殘餘\n"
-#: sunrpc/rpc_main.c:1428
+#: sunrpc/rpc_main.c:1432
#, c-format
msgid "-L\t\tserver errors will be printed to syslog\n"
msgstr "-L\t\t伺æœå™¨éŒ¯èª¤å°‡è¢«åˆ—å°åˆ° syslog\n"
-#: sunrpc/rpc_main.c:1429
+#: sunrpc/rpc_main.c:1433
#, c-format
msgid "-m\t\tgenerate server side stubs\n"
msgstr "-m\t\t產生伺æœå™¨ç«¯æ®˜é¤˜\n"
-#: sunrpc/rpc_main.c:1430
+#: sunrpc/rpc_main.c:1434
#, c-format
msgid "-M\t\tgenerate MT-safe code\n"
msgstr "-M\t\t產生 MT-safe 編碼\n"
-#: sunrpc/rpc_main.c:1431
+#: sunrpc/rpc_main.c:1435
#, c-format
msgid "-n netid\tgenerate server code that supports named netid\n"
msgstr "-n netid\t產生支æ´å…·å netid 的伺æœå™¨ç·¨ç¢¼\n"
-#: sunrpc/rpc_main.c:1432
+#: sunrpc/rpc_main.c:1436
#, c-format
msgid "-N\t\tsupports multiple arguments and call-by-value\n"
msgstr "-N\t\t支æ´å¤šé‡å¼•æ•¸å’Œå‚³å€¼å‘¼å«\n"
-#: sunrpc/rpc_main.c:1433
+#: sunrpc/rpc_main.c:1437
#, c-format
msgid "-o outfile\tname of the output file\n"
msgstr "-o 輸出檔\t輸出檔案的å稱\n"
-#: sunrpc/rpc_main.c:1434
+#: sunrpc/rpc_main.c:1438
#, c-format
msgid "-s nettype\tgenerate server code that supports named nettype\n"
msgstr "-s nettype\t產生支æ´å…·å nettype 的伺æœå™¨ç·¨ç¢¼\n"
-#: sunrpc/rpc_main.c:1435
+#: sunrpc/rpc_main.c:1439
#, c-format
msgid "-Sc\t\tgenerate sample client code that uses remote procedures\n"
msgstr "-Sc\t\t產生使用é ç«¯ç¨‹åºçš„範例客戶端編碼\n"
-#: sunrpc/rpc_main.c:1436
+#: sunrpc/rpc_main.c:1440
#, c-format
msgid "-Ss\t\tgenerate sample server code that defines remote procedures\n"
msgstr "-Ss\t\t產生定義é ç«¯ç¨‹åºçš„範例伺æœå™¨ç·¨ç¢¼\n"
-#: sunrpc/rpc_main.c:1437
+#: sunrpc/rpc_main.c:1441
#, c-format
msgid "-Sm \t\tgenerate makefile template \n"
msgstr "-Sm\t\t產生 makefile 模æ¿\n"
-#: sunrpc/rpc_main.c:1438
+#: sunrpc/rpc_main.c:1442
#, c-format
msgid "-t\t\tgenerate RPC dispatch table\n"
msgstr "-t\t\t產生 RPC æ´¾é€è¡¨\n"
-#: sunrpc/rpc_main.c:1439
+#: sunrpc/rpc_main.c:1443
#, c-format
msgid "-T\t\tgenerate code to support RPC dispatch tables\n"
msgstr "-T\t\tç”¢ç”Ÿæ”¯æ´ RPC æ´¾é€è¡¨çš„編碼\n"
-#: sunrpc/rpc_main.c:1440
+#: sunrpc/rpc_main.c:1444
#, c-format
msgid "-Y path\t\tdirectory name to find C preprocessor (cpp)\n"
msgstr "-Y 路徑\t\tè¦å°‹æ‰¾ C å‰ç½®è™•ç†å™¨ (cpp) 的目錄å稱\n"
-#: sunrpc/rpc_main.c:1442
+#: sunrpc/rpc_main.c:1446
#, c-format
msgid ""
"\n"
@@ -6229,46 +6262,47 @@ msgstr "太多使用者"
#. TRANS The user's disk quota was exceeded.
#: sysdeps/gnu/errlist.c:775
msgid "Disk quota exceeded"
-msgstr "硬碟 quota 滿了"
+msgstr "ç£ç¢Ÿé…é¡å·²æ»¿"
-#. TRANS Stale NFS file handle. This indicates an internal confusion in the NFS
-#. TRANS system which is due to file system rearrangements on the server host.
-#. TRANS Repairing this condition usually requires unmounting and remounting
-#. TRANS the NFS file system on the local host.
-#: sysdeps/gnu/errlist.c:787
-msgid "Stale NFS file handle"
-msgstr "éŽèˆŠçš„ NFS 檔案控制碼"
+#. TRANS Stale file handle. This indicates an internal confusion in the
+#. TRANS file system which is due to file system rearrangements on the server host
+#. TRANS for NFS file systems or corruption in other file systems.
+#. TRANS Repairing this condition usually requires unmounting, possibly repairing
+#. TRANS and remounting the file system.
+#: sysdeps/gnu/errlist.c:788
+msgid "Stale file handle"
+msgstr "éŽèˆŠçš„檔案控柄"
#. TRANS An attempt was made to NFS-mount a remote file system with a file name that
#. TRANS already specifies an NFS-mounted file.
#. TRANS (This is an error on some operating systems, but we expect it to work
#. TRANS properly on @gnuhurdsystems{}, making this error code impossible.)
-#: sysdeps/gnu/errlist.c:799
+#: sysdeps/gnu/errlist.c:800
msgid "Object is remote"
msgstr "目標檔案ä½æ–¼é ç«¯"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:808
+#: sysdeps/gnu/errlist.c:809
msgid "RPC struct is bad"
msgstr "RPC çµæ§‹æ˜¯å£žçš„"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:817
+#: sysdeps/gnu/errlist.c:818
msgid "RPC version wrong"
msgstr "RPC 版本錯誤"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:826
+#: sysdeps/gnu/errlist.c:827
msgid "RPC program not available"
msgstr "RPC 程å¼ä¸å­˜åœ¨"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:835
+#: sysdeps/gnu/errlist.c:836
msgid "RPC program version wrong"
msgstr "RPC 程å¼ç‰ˆæœ¬éŒ¯èª¤"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:844
+#: sysdeps/gnu/errlist.c:845
msgid "RPC bad procedure for program"
msgstr "程å¼çš„ RPC 程åºéŒ¯èª¤"
@@ -6276,7 +6310,7 @@ msgstr "程å¼çš„ RPC 程åºéŒ¯èª¤"
#. TRANS @ref{File Locks}. This error is never generated by @gnuhurdsystems{}, but
#. TRANS it can result from an operation to an NFS server running another
#. TRANS operating system.
-#: sysdeps/gnu/errlist.c:856
+#: sysdeps/gnu/errlist.c:857
msgid "No locks available"
msgstr "無法鎖定資料"
@@ -6285,17 +6319,17 @@ msgstr "無法鎖定資料"
#. TRANS
#. TRANS On some systems @code{chmod} returns this error if you try to set the
#. TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}.
-#: sysdeps/gnu/errlist.c:869
+#: sysdeps/gnu/errlist.c:870
msgid "Inappropriate file type or format"
msgstr "ä¸å¸Œæœ›çš„檔案型態或格å¼"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:878
+#: sysdeps/gnu/errlist.c:879
msgid "Authentication error"
msgstr "鑑定錯誤"
#. TRANS ???
-#: sysdeps/gnu/errlist.c:887
+#: sysdeps/gnu/errlist.c:888
msgid "Need authenticator"
msgstr "需è¦èªè­‰"
@@ -6304,7 +6338,7 @@ msgstr "需è¦èªè­‰"
#. TRANS operating system. When you get this error, you can be sure that this
#. TRANS particular function will always fail with @code{ENOSYS} unless you
#. TRANS install a new version of the C library or the operating system.
-#: sysdeps/gnu/errlist.c:900
+#: sysdeps/gnu/errlist.c:901
msgid "Function not implemented"
msgstr "功能沒有實作"
@@ -6320,13 +6354,13 @@ msgstr "功能沒有實作"
#. TRANS
#. TRANS If the entire function is not available at all in the implementation,
#. TRANS it returns @code{ENOSYS} instead.
-#: sysdeps/gnu/errlist.c:920
+#: sysdeps/gnu/errlist.c:921
msgid "Not supported"
msgstr "並未支æ´"
#. TRANS While decoding a multibyte character the function came along an invalid
#. TRANS or an incomplete sequence of bytes or the given wide character is invalid.
-#: sysdeps/gnu/errlist.c:930
+#: sysdeps/gnu/errlist.c:931
msgid "Invalid or incomplete multibyte or wide character"
msgstr "ä¸é©ç”¨æˆ–ä¸å®Œæ•´çš„多ä½å…ƒçµ„字元或寬字元"
@@ -6336,26 +6370,26 @@ msgstr "ä¸é©ç”¨æˆ–ä¸å®Œæ•´çš„多ä½å…ƒçµ„字元或寬字元"
#. TRANS error because functions such as @code{read} and @code{write} translate
#. TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal. @xref{Job Control},
#. TRANS for information on process groups and these signals.
-#: sysdeps/gnu/errlist.c:944
+#: sysdeps/gnu/errlist.c:945
msgid "Inappropriate operation for background process"
msgstr "ä¸å¸Œæœ›çš„背景行程é‹ä½œ"
#. TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is
#. TRANS translated by a program and the translator program dies while starting
#. TRANS up, before it has connected to the file.
-#: sysdeps/gnu/errlist.c:955
+#: sysdeps/gnu/errlist.c:956
msgid "Translator died"
msgstr "中介程å¼å·²ç¶“çµæŸ"
#. TRANS The experienced user will know what is wrong.
#. TRANS @c This error code is a joke. Its perror text is part of the joke.
#. TRANS @c Don't change it.
-#: sysdeps/gnu/errlist.c:966
+#: sysdeps/gnu/errlist.c:967
msgid "?"
msgstr "?"
#. TRANS You did @strong{what}?
-#: sysdeps/gnu/errlist.c:975
+#: sysdeps/gnu/errlist.c:976
msgid "You really blew it this time"
msgstr "這次真的被您打敗了"
@@ -6392,56 +6426,56 @@ msgstr "這次真的被您打敗了"
# 簡單的說,兒歌 "å”è€å…ˆç”Ÿæœ‰å¡Šåœ°...",然後呢?? ;-p
#
#. TRANS Go home and have a glass of warm, dairy-fresh milk.
-#: sysdeps/gnu/errlist.c:984
+#: sysdeps/gnu/errlist.c:985
msgid "Computer bought the farm"
msgstr "這臺電腦買了一塊地囉"
#. TRANS This error code has no purpose.
-#: sysdeps/gnu/errlist.c:993
+#: sysdeps/gnu/errlist.c:994
msgid "Gratuitous error"
msgstr "無故的錯誤"
-#: sysdeps/gnu/errlist.c:1001
+#: sysdeps/gnu/errlist.c:1002
msgid "Bad message"
msgstr "錯誤的訊æ¯"
-#: sysdeps/gnu/errlist.c:1009
+#: sysdeps/gnu/errlist.c:1010
msgid "Identifier removed"
msgstr "識別符號移除"
-#: sysdeps/gnu/errlist.c:1017
+#: sysdeps/gnu/errlist.c:1018
msgid "Multihop attempted"
msgstr "嘗試 Multihop"
-#: sysdeps/gnu/errlist.c:1025
+#: sysdeps/gnu/errlist.c:1026
msgid "No data available"
msgstr "沒有å¯ç”¨çš„資料"
-#: sysdeps/gnu/errlist.c:1033
+#: sysdeps/gnu/errlist.c:1034
msgid "Link has been severed"
msgstr "連çµå·²æœ‰æœå‹™"
-#: sysdeps/gnu/errlist.c:1041
+#: sysdeps/gnu/errlist.c:1042
msgid "No message of desired type"
msgstr "沒有符åˆéœ€æ±‚æ ¼å¼çš„訊æ¯"
-#: sysdeps/gnu/errlist.c:1049
+#: sysdeps/gnu/errlist.c:1050
msgid "Out of streams resources"
msgstr "所有資料æµçš„資æºéƒ½å·²ç”¨ç›¡"
-#: sysdeps/gnu/errlist.c:1057
+#: sysdeps/gnu/errlist.c:1058
msgid "Device not a stream"
msgstr "è£ç½®ä¸æ˜¯è³‡æ–™æµ"
-#: sysdeps/gnu/errlist.c:1065
+#: sysdeps/gnu/errlist.c:1066
msgid "Value too large for defined data type"
msgstr "有定義的資料型別值太大"
-#: sysdeps/gnu/errlist.c:1073
+#: sysdeps/gnu/errlist.c:1074
msgid "Protocol error"
msgstr "å”定錯誤"
-#: sysdeps/gnu/errlist.c:1081
+#: sysdeps/gnu/errlist.c:1082
msgid "Timer expired"
msgstr "計時器已逾時"
@@ -6449,195 +6483,195 @@ msgstr "計時器已逾時"
#. TRANS completed. @xref{Asynchronous I/O}. When you call @code{aio_cancel},
#. TRANS the normal result is for the operations affected to complete with this
#. TRANS error; @pxref{Cancel AIO Operations}.
-#: sysdeps/gnu/errlist.c:1093
+#: sysdeps/gnu/errlist.c:1094
msgid "Operation canceled"
msgstr "æ“作已被å–消"
-#: sysdeps/gnu/errlist.c:1101
+#: sysdeps/gnu/errlist.c:1102
msgid "Interrupted system call should be restarted"
msgstr "中斷的系統呼å«å¿…é ˆé‡æ–°å•Ÿå‹•"
-#: sysdeps/gnu/errlist.c:1109
+#: sysdeps/gnu/errlist.c:1110
msgid "Channel number out of range"
msgstr "通é“號碼超出範åœ"
-#: sysdeps/gnu/errlist.c:1117
+#: sysdeps/gnu/errlist.c:1118
msgid "Level 2 not synchronized"
msgstr "層級 2 沒有åŒæ­¥"
-#: sysdeps/gnu/errlist.c:1125
+#: sysdeps/gnu/errlist.c:1126
msgid "Level 3 halted"
msgstr "層級 3 åœæ­¢"
-#: sysdeps/gnu/errlist.c:1133
+#: sysdeps/gnu/errlist.c:1134
msgid "Level 3 reset"
msgstr "層級 3 é‡è¨­"
-#: sysdeps/gnu/errlist.c:1141
+#: sysdeps/gnu/errlist.c:1142
msgid "Link number out of range"
msgstr "連çµæ•¸ç›®è¶…éŽç¯„åœ"
-#: sysdeps/gnu/errlist.c:1149
+#: sysdeps/gnu/errlist.c:1150
msgid "Protocol driver not attached"
msgstr "å”定的驅動程å¼æœªé€£æŽ¥"
-#: sysdeps/gnu/errlist.c:1157
+#: sysdeps/gnu/errlist.c:1158
msgid "No CSI structure available"
msgstr "沒有å¯ç”¨çš„ CSI çµæ§‹äº†"
-#: sysdeps/gnu/errlist.c:1165
+#: sysdeps/gnu/errlist.c:1166
msgid "Level 2 halted"
msgstr "層級 2 åœæ­¢"
-#: sysdeps/gnu/errlist.c:1173
+#: sysdeps/gnu/errlist.c:1174
msgid "Invalid exchange"
msgstr "ä¸é©ç”¨çš„交æ›"
-#: sysdeps/gnu/errlist.c:1181
+#: sysdeps/gnu/errlist.c:1182
msgid "Invalid request descriptor"
msgstr "ä¸é©ç”¨çš„請求敘述項"
-#: sysdeps/gnu/errlist.c:1189
+#: sysdeps/gnu/errlist.c:1190
msgid "Exchange full"
msgstr "交æ›å·²æ»¿"
-#: sysdeps/gnu/errlist.c:1197
+#: sysdeps/gnu/errlist.c:1198
msgid "No anode"
msgstr "沒有 anode"
-#: sysdeps/gnu/errlist.c:1205
+#: sysdeps/gnu/errlist.c:1206
msgid "Invalid request code"
msgstr "ä¸é©ç”¨çš„請求碼"
-#: sysdeps/gnu/errlist.c:1213
+#: sysdeps/gnu/errlist.c:1214
msgid "Invalid slot"
msgstr "ä¸é©ç”¨çš„ slot"
-#: sysdeps/gnu/errlist.c:1221
+#: sysdeps/gnu/errlist.c:1222
msgid "File locking deadlock error"
msgstr "檔案鎖定åœé “錯誤"
-#: sysdeps/gnu/errlist.c:1229
+#: sysdeps/gnu/errlist.c:1230
msgid "Bad font file format"
msgstr "錯誤的字型檔格å¼"
-#: sysdeps/gnu/errlist.c:1237
+#: sysdeps/gnu/errlist.c:1238
msgid "Machine is not on the network"
msgstr "機器ä¸åœ¨ç¶²è·¯ä¸­"
-#: sysdeps/gnu/errlist.c:1245
+#: sysdeps/gnu/errlist.c:1246
msgid "Package not installed"
msgstr "套件並未安è£"
-#: sysdeps/gnu/errlist.c:1253
+#: sysdeps/gnu/errlist.c:1254
msgid "Advertise error"
msgstr "通知錯誤"
-#: sysdeps/gnu/errlist.c:1261
+#: sysdeps/gnu/errlist.c:1262
msgid "Srmount error"
msgstr "Srmount 錯誤"
-#: sysdeps/gnu/errlist.c:1269
+#: sysdeps/gnu/errlist.c:1270
msgid "Communication error on send"
msgstr "在傳é€æ™‚通訊錯誤"
-#: sysdeps/gnu/errlist.c:1277
+#: sysdeps/gnu/errlist.c:1278
msgid "RFS specific error"
msgstr "RFS 特定錯誤"
-#: sysdeps/gnu/errlist.c:1285
+#: sysdeps/gnu/errlist.c:1286
msgid "Name not unique on network"
msgstr "網路上的å稱ä¸æ˜¯å”¯ä¸€çš„"
-#: sysdeps/gnu/errlist.c:1293
+#: sysdeps/gnu/errlist.c:1294
msgid "File descriptor in bad state"
msgstr "檔案敘述項處於錯誤狀態"
-#: sysdeps/gnu/errlist.c:1301
+#: sysdeps/gnu/errlist.c:1302
msgid "Remote address changed"
msgstr "é ç«¯ä½å€æ”¹è®Šäº†"
-#: sysdeps/gnu/errlist.c:1309
+#: sysdeps/gnu/errlist.c:1310
msgid "Can not access a needed shared library"
msgstr "無法存å–所需的分享函å¼åº«"
-#: sysdeps/gnu/errlist.c:1317
+#: sysdeps/gnu/errlist.c:1318
msgid "Accessing a corrupted shared library"
msgstr "å­˜å–一個毀掉的分享函å¼åº«"
-#: sysdeps/gnu/errlist.c:1325
+#: sysdeps/gnu/errlist.c:1326
msgid ".lib section in a.out corrupted"
msgstr "a.out 中 .lib å€æ®µæ¯€æŽ‰äº†"
-#: sysdeps/gnu/errlist.c:1333
+#: sysdeps/gnu/errlist.c:1334
msgid "Attempting to link in too many shared libraries"
msgstr "嘗試去連çµå¤ªå¤šçš„分享資料庫"
-#: sysdeps/gnu/errlist.c:1341
+#: sysdeps/gnu/errlist.c:1342
msgid "Cannot exec a shared library directly"
msgstr "ä¸èƒ½ç›´æŽ¥åŸ·è¡Œä¸€å€‹åˆ†äº«å‡½å¼åº«"
-#: sysdeps/gnu/errlist.c:1349
+#: sysdeps/gnu/errlist.c:1350
msgid "Streams pipe error"
msgstr "資料æµç®¡ç·šéŒ¯èª¤"
-#: sysdeps/gnu/errlist.c:1357
+#: sysdeps/gnu/errlist.c:1358
msgid "Structure needs cleaning"
msgstr "çµæ§‹éœ€è¦æ¸…ç†"
-#: sysdeps/gnu/errlist.c:1365
+#: sysdeps/gnu/errlist.c:1366
msgid "Not a XENIX named type file"
msgstr "ä¸¦éž XENIX 命åæ ¼å¼çš„檔案"
-#: sysdeps/gnu/errlist.c:1373
+#: sysdeps/gnu/errlist.c:1374
msgid "No XENIX semaphores available"
msgstr "沒有å¯ç”¨çš„ XENIX 信號標誌了"
-#: sysdeps/gnu/errlist.c:1381
+#: sysdeps/gnu/errlist.c:1382
msgid "Is a named type file"
msgstr "是個具å的型態檔案"
-#: sysdeps/gnu/errlist.c:1389
+#: sysdeps/gnu/errlist.c:1390
msgid "Remote I/O error"
msgstr "é ç«¯è¼¸å‡ºå…¥éŒ¯èª¤"
-#: sysdeps/gnu/errlist.c:1397
+#: sysdeps/gnu/errlist.c:1398
msgid "No medium found"
msgstr "找ä¸åˆ°åª’é«”"
-#: sysdeps/gnu/errlist.c:1405
+#: sysdeps/gnu/errlist.c:1406
msgid "Wrong medium type"
msgstr "錯誤的媒體型態"
-#: sysdeps/gnu/errlist.c:1413
+#: sysdeps/gnu/errlist.c:1414
msgid "Required key not available"
msgstr "å¿…è¦éµå€¼ç„¡æ³•ä½¿ç”¨"
-#: sysdeps/gnu/errlist.c:1421
+#: sysdeps/gnu/errlist.c:1422
msgid "Key has expired"
msgstr "éµå€¼å·²éŽæœŸ"
-#: sysdeps/gnu/errlist.c:1429
+#: sysdeps/gnu/errlist.c:1430
msgid "Key has been revoked"
msgstr "éµå€¼å·²å–消"
-#: sysdeps/gnu/errlist.c:1437
+#: sysdeps/gnu/errlist.c:1438
msgid "Key was rejected by service"
msgstr "éµå€¼è¢«æœå‹™æ‰€æ‹’絕"
-#: sysdeps/gnu/errlist.c:1445
+#: sysdeps/gnu/errlist.c:1446
msgid "Owner died"
msgstr "æ“有者已消é€"
-#: sysdeps/gnu/errlist.c:1453
+#: sysdeps/gnu/errlist.c:1454
msgid "State not recoverable"
msgstr "狀態無法回復"
-#: sysdeps/gnu/errlist.c:1461
+#: sysdeps/gnu/errlist.c:1462
msgid "Operation not possible due to RF-kill"
msgstr "由於 RF-kill 而無法æ“作"
-#: sysdeps/gnu/errlist.c:1469
+#: sysdeps/gnu/errlist.c:1470
msgid "Memory page has hardware error"
msgstr "記憶體分é æœ‰ç¡¬é«”錯誤"
@@ -6765,7 +6799,7 @@ msgid ""
"\n"
"Report bugs to %s.\n"
msgstr ""
-"%s:用法為 %s [--version] [--help] [-v] [-c [loyear,]hiyear ] zonename ...\n"
+"%s:用法為 %s [--version] [--help] [-v] [-c [低年分,]高年分 ] å€åŸŸå稱 ...\n"
"\n"
"將錯誤通報給 %s。\n"
@@ -6810,8 +6844,8 @@ msgid ""
"\n"
"Report bugs to %s.\n"
msgstr ""
-"%s:用法為 %s [ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n"
-"\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"
+"%s:用法為 %s [ --version ] [ --help ] [ -v ] [ -l 本地時間 ] [ -p POSIXè¦å‰‡ ] \\\n"
+"\t[ -d 目錄 ] [ -L è·³èºç§’數 ] [ -y 年分類型 ] [ 檔å ... ]\n"
"\n"
"將錯誤通報給 %s。\n"
@@ -6911,7 +6945,7 @@ msgstr "%s: 關閉錯誤 %s: %s\n"
msgid "expected continuation line not found"
msgstr "找ä¸åˆ°é æœŸçš„接續列"
-#: timezone/zic.c:887 timezone/zic.c:2411 timezone/zic.c:2425
+#: timezone/zic.c:887 timezone/zic.c:2413 timezone/zic.c:2427
msgid "time overflow"
msgstr "時間溢ä½"
@@ -7057,93 +7091,93 @@ msgstr "%s: 無法產生 %s: %s\n"
msgid "%s: Error writing %s\n"
msgstr "%s: 寫入錯誤 %s\n"
-#: timezone/zic.c:1964
+#: timezone/zic.c:1966
msgid "no POSIX environment variable for zone"
msgstr "ç„¡ POSIX 環境變數用於å€"
-#: timezone/zic.c:2131
+#: timezone/zic.c:2133
msgid "can't determine time zone abbreviation to use just after until time"
msgstr "無法決定在çµæŸæ™‚間以後該使用的時å€ç°¡å¯«"
-#: timezone/zic.c:2175
+#: timezone/zic.c:2177
msgid "too many transitions?!"
msgstr "太多時間轉æ›äº†?!"
-#: timezone/zic.c:2190
+#: timezone/zic.c:2192
msgid "internal error - addtype called with bad isdst"
msgstr "內部錯誤 - 用錯誤的 isdst å‘¼å« addtype 函å¼"
-#: timezone/zic.c:2194
+#: timezone/zic.c:2196
msgid "internal error - addtype called with bad ttisstd"
msgstr "內部錯誤 - 用錯誤的 ttisstd å‘¼å« addtype 函å¼"
-#: timezone/zic.c:2198
+#: timezone/zic.c:2200
msgid "internal error - addtype called with bad ttisgmt"
msgstr "內部錯誤 - 用錯誤的 ttisgmt å‘¼å« addtype 函å¼"
-#: timezone/zic.c:2217
+#: timezone/zic.c:2219
msgid "too many local time types"
msgstr "太多本地時間格å¼"
-#: timezone/zic.c:2221
+#: timezone/zic.c:2223
msgid "UTC offset out of range"
msgstr "UTC å移超出範åœ"
-#: timezone/zic.c:2245
+#: timezone/zic.c:2247
msgid "too many leap seconds"
msgstr "太多é–秒"
-#: timezone/zic.c:2251
+#: timezone/zic.c:2253
msgid "repeated leap second moment"
msgstr "é‡è¤‡çš„é–秒設定"
-#: timezone/zic.c:2301
+#: timezone/zic.c:2303
msgid "Wild result from command execution"
msgstr "命令執行導致奇怪的çµæžœ"
-#: timezone/zic.c:2302
+#: timezone/zic.c:2304
#, c-format
msgid "%s: command was '%s', result was %d\n"
msgstr "%s: 輸入命令為 '%s', çµæžœç‚º %d\n"
-#: timezone/zic.c:2393
+#: timezone/zic.c:2395
msgid "Odd number of quotation marks"
msgstr "引號數目為奇數"
-#: timezone/zic.c:2470
+#: timezone/zic.c:2472
msgid "use of 2/29 in non leap-year"
msgstr "在éžé–年時用到 2/29 æ—¥"
-#: timezone/zic.c:2505
+#: timezone/zic.c:2507
msgid "rule goes past start/end of month--will not work with pre-2004 versions of zic"
msgstr "è¦å‰‡è¶…éŽé–‹å§‹/çµæŸæœˆåˆ†--將無法é©ç”¨æ—©æ–¼ 2004 çš„ zic 版本"
-#: timezone/zic.c:2536
+#: timezone/zic.c:2538
msgid "time zone abbreviation lacks alphabetic at start"
msgstr "時å€ç¸®å¯«é–‹é ­ç¼ºå°‘å­—æ¯"
-#: timezone/zic.c:2538
+#: timezone/zic.c:2540
msgid "time zone abbreviation has fewer than 3 alphabetics"
msgstr "時間å€ç¸®å¯«å°‘æ–¼ 3 個字æ¯"
-#: timezone/zic.c:2540
+#: timezone/zic.c:2542
msgid "time zone abbreviation has too many alphabetics"
msgstr "時å€ç¸®å¯«å¤ªå¤šå­—æ¯"
-#: timezone/zic.c:2550
+#: timezone/zic.c:2552
msgid "time zone abbreviation differs from POSIX standard"
msgstr "時å€ç¸®å¯«èˆ‡ POSIX 標準ä¸åŒ"
-#: timezone/zic.c:2562
+#: timezone/zic.c:2564
msgid "too many, or too long, time zone abbreviations"
msgstr "時å€ç¸®å¯«å¤ªå¤šæˆ–者太長"
-#: timezone/zic.c:2602
+#: timezone/zic.c:2604
#, c-format
msgid "%s: Can't create directory %s: %s\n"
msgstr "%s: 無法建立目錄 %s: %s\n"
-#: timezone/zic.c:2623
+#: timezone/zic.c:2625
#, c-format
msgid "%s: %d did not sign extend correctly\n"
msgstr "%s: %d 無法正確地延展訊號\n"
diff --git a/libc/ports/ChangeLog b/libc/ports/ChangeLog
index 9b638017f..a1dd8c342 100644
--- a/libc/ports/ChangeLog
+++ b/libc/ports/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-04 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
+
2013-09-02 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/hppa/syscalls.list (fanotify_mark): New
diff --git a/libc/ports/ChangeLog.aarch64 b/libc/ports/ChangeLog.aarch64
index 537ae601e..cebf5055d 100644
--- a/libc/ports/ChangeLog.aarch64
+++ b/libc/ports/ChangeLog.aarch64
@@ -1,3 +1,17 @@
+2013-09-30 Andrew Pinski <andrew.pinski@caviumnetworks.com>
+
+ * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SYSCALL_ERROR_HANDLER):
+ Fix store to errno to use 32bits.
+
+2013-09-24 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
+
+ * sysdeps/aarch64/machine-gmon.h (__mcount): Accept parameter and
+ pass it to mcount_internal.
+
+2013-09-24 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
+
+ * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h: New file.
+
2013-07-26 Marcus Shawcroft <marcus.shawcroft@linaro.org>
* sysdeps/aarch64/Versions: New file.
diff --git a/libc/ports/ChangeLog.alpha b/libc/ports/ChangeLog.alpha
index e5c7bc1da..68d430dc3 100644
--- a/libc/ports/ChangeLog.alpha
+++ b/libc/ports/ChangeLog.alpha
@@ -1,3 +1,23 @@
+2013-10-12 Yuri Chornoivan <yurchor@ukr.net>
+
+ * sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S: Fix typos.
+ * sysdeps/unix/sysv/linux/alpha/nptl/vfork.S: Likewise.
+
+2013-10-01 Richard Henderson <rth@redhat.com>
+
+ * sysdeps/unix/alpha/sysdep.h (PTR_MANGLE): Improve conditions under
+ which it is defined.
+
+2013-09-20 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/alpha/alphaev67/ffs.S (__ffs): Define as hidden.
+ * sysdeps/alpha/ffs.S (__ffs): Likewise.
+
+2013-09-11 Andreas Schwab <schwab@suse.de>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (__O_TMPFILE):
+ Define.
+
2013-08-30 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/alpha/alphaev67/stpncpy.S: Fix then/than typos.
diff --git a/libc/ports/ChangeLog.arm b/libc/ports/ChangeLog.arm
index 8ef09b116..6707d2ef3 100644
--- a/libc/ports/ChangeLog.arm
+++ b/libc/ports/ChangeLog.arm
@@ -1,3 +1,52 @@
+2013-10-04 Will Newton <will.newton@linaro.org>
+
+ * sysdeps/arm/__longjmp.S (NO_THUMB): Remove define.
+ (__longjmp): Use Thumb supported instructions.
+ * sysdeps/unix/sysv/linux/arm/____longjmp_chk.S (NO_THUMB):
+ Remove define.
+
+ * sysdeps/arm/setjmp.S (NO_THUMB): Remove define.
+ (__sigsetjmp): Use Thumb supported instructions.
+
+2013-10-03 Will Newton <will.newton@linaro.org>
+
+ * sysdeps/arm/__longjmp.S (__longjmp): Demangle fp, sp
+ and lr when restoring register values.
+ * sysdeps/arm/include/bits/setjmp.h (JMP_BUF_REGLIST): Remove
+ sp and lr from list and replace fp with a4.
+ * sysdeps/arm/jmpbuf-unwind.h (_jmpbuf_sp): New function.
+ (_JMPBUF_UNWINDS_ADJ): Call _jmpbuf_sp.
+ * sysdeps/arm/setjmp.S (__sigsetjmp): Mangle fp, sp and lr
+ before storing register values.
+ * sysdeps/arm/sysdep.h (LDST_GLOBAL): New macro.
+ * sysdeps/unix/sysv/linux/arm/sysdep.h (PTR_MANGLE): New macro.
+ (PTR_DEMANGLE): Likewise. (PTR_MANGLE2): Likewise.
+ (PTR_DEMANGLE2): Likewise.
+
+2013-09-24 Will Newton <will.newton@linaro.org>
+
+ * ports/sysdeps/arm/nptl/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
+ macro.
+
+2013-09-20 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/arm/armv6t2/ffs.S (__ffs): Define as hidden.
+
+2013-09-18 Dinar Temirbulatov <dtemirbulatov@gmail.com>
+
+ [BZ #15640]
+ * sysdeps/arm/bits/atomic.h (atomic_exchange_acq, atomic_exchange_rel)
+ (atomic_compare_and_exchange_bool_acq)
+ (atomic_compare_and_exchange_val_acq)
+ (atomic_compare_and_exchange_bool_rel)
+ (atomic_compare_and_exchange_val_rel): Use __atomic_exchange_n and
+ __atomic_compare_exchange_n builtins when GCC supports them.
+
+2013-09-16 Will Newton <will.newton@linaro.org>
+
+ * sysdeps/arm/armv7/multiarch/memcpy_impl.S: Tighten check
+ on entry to aligned copy loop to improve performance.
+
2013-08-30 Roland McGrath <roland@hack.frob.com>
* sysdeps/arm/armv6t2/strlen.S: Use sfi_pld and sfi_breg macros.
diff --git a/libc/ports/ChangeLog.hppa b/libc/ports/ChangeLog.hppa
index ea4ef886f..3e7c16221 100644
--- a/libc/ports/ChangeLog.hppa
+++ b/libc/ports/ChangeLog.hppa
@@ -1,3 +1,7 @@
+2013-09-11 Andreas Schwab <schwab@suse.de>
+
+ * sysdeps/unix/sysv/linux/hppa/bits/fcntl.h (__O_TMPFILE): Define.
+
2013-08-30 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/unix/sysv/linux/hppa/clone.S: Fix typos.
diff --git a/libc/ports/ChangeLog.ia64 b/libc/ports/ChangeLog.ia64
index efe352e6b..272f73a1b 100644
--- a/libc/ports/ChangeLog.ia64
+++ b/libc/ports/ChangeLog.ia64
@@ -1,3 +1,8 @@
+2013-09-22 Carlos O'Donell <carlos@redhat.com>
+
+ [BZ #15754]
+ * sysdeps/ia64/stackguard-macros.h: Define POINTER_CHK_GUARD.
+
2013-08-30 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/ia64/fpu/libm_reduce.S: Fix typos.
diff --git a/libc/ports/ChangeLog.m68k b/libc/ports/ChangeLog.m68k
index ba9865a9d..5bcd94541 100644
--- a/libc/ports/ChangeLog.m68k
+++ b/libc/ports/ChangeLog.m68k
@@ -1,3 +1,11 @@
+2013-10-08 Andreas Schwab <schwab@suse.de>
+
+ * sysdeps/m68k/start.S [SHARED]: Use PIC.
+
+2013-09-20 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/m68k/ffs.c (__ffs): Define as hidden.
+
2013-09-04 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/m68k/mmap64.c: New file.
diff --git a/libc/ports/ChangeLog.mips b/libc/ports/ChangeLog.mips
index 5844bf589..eaa6ade59 100644
--- a/libc/ports/ChangeLog.mips
+++ b/libc/ports/ChangeLog.mips
@@ -1,3 +1,127 @@
+2013-09-26 Steve Ellcey <sellcey@mips.com>
+
+ [BZ #15632]
+ * sysdeps/mips/mips32/fpu/e_sqrt.c: New.
+ * sysdeps/mips/mips32/fpu/e_sqrtf.c: New.
+ * sysdeps/mips/mips64/n32/fpu/e_sqrt.c: New.
+ * sysdeps/mips/mips64/n32/fpu/e_sqrtf.c: New.
+ * sysdeps/mips/mips64/n64/fpu/e_sqrt.c: New.
+ * sysdeps/mips/mips64/n64/fpu/e_sqrtf.c: New.
+
+2013-09-23 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/math_private.h (libc_feholdexcept_mips): New function.
+ (libc_feholdexcept): New macro.
+ (libc_feholdexceptf): New macro.
+ (libc_feholdexceptl): New macro.
+ (libc_fesetround_mips): New function.
+ (libc_fesetround): New macro.
+ (libc_fesetroundf): New macro.
+ (libc_fesetroundl): New macro.
+ (libc_feholdexcept_setround_mips): New function.
+ (libc_feholdexcept_setround): New macro.
+ (libc_feholdexcept_setroundf): New macro.
+ (libc_feholdexcept_setroundl): New macro.
+ (libc_fesetenv_mips): New function.
+ (libc_fesetenv): New macro.
+ (libc_fesetenvf): New macro.
+ (libc_fesetenvl): New macro.
+ (libc_feupdateenv_mips): New function.
+ (libc_feupdateenv): New macro.
+ (libc_feupdateenvf): New macro.
+ (libc_feupdateenvl): New macro.
+
+2013-09-23 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * sysdeps/mips/bits/atomic.h: Fix comment typo.
+
+2013-09-23 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/fpu/fegetround.c (fegetround): Use _FPU_RC_MASK.
+ * sysdeps/mips/fpu/fesetround.c (fesetround): Use _FPU_RC_MASK.
+
+2013-09-23 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/fpu_control.h (_FPU_RC_MASK): New.
+
+2013-09-23 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/fpu_control.h (comments): Add capitalization and
+ periods to match GNU standard.
+
+2013-09-20 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/memset.S: Change prefetching and add loop unrolling.
+ * sysdeps/mips/mips64/memset.S: Remove.
+
+2013-09-18 Maciej W. Rozycki <macro@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+
+ * sysdeps/mips/dl-machine.h (ELF_MACHINE_NAN2008): New macro.
+ (elf_machine_matches_host): Reject objects that use a different
+ NaN encoding convention.
+ * sysdeps/mips/fpu_control.h: Document IEEE 754-2008 feature
+ control bits.
+ (_FPU_ABS2008, _FPU_NAN2008): New macros.
+ (_FPU_RESERVED): Clear bits #20 and #19.
+ (_FPU_DEFAULT) [__mips_nan2008]: Set bit #18.
+ (_FPU_IEEE) [__mips_nan2008]: Likewise.
+ * sysdeps/mips/math_private.h [__mips_nan2008]
+ (HIGH_ORDER_BIT_IS_SET_FOR_SNAN): Don't define.
+ * sysdeps/mips/bits/nan.h [__mips_nan2008] (__qnan_bytes): Define
+ appropriately.
+ * sysdeps/mips/mips64/soft-fp/sfp-machine.h [__mips_nan2008]
+ (_FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q): Define 2008-NaN
+ payloads.
+ (_FP_QNANNEGATEDP): Set to 0.
+ * sysdeps/mips/soft-fp/sfp-machine.h [__mips_nan2008]
+ (_FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q): Define 2008-NaN
+ payloads.
+ (_FP_QNANNEGATEDP): Set to 0.
+ * sysdeps/unix/sysv/linux/mips/dl-cache.h (_DL_CACHE_DEFAULT_ID):
+ Define 2008 NaN encoding values.
+ * sysdeps/unix/sysv/linux/mips/readelflib.c (process_elf_file):
+ Handle 2008-NaN libraries.
+ * sysdeps/mips/shlib-versions [HAVE_MIPS_NAN2008]: Set
+ ld=ld-linux-mipsn8.so.1.
+ * sysdeps/mips/configure.in: Define HAVE_MIPS_NAN2008 if the
+ 2008 NaN encoding is used.
+ * sysdeps/unix/sysv/linux/mips/Makefile (abi-variants): Add
+ 2008-NaN ABI variants.
+ (abi-o32_soft-options, abi-o32_soft-condition): Update with the
+ __mips_nan2008 macro.
+ (abi-o32_hard-options, abi-o32_hard-condition): Likewise.
+ (abi-n32_soft-options, abi-n32_soft-condition): Likewise.
+ (abi-n32_hard-options, abi-n32_hard-condition): Likewise.
+ (abi-n64_soft-options, abi-n64_soft-condition): Likewise.
+ (abi-n64_hard-options, abi-n64_hard-condition): Likewise.
+ (abi-o32_soft-ld-soname, abi-o32_hard-ld-soname): New macros.
+ (abi-n32_soft-ld-soname, abi-n32_hard-ld-soname): Likewise.
+ (abi-n64_soft-ld-soname, abi-n64_hard-ld-soname): Likewise.
+ (abi-o32_soft_2008-options): Likewise.
+ (abi-o32_soft_2008-condition): Likewise.
+ (abi-o32_hard_2008-options): Likewise.
+ (abi-o32_hard_2008-condition): Likewise.
+ (abi-n32_soft_2008-options): Likewise.
+ (abi-n32_soft_2008-condition): Likewise.
+ (abi-n32_hard_2008-options): Likewise.
+ (abi-n32_hard_2008-condition): Likewise.
+ (abi-n64_soft_2008-options): Likewise.
+ (abi-n64_soft_2008-condition): Likewise.
+ (abi-n64_hard_2008-options): Likewise.
+ (abi-n64_hard_2008-condition): Likewise.
+ (abi-o32_soft_2008-ld-soname): Likewise.
+ (abi-o32_hard_2008-ld-soname): Likewise.
+ (abi-n32_soft_2008-ld-soname): Likewise.
+ (abi-n32_hard_2008-ld-soname): Likewise.
+ (abi-n64_soft_2008-ld-soname): Likewise.
+ (abi-n64_hard_2008-ld-soname): Likewise.
+ * sysdeps/unix/sysv/linux/mips/configure.in: Include the NaN
+ encoding selection in default-abi. Set arch_minimum_kernel to
+ 10.0.0 if 2008 NaN encoding is used.
+ * sysdeps/mips/configure: Regenerate.
+ * sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+
2013-08-30 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/mips/memcpy.S: Fix then/than typos.
diff --git a/libc/ports/ChangeLog.powerpc b/libc/ports/ChangeLog.powerpc
index 375e9566e..9f04afae1 100644
--- a/libc/ports/ChangeLog.powerpc
+++ b/libc/ports/ChangeLog.powerpc
@@ -1,3 +1,45 @@
+This file describes changes to the soft-float powerpc port while it
+was in the ports add-on directory. This port is no longer part of an
+add-on and so future changes to it should be listed in the top-level
+ChangeLog file, not here.
+
+
+
+2013-10-04 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/powerpc32/Makefile: Remove file.
+ * sysdeps/powerpc/nofpu: Move directory to
+ ../sysdeps/powerpc/nofpu.
+ * sysdeps/powerpc/soft-fp: Move directory to
+ ../sysdeps/powerpc/soft-fp.
+ * sysdeps/powerpc/powerpc32/405: Move directory to
+ ../sysdeps/powerpc/powerpc32/405.
+ * sysdeps/powerpc/powerpc32/440: Move directory to
+ ../sysdeps/powerpc/powerpc32/440.
+ * sysdeps/powerpc/powerpc32/464: Move directory to
+ ../sysdeps/powerpc/powerpc32/464.
+ * sysdeps/powerpc/powerpc32/476: Move directory to
+ ../sysdeps/powerpc/powerpc32/476.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu: Move directory
+ to ../sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/405: Move directory to
+ ../sysdeps/unix/sysv/linux/powerpc/powerpc32/405.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/440: Move directory to
+ ../sysdeps/unix/sysv/linux/powerpc/powerpc32/440.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/464: Move directory to
+ ../sysdeps/unix/sysv/linux/powerpc/powerpc32/464.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/476: Move directory to
+ ../sysdeps/unix/sysv/linux/powerpc/powerpc32/476.
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h:
+ New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S:
+ Include <context-e500.h>.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S:
+ Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S:
+ Likewise.
+
2013-08-30 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/powerpc/powerpc32/405/memcpy.S: Fix typos.
diff --git a/libc/ports/ChangeLog.tile b/libc/ports/ChangeLog.tile
index 5ad254c5f..dc2e7e412 100644
--- a/libc/ports/ChangeLog.tile
+++ b/libc/ports/ChangeLog.tile
@@ -1,3 +1,12 @@
+2013-09-22 Carlos O'Donell <carlos@redhat.com>
+
+ [BZ #15754]
+ * sysdeps/tile/stackguard-macros.h: Define POINTER_CHK_GUARD.
+
+2013-09-20 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/tile/ffs.c (__ffs): Define as hidden.
+
2013-08-21 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/tile/jmpbuf-offsets.h: Fix typos.
diff --git a/libc/ports/sysdeps/aarch64/machine-gmon.h b/libc/ports/sysdeps/aarch64/machine-gmon.h
index 4425965a4..5cc294125 100644
--- a/libc/ports/sysdeps/aarch64/machine-gmon.h
+++ b/libc/ports/sysdeps/aarch64/machine-gmon.h
@@ -16,10 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* GCC version 2 gives us a perfect magical function to get
- just the information we need:
- void *__builtin_return_address (unsigned int N)
- returns the return address of the frame N frames up. */
+/* Accept 'frompc' address as argument from the function that calls
+ __mcount for profiling. Use __builtin_return_address (0)
+ for the 'selfpc' address. */
#include <sysdep.h>
@@ -28,8 +27,8 @@ static void mcount_internal (u_long frompc, u_long selfpc);
#define _MCOUNT_DECL(frompc, selfpc) \
static inline void mcount_internal (u_long frompc, u_long selfpc)
-#define MCOUNT \
-void __mcount (void) \
-{ \
- mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \
+#define MCOUNT \
+void __mcount (void *frompc) \
+{ \
+ mcount_internal ((u_long) frompc, (u_long) RETURN_ADDRESS (0)); \
}
diff --git a/libc/ports/sysdeps/alpha/alphaev67/ffs.S b/libc/ports/sysdeps/alpha/alphaev67/ffs.S
index e4531525a..9b3463cbc 100644
--- a/libc/ports/sysdeps/alpha/alphaev67/ffs.S
+++ b/libc/ports/sysdeps/alpha/alphaev67/ffs.S
@@ -47,4 +47,5 @@ ENTRY(__ffs)
END(__ffs)
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
diff --git a/libc/ports/sysdeps/alpha/ffs.S b/libc/ports/sysdeps/alpha/ffs.S
index def0f25d7..d1f0c8371 100644
--- a/libc/ports/sysdeps/alpha/ffs.S
+++ b/libc/ports/sysdeps/alpha/ffs.S
@@ -85,6 +85,7 @@ $ffsl..ng:
END(ffsl)
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
weak_extern (ffsl)
weak_alias (ffsl, ffsll)
diff --git a/libc/ports/sysdeps/arm/__longjmp.S b/libc/ports/sysdeps/arm/__longjmp.S
index a5edede16..894c121c0 100644
--- a/libc/ports/sysdeps/arm/__longjmp.S
+++ b/libc/ports/sysdeps/arm/__longjmp.S
@@ -16,8 +16,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* ??? Needs more rearrangement for the LDM to handle thumb mode. */
-#define NO_THUMB
#include <sysdep.h>
#include <bits/setjmp.h>
#include <rtld-global-offsets.h>
@@ -28,16 +26,32 @@
ENTRY (__longjmp)
mov ip, r0
movs r0, r1 /* get the return value in place */
+ it eq
moveq r0, #1 /* can't let setjmp() return zero! */
#ifdef CHECK_SP
sfi_breg ip, \
ldr r4, [\B, #32] /* jmpbuf's sp */
cfi_undefined (r4)
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE (r4, r4, a3, a4)
+#endif
CHECK_SP (r4)
#endif
sfi_sp sfi_breg ip, \
ldmia \B!, JMP_BUF_REGLIST
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE (fp, a4, a3, a2)
+ ldr a4, [ip], #4
+ PTR_DEMANGLE2 (a4, a4, a3)
+ mov sp, a4
+ ldr a4, [ip], #4
+ PTR_DEMANGLE2 (lr, a4, a3)
+#else
+ mov fp, a4
+ ldr sp, [ip], #4
+ ldr lr, [ip], #4
+#endif
cfi_restore (v1)
cfi_restore (v2)
cfi_restore (v3)
diff --git a/libc/ports/sysdeps/arm/armv6t2/ffs.S b/libc/ports/sysdeps/arm/armv6t2/ffs.S
index b2c88b946..9f999306f 100644
--- a/libc/ports/sysdeps/arm/armv6t2/ffs.S
+++ b/libc/ports/sysdeps/arm/armv6t2/ffs.S
@@ -32,4 +32,5 @@ END (__ffs)
weak_alias (__ffs, ffs)
weak_alias (__ffs, ffsl)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
diff --git a/libc/ports/sysdeps/arm/armv7/multiarch/memcpy_impl.S b/libc/ports/sysdeps/arm/armv7/multiarch/memcpy_impl.S
index 3decad60b..ad43a3db5 100644
--- a/libc/ports/sysdeps/arm/armv7/multiarch/memcpy_impl.S
+++ b/libc/ports/sysdeps/arm/armv7/multiarch/memcpy_impl.S
@@ -24,7 +24,6 @@
ARMv6 (ARMv7-a if using Neon)
ARM state
Unaligned accesses
- LDRD/STRD support unaligned word accesses
*/
@@ -369,8 +368,8 @@ ENTRY(memcpy)
cfi_adjust_cfa_offset (FRAME_SIZE)
cfi_rel_offset (tmp2, 0)
cfi_remember_state
- and tmp2, src, #3
- and tmp1, dst, #3
+ and tmp2, src, #7
+ and tmp1, dst, #7
cmp tmp1, tmp2
bne .Lcpy_notaligned
@@ -381,9 +380,9 @@ ENTRY(memcpy)
vmov.f32 s0, s0
#endif
- /* SRC and DST have the same mutual 32-bit alignment, but we may
+ /* SRC and DST have the same mutual 64-bit alignment, but we may
still need to pre-copy some bytes to get to natural alignment.
- We bring DST into full 64-bit alignment. */
+ We bring SRC and DST into full 64-bit alignment. */
lsls tmp2, dst, #29
beq 1f
rsbs tmp2, tmp2, #0
@@ -515,7 +514,7 @@ ENTRY(memcpy)
.Ltail63aligned: /* Count in tmp2. */
/* Copy up to 7 d-words of data. Similar to Ltail63unaligned, but
- we know that the src and dest are 32-bit aligned so we can use
+ we know that the src and dest are 64-bit aligned so we can use
LDRD/STRD to improve efficiency. */
/* TMP2 is now negative, but we don't care about that. The bottom
six bits still tell us how many bytes are left to copy. */
diff --git a/libc/ports/sysdeps/arm/bits/atomic.h b/libc/ports/sysdeps/arm/bits/atomic.h
index 6e20df741..5e0801dd8 100644
--- a/libc/ports/sysdeps/arm/bits/atomic.h
+++ b/libc/ports/sysdeps/arm/bits/atomic.h
@@ -35,9 +35,6 @@ typedef uintmax_t uatomic_max_t;
void __arm_link_error (void);
-/* Use the atomic builtins provided by GCC in case the backend provides
- a pattern to do this efficiently. */
-
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
# define atomic_full_barrier() __sync_synchronize ()
#else
@@ -51,9 +48,88 @@ void __arm_link_error (void);
# define __arm_assisted_full_barrier() __arm_link_error()
#endif
-/* Atomic compare and exchange. */
+/* Use the atomic builtins provided by GCC in case the backend provides
+ a pattern to do this efficiently. */
+#if __GNUC_PREREQ (4, 7) && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ (__arm_link_error (), (typeof (*mem)) 0)
+
+/* Compare and exchange with "acquire" semantics, ie barrier after. */
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_ACQUIRE)
+
+/* Compare and exchange with "release" semantics, ie barrier before. */
+
+# define atomic_compare_and_exchange_bool_rel(mem, new, old) \
+ __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+# define atomic_compare_and_exchange_val_rel(mem, new, old) \
+ __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
+ mem, new, old, __ATOMIC_RELEASE)
+
+/* Compare and exchange.
+ For all "bool" routines, we return FALSE if exchange succesful. */
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
+ ({ \
+ typeof (*mem) __oldval = (oldval); \
+ __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
+ model, __ATOMIC_RELAXED); \
+ __oldval; \
+ })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
+ ({__arm_link_error (); oldval; })
+
+#elif defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+/* Atomic compare and exchange. */
# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
__sync_val_compare_and_swap ((mem), (oldval), (newval))
#else
@@ -61,16 +137,18 @@ void __arm_link_error (void);
__arm_assisted_compare_and_exchange_val_32_acq ((mem), (newval), (oldval))
#endif
+#if !__GNUC_PREREQ (4, 7) || !defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
/* We don't support atomic operations on any non-word types.
So make them link errors. */
-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
-#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
+#endif
/* An OS-specific bits/atomic.h file will define this macro if
the OS can provide something. If not, we'll fail to build
diff --git a/libc/ports/sysdeps/arm/include/bits/setjmp.h b/libc/ports/sysdeps/arm/include/bits/setjmp.h
index 1559d7b8e..64505dcb9 100644
--- a/libc/ports/sysdeps/arm/include/bits/setjmp.h
+++ b/libc/ports/sysdeps/arm/include/bits/setjmp.h
@@ -26,8 +26,9 @@
#ifndef _ISOMAC
/* Register list for a ldm/stm instruction to load/store
- the general registers from a __jmp_buf. */
-# define JMP_BUF_REGLIST {v1-v6, sl, fp, sp, lr}
+ the general registers from a __jmp_buf. The a4 register
+ contains fp at this point. */
+# define JMP_BUF_REGLIST {a4, v1-v6, sl}
/* Index of __jmp_buf where the sp register resides. */
# define __JMP_BUF_SP 8
diff --git a/libc/ports/sysdeps/arm/jmpbuf-unwind.h b/libc/ports/sysdeps/arm/jmpbuf-unwind.h
index 0863540ce..1b0d0202e 100644
--- a/libc/ports/sysdeps/arm/jmpbuf-unwind.h
+++ b/libc/ports/sysdeps/arm/jmpbuf-unwind.h
@@ -17,6 +17,7 @@
#include <setjmp.h>
#include <stdint.h>
+#include <sysdep.h>
#include <unwind.h>
/* Test if longjmp to JMPBUF would unwind the frame
@@ -27,8 +28,18 @@
#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[__JMP_BUF_SP];
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE (sp);
+#endif
+ return sp;
+}
+
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
- ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[__JMP_BUF_SP] - (_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/libc/ports/sysdeps/arm/nptl/tls.h b/libc/ports/sysdeps/arm/nptl/tls.h
index e57cdb749..da1502716 100644
--- a/libc/ports/sysdeps/arm/nptl/tls.h
+++ b/libc/ports/sysdeps/arm/nptl/tls.h
@@ -119,10 +119,6 @@ typedef struct
#define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
-/* Initializing the thread pointer will generate a SIGILL if the syscall
- is not available. */
-#define TLS_INIT_TP_EXPENSIVE 1
-
/* Get and set the global scope generation counter in struct pthread. */
#define THREAD_GSCOPE_FLAG_UNUSED 0
#define THREAD_GSCOPE_FLAG_USED 1
diff --git a/libc/ports/sysdeps/arm/setjmp.S b/libc/ports/sysdeps/arm/setjmp.S
index a6c161db5..fedd99431 100644
--- a/libc/ports/sysdeps/arm/setjmp.S
+++ b/libc/ports/sysdeps/arm/setjmp.S
@@ -16,19 +16,32 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* ??? Needs more rearrangement for the STM to handle thumb mode. */
-#define NO_THUMB
#include <sysdep.h>
#include <bits/setjmp.h>
#include <rtld-global-offsets.h>
#include <arm-features.h>
ENTRY (__sigsetjmp)
+#ifdef PTR_MANGLE
+ PTR_MANGLE (a4, fp, a3, ip)
+#else
+ mov a4, fp
+#endif
mov ip, r0
/* Save registers */
sfi_breg ip, \
stmia \B!, JMP_BUF_REGLIST
+#ifdef PTR_MANGLE
+ mov a4, sp
+ PTR_MANGLE2 (a4, a4, a3)
+ str a4, [ip], #4
+ PTR_MANGLE2 (a4, lr, a3)
+ str a4, [ip], #4
+#else
+ str sp, [ip], #4
+ str lr, [ip], #4
+#endif
#if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__
# define NEED_HWCAP 1
diff --git a/libc/ports/sysdeps/arm/sysdep.h b/libc/ports/sysdeps/arm/sysdep.h
index 550159740..3823617f1 100644
--- a/libc/ports/sysdeps/arm/sysdep.h
+++ b/libc/ports/sysdeps/arm/sysdep.h
@@ -171,6 +171,18 @@
99: OP R, [pc, T]
# endif
+/* Load or store to/from a global EXPR into/from R, using T. */
+# define LDST_GLOBAL(OP, R, T, EXPR) \
+ ldr T, 99f; \
+ ldr R, 100f; \
+98: add T, T, pc; \
+ ldr T, [T, R]; \
+ .subsection 2; \
+99: .word _GLOBAL_OFFSET_TABLE_ - 98b - PC_OFS; \
+100: .word EXPR##(GOT); \
+ .previous; \
+ OP R, [T]
+
/* Cope with negative memory offsets, which thumb can't encode.
Use NEGOFF_ADJ_BASE to (conditionally) alter the base register,
and then NEGOFF_OFF1 to use 0 for thumb and the offset for arm,
diff --git a/libc/ports/sysdeps/ia64/fpu/printf_fphex.c b/libc/ports/sysdeps/ia64/fpu/printf_fphex.c
index ca021427e..0698cdad1 100644
--- a/libc/ports/sysdeps/ia64/fpu/printf_fphex.c
+++ b/libc/ports/sysdeps/ia64/fpu/printf_fphex.c
@@ -25,9 +25,11 @@ do { \
/* The "strange" 80 bit format on ia64 has an explicit \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
zero_mantissa = num == 0; \
\
@@ -49,8 +51,8 @@ do { \
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
- \
+ exponent = u.ieee.exponent; \
+ \
if (exponent == 0) \
{ \
if (zero_mantissa) \
diff --git a/libc/ports/sysdeps/ia64/stackguard-macros.h b/libc/ports/sysdeps/ia64/stackguard-macros.h
index dc683c28c..390729327 100644
--- a/libc/ports/sysdeps/ia64/stackguard-macros.h
+++ b/libc/ports/sysdeps/ia64/stackguard-macros.h
@@ -2,3 +2,6 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("adds %0 = -8, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("adds %0 = -16, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
diff --git a/libc/ports/sysdeps/m68k/ffs.c b/libc/ports/sysdeps/m68k/ffs.c
index fd4e5ffae..a3c1a0d02 100644
--- a/libc/ports/sysdeps/m68k/ffs.c
+++ b/libc/ports/sysdeps/m68k/ffs.c
@@ -36,6 +36,7 @@ __ffs (x)
return 32 - cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
diff --git a/libc/ports/sysdeps/m68k/start.S b/libc/ports/sysdeps/m68k/start.S
index a09896fdc..c3ceee6fa 100644
--- a/libc/ports/sysdeps/m68k/start.S
+++ b/libc/ports/sysdeps/m68k/start.S
@@ -52,6 +52,8 @@
NULL
*/
+#include <sysdep.h>
+
.text
.globl _start
.type _start,@function
@@ -74,6 +76,24 @@ _start:
pea (%a1) /* Push address of the shared library
termination function. */
+#ifdef SHARED
+ /* Load PIC register. */
+ LOAD_GOT (%a5)
+
+ /* Push the address of our own entry points to `.fini' and
+ `.init'. */
+ move.l __libc_csu_fini@GOT(%a5), -(%sp)
+ move.l __libc_csu_init@GOT(%a5), -(%sp)
+
+ pea (%a0) /* Push second argument: argv. */
+ move.l %d0, -(%sp) /* Push first argument: argc. */
+
+ move.l main@GOT(%a5), -(%sp)
+
+ /* Call the user's main function, and exit with its value. But
+ let the libc call main. */
+ jbsr __libc_start_main@PLTPC
+#else
/* Push the address of our own entry points to `.fini' and
`.init'. */
pea __libc_csu_fini
@@ -87,6 +107,7 @@ _start:
/* Call the user's main function, and exit with its value. But
let the libc call main. */
jbsr __libc_start_main
+#endif
illegal /* Crash if somehow `exit' does return. */
diff --git a/libc/ports/sysdeps/mips/bits/atomic.h b/libc/ports/sysdeps/mips/bits/atomic.h
index 7c735f726..b31444f57 100644
--- a/libc/ports/sysdeps/mips/bits/atomic.h
+++ b/libc/ports/sysdeps/mips/bits/atomic.h
@@ -84,7 +84,7 @@ typedef uintmax_t uatomic_max_t;
support for their efficient implementation was added only in GCC 4.8.
We still want to use them even with GCC 4.7 for MIPS16 code where we
have no assembly alternative available and want to avoid the __sync_*
- if at all possible. */
+ builtins if at all possible. */
/* Compare and exchange.
For all "bool" routines, we return FALSE if exchange succesful. */
diff --git a/libc/ports/sysdeps/mips/bits/nan.h b/libc/ports/sysdeps/mips/bits/nan.h
index 80f7866a9..c32252327 100644
--- a/libc/ports/sysdeps/mips/bits/nan.h
+++ b/libc/ports/sysdeps/mips/bits/nan.h
@@ -22,10 +22,11 @@
/* IEEE Not A Number. */
-/* Note that MIPS has the qNaN and sNaN patterns reversed compared to most
- other architectures. IEEE 754-1985 left the definition of this open to
- implementations, and for MIPS the top bit of the mantissa must be SET to
- indicate a sNaN. */
+/* In legacy-NaN mode MIPS has the qNaN and sNaN patterns reversed
+ compared to most other architectures. IEEE 754-1985 left the
+ definition of this open to implementations, and for MIPS the top bit
+ of the mantissa must be SET to indicate a sNaN. In 2008-NaN mode
+ MIPS aligned to IEEE 754-2008. */
#if __GNUC_PREREQ(3,3)
@@ -33,6 +34,8 @@
#elif defined __GNUC__
+/* No 2008-NaN mode support in any GCC version before 4.9. */
+
# define NAN \
(__extension__ \
((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
@@ -43,10 +46,18 @@
# include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN
-# define __qnan_bytes { 0x7f, 0xbf, 0xff, 0xff }
+# ifdef __mips_nan2008
+# define __qnan_bytes { 0x7f, 0xc0, 0, 0 }
+# else
+# define __qnan_bytes { 0x7f, 0xbf, 0xff, 0xff }
+# endif
# endif
# if __BYTE_ORDER == __LITTLE_ENDIAN
-# define __qnan_bytes { 0xff, 0xff, 0xbf, 0x7f }
+# ifdef __mips_nan2008
+# define __qnan_bytes { 0, 0, 0xc0, 0x7f }
+# else
+# define __qnan_bytes { 0xff, 0xff, 0xbf, 0x7f }
+# endif
# endif
static union { unsigned char __c[4]; float __d; } __qnan_union
diff --git a/libc/ports/sysdeps/mips/configure b/libc/ports/sysdeps/mips/configure
index 898e4c3f2..de8092c97 100644
--- a/libc/ports/sysdeps/mips/configure
+++ b/libc/ports/sysdeps/mips/configure
@@ -1,3 +1,163 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/mips.
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is using the 2008 NaN encoding" >&5
+$as_echo_n "checking whether the compiler is using the 2008 NaN encoding... " >&6; }
+if ${libc_cv_mips_nan2008+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+dnl
+#ifdef __mips_nan2008
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then :
+ libc_cv_mips_nan2008=yes
+else
+ libc_cv_mips_nan2008=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mips_nan2008" >&5
+$as_echo "$libc_cv_mips_nan2008" >&6; }
+if test x$libc_cv_mips_nan2008 = xyes; then
+ $as_echo "#define HAVE_MIPS_NAN2008 1" >>confdefs.h
+
+fi
diff --git a/libc/ports/sysdeps/mips/configure.in b/libc/ports/sysdeps/mips/configure.in
index be9672d82..bcbdaffd9 100644
--- a/libc/ports/sysdeps/mips/configure.in
+++ b/libc/ports/sysdeps/mips/configure.in
@@ -4,3 +4,12 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
dnl No MIPS GCC supports accessing static and hidden symbols in an
dnl position independent way.
dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)
+
+AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+ libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
+#ifdef __mips_nan2008
+yes
+#endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+if test x$libc_cv_mips_nan2008 = xyes; then
+ AC_DEFINE(HAVE_MIPS_NAN2008)
+fi
diff --git a/libc/ports/sysdeps/mips/dl-machine.h b/libc/ports/sysdeps/mips/dl-machine.h
index dae938f03..722c8a0ba 100644
--- a/libc/ports/sysdeps/mips/dl-machine.h
+++ b/libc/ports/sysdeps/mips/dl-machine.h
@@ -73,6 +73,16 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
(ElfW(Addr)) (r); \
} while (0)
+#if ((defined __mips_nan2008 && !defined HAVE_MIPS_NAN2008) \
+ || (!defined __mips_nan2008 && defined HAVE_MIPS_NAN2008))
+# error "Configuration inconsistency: __mips_nan2008 != HAVE_MIPS_NAN2008, overridden CFLAGS?"
+#endif
+#ifdef __mips_nan2008
+# define ELF_MACHINE_NAN2008 EF_MIPS_NAN2008
+#else
+# define ELF_MACHINE_NAN2008 0
+#endif
+
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute_used__
elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
@@ -83,6 +93,10 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
return 0;
#endif
+ /* Don't link 2008-NaN and legacy-NaN objects together. */
+ if ((ehdr->e_flags & EF_MIPS_NAN2008) != ELF_MACHINE_NAN2008)
+ return 0;
+
switch (ehdr->e_machine)
{
case EM_MIPS:
diff --git a/libc/ports/sysdeps/mips/fpu/fegetround.c b/libc/ports/sysdeps/mips/fpu/fegetround.c
index 61217a7c0..17cd3e994 100644
--- a/libc/ports/sysdeps/mips/fpu/fegetround.c
+++ b/libc/ports/sysdeps/mips/fpu/fegetround.c
@@ -28,5 +28,5 @@ fegetround (void)
/* Get control word. */
_FPU_GETCW (cw);
- return cw & 0x3;
+ return cw & _FPU_RC_MASK;
}
diff --git a/libc/ports/sysdeps/mips/fpu/fesetround.c b/libc/ports/sysdeps/mips/fpu/fesetround.c
index 7c25f43b7..c6fdd6622 100644
--- a/libc/ports/sysdeps/mips/fpu/fesetround.c
+++ b/libc/ports/sysdeps/mips/fpu/fesetround.c
@@ -25,7 +25,7 @@ fesetround (int round)
{
fpu_control_t cw;
- if ((round & ~0x3) != 0)
+ if ((round & ~_FPU_RC_MASK) != 0)
/* ROUND is no valid rounding mode. */
return 1;
@@ -33,7 +33,7 @@ fesetround (int round)
_FPU_GETCW (cw);
/* Set rounding bits. */
- cw &= ~0x3;
+ cw &= ~_FPU_RC_MASK;
cw |= round;
/* Set new state. */
_FPU_SETCW (cw);
diff --git a/libc/ports/sysdeps/mips/fpu_control.h b/libc/ports/sysdeps/mips/fpu_control.h
index 770cbb31d..ee774153f 100644
--- a/libc/ports/sysdeps/mips/fpu_control.h
+++ b/libc/ports/sysdeps/mips/fpu_control.h
@@ -29,7 +29,9 @@
* available for MIPS III and newer.
* 23 -> Condition bit
* 22-21 -> reserved for architecture implementers
- * 20-18 -> reserved (read as 0, write with 0)
+ * 20 -> reserved (read as 0, write with 0)
+ * 19 -> IEEE 754-2008 non-arithmetic ABS.fmt and NEG.fmt enable
+ * 18 -> IEEE 754-2008 recommended NaN encoding enable
* 17 -> cause bit for unimplemented operation
* 16 -> cause bit for invalid exception
* 15 -> cause bit for division by zero exception
@@ -69,32 +71,45 @@ extern fpu_control_t __fpu_control;
#else /* __mips_soft_float */
-/* masking of interrupts */
+/* Masks for 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 */
+/* Flush denormalized numbers to zero. */
#define _FPU_FLUSH_TZ 0x1000000
-/* rounding control */
+/* IEEE 754-2008 compliance control. */
+#define _FPU_ABS2008 0x80000
+#define _FPU_NAN2008 0x40000
+
+/* Rounding control. */
#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
#define _FPU_RC_ZERO 0x1
#define _FPU_RC_UP 0x2
#define _FPU_RC_DOWN 0x3
+/* Mask for rounding control. */
+#define _FPU_RC_MASK 0x3
-#define _FPU_RESERVED 0xfe9c0000 /* Reserved bits in cw */
+#define _FPU_RESERVED 0xfe840000 /* Reserved bits in cw, incl NAN2008. */
/* The fdlibm code requires strict IEEE double precision arithmetic,
and no interrupts for exceptions, rounding to nearest. */
+#ifdef __mips_nan2008
+# define _FPU_DEFAULT 0x00040000
+#else
+# define _FPU_DEFAULT 0x00000000
+#endif
-#define _FPU_DEFAULT 0x00000000
-
-/* IEEE: same as above, but exceptions */
-#define _FPU_IEEE 0x00000F80
+/* IEEE: same as above, but exceptions. */
+#ifdef __mips_nan2008
+# define _FPU_IEEE 0x00040F80
+#else
+# define _FPU_IEEE 0x00000F80
+#endif
/* Type of the control word. */
typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
diff --git a/libc/ports/sysdeps/mips/math_private.h b/libc/ports/sysdeps/mips/math_private.h
index f0ba4ee70..4f029b0a6 100644
--- a/libc/ports/sysdeps/mips/math_private.h
+++ b/libc/ports/sysdeps/mips/math_private.h
@@ -18,9 +18,121 @@
#ifndef _MATH_PRIVATE_H
+#ifdef __mips_nan2008
+/* MIPS aligned to IEEE 754-2008. */
+#else
/* One of the few architectures where the meaning of the quiet/signaling bit is
inverse to IEEE 754-2008 (as well as common practice for IEEE 754-1985). */
-#define HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+# define HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+#endif
+
+/* Inline functions to speed up the math library implementation. The
+ default versions of these routines are in generic/math_private.h
+ and call fesetround, feholdexcept, etc. These routines use inlined
+ code instead. */
+
+#ifdef __mips_hard_float
+
+# include <fenv.h>
+# include <fenv_libc.h>
+# include <fpu_control.h>
+
+static __always_inline void
+libc_feholdexcept_mips (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);
+}
+# define libc_feholdexcept libc_feholdexcept_mips
+# define libc_feholdexceptf libc_feholdexcept_mips
+# define libc_feholdexceptl libc_feholdexcept_mips
+
+static __always_inline void
+libc_fesetround_mips (int round)
+{
+ fpu_control_t cw;
+
+ /* Get current state. */
+ _FPU_GETCW (cw);
+
+ /* Set rounding bits. */
+ cw &= ~_FPU_RC_MASK;
+ cw |= round;
+
+ /* Set new state. */
+ _FPU_SETCW (cw);
+}
+# define libc_fesetround libc_fesetround_mips
+# define libc_fesetroundf libc_fesetround_mips
+# define libc_fesetroundl libc_fesetround_mips
+
+static __always_inline void
+libc_feholdexcept_setround_mips (fenv_t *envp, int round)
+{
+ 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);
+
+ /* Set rounding bits. */
+ cw &= ~_FPU_RC_MASK;
+ cw |= round;
+
+ /* Set new state. */
+ _FPU_SETCW (cw);
+}
+# define libc_feholdexcept_setround libc_feholdexcept_setround_mips
+# define libc_feholdexcept_setroundf libc_feholdexcept_setround_mips
+# define libc_feholdexcept_setroundl libc_feholdexcept_setround_mips
+
+static __always_inline void
+libc_fesetenv_mips (fenv_t *envp)
+{
+ fpu_control_t cw;
+
+ /* Read current state to flush fpu pipeline. */
+ _FPU_GETCW (cw);
+
+ _FPU_SETCW (envp->__fp_control_register);
+}
+# define libc_fesetenv libc_fesetenv_mips
+# define libc_fesetenvf libc_fesetenv_mips
+# define libc_fesetenvl libc_fesetenv_mips
+
+static __always_inline void
+libc_feupdateenv_mips (fenv_t *envp)
+{
+ int temp;
+
+ /* Save current exceptions. */
+ _FPU_GETCW (temp);
+
+ /* 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. */
+ temp &= FE_ALL_EXCEPT;
+ temp |= envp->__fp_control_register | (temp << CAUSE_SHIFT);
+
+ /* Set new state. */
+ _FPU_SETCW (temp);
+}
+# define libc_feupdateenv libc_feupdateenv_mips
+# define libc_feupdateenvf libc_feupdateenv_mips
+# define libc_feupdateenvl libc_feupdateenv_mips
+
+#endif
#include_next <math_private.h>
diff --git a/libc/ports/sysdeps/mips/memset.S b/libc/ports/sysdeps/mips/memset.S
index 85062fe2e..d30b1f0e6 100644
--- a/libc/ports/sysdeps/mips/memset.S
+++ b/libc/ports/sysdeps/mips/memset.S
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2013 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
@@ -16,70 +15,353 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <sysdep.h>
+#ifdef ANDROID_CHANGES
+# include "machine/asm.h"
+# include "machine/regdef.h"
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#elif _LIBC
+# include <sysdep.h>
+# include <regdef.h>
+# include <sys/asm.h>
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#elif _COMPILING_NEWLIB
+# include "machine/asm.h"
+# include "machine/regdef.h"
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#else
+# include <regdef.h>
+# include <sys/asm.h>
+#endif
- .set nomips16
+/* Check to see if the MIPS architecture we are compiling for supports
+ prefetching. */
+
+#if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)
+# ifndef DISABLE_PREFETCH
+# define USE_PREFETCH
+# endif
+#endif
+
+#if defined(_MIPS_SIM) && ((_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32))
+# ifndef DISABLE_DOUBLE
+# define USE_DOUBLE
+# endif
+#endif
+
+#ifndef USE_DOUBLE
+# ifndef DISABLE_DOUBLE_ALIGN
+# define DOUBLE_ALIGN
+# endif
+#endif
+
+/* Some asm.h files do not have the L macro definition. */
+#ifndef L
+# if _MIPS_SIM == _ABIO32
+# define L(label) $L ## label
+# else
+# define L(label) .L ## label
+# endif
+#endif
+
+/* Some asm.h files do not have the PTR_ADDIU macro definition. */
+#ifndef PTR_ADDIU
+# ifdef USE_DOUBLE
+# define PTR_ADDIU daddiu
+# else
+# define PTR_ADDIU addiu
+# endif
+#endif
-/* void *memset(void *s, int c, size_t n). */
+/* Using PREFETCH_HINT_PREPAREFORSTORE instead of PREFETCH_STORE
+ or PREFETCH_STORE_STREAMED offers a large performance advantage
+ but PREPAREFORSTORE has some special restrictions to consider.
-#if __MIPSEB
-# define SWHI swl /* high part is left in big-endian */
+ Prefetch with the 'prepare for store' hint does not copy a memory
+ location into the cache, it just allocates a cache line and zeros
+ it out. This means that if you do not write to the entire cache
+ line before writing it out to memory some data will get zero'ed out
+ when the cache line is written back to memory and data will be lost.
+
+ There are ifdef'ed sections of this memcpy to make sure that it does not
+ do prefetches on cache lines that are not going to be completely written.
+ This code is only needed and only used when PREFETCH_STORE_HINT is set to
+ PREFETCH_HINT_PREPAREFORSTORE. This code assumes that cache lines are
+ less than MAX_PREFETCH_SIZE bytes and if the cache line is larger it will
+ not work correctly. */
+
+#ifdef USE_PREFETCH
+# define PREFETCH_HINT_STORE 1
+# define PREFETCH_HINT_STORE_STREAMED 5
+# define PREFETCH_HINT_STORE_RETAINED 7
+# define PREFETCH_HINT_PREPAREFORSTORE 30
+
+/* If we have not picked out what hints to use at this point use the
+ standard load and store prefetch hints. */
+# ifndef PREFETCH_STORE_HINT
+# define PREFETCH_STORE_HINT PREFETCH_HINT_STORE
+# endif
+
+/* We double everything when USE_DOUBLE is true so we do 2 prefetches to
+ get 64 bytes in that case. The assumption is that each individual
+ prefetch brings in 32 bytes. */
+# ifdef USE_DOUBLE
+# define PREFETCH_CHUNK 64
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*64(reg); \
+ pref PREFETCH_STORE_HINT, ((chunk)*64)+32(reg)
+# else
+# define PREFETCH_CHUNK 32
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*32(reg)
+# endif
+
+/* MAX_PREFETCH_SIZE is the maximum size of a prefetch, it must not be less
+ than PREFETCH_CHUNK, the assumed size of each prefetch. If the real size
+ of a prefetch is greater than MAX_PREFETCH_SIZE and the PREPAREFORSTORE
+ hint is used, the code will not work correctly. If PREPAREFORSTORE is not
+ used than MAX_PREFETCH_SIZE does not matter. */
+# define MAX_PREFETCH_SIZE 128
+/* PREFETCH_LIMIT is set based on the fact that we never use an offset greater
+ than 5 on a STORE prefetch and that a single prefetch can never be larger
+ than MAX_PREFETCH_SIZE. We add the extra 32 when USE_DOUBLE is set because
+ we actually do two prefetches in that case, one 32 bytes after the other. */
+# ifdef USE_DOUBLE
+# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + 32 + MAX_PREFETCH_SIZE
+# else
+# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + MAX_PREFETCH_SIZE
+# endif
+
+# if (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE) \
+ && ((PREFETCH_CHUNK * 4) < MAX_PREFETCH_SIZE)
+/* We cannot handle this because the initial prefetches may fetch bytes that
+ are before the buffer being copied. We start copies with an offset
+ of 4 so avoid this situation when using PREPAREFORSTORE. */
+# error "PREFETCH_CHUNK is too large and/or MAX_PREFETCH_SIZE is too small."
+# endif
+#else /* USE_PREFETCH not defined */
+# define PREFETCH_FOR_STORE(offset, reg)
+#endif
+
+/* Allow the routine to be named something else if desired. */
+#ifndef MEMSET_NAME
+# define MEMSET_NAME memset
+#endif
+
+/* We load/store 64 bits at a time when USE_DOUBLE is true.
+ The C_ prefix stands for CHUNK and is used to avoid macro name
+ conflicts with system header files. */
+
+#ifdef USE_DOUBLE
+# define C_ST sd
+# if __MIPSEB
+# define C_STHI sdl /* high part is left in big-endian */
+# else
+# define C_STHI sdr /* high part is right in little-endian */
+# endif
#else
-# define SWHI swr /* high part is right in little-endian */
+# define C_ST sw
+# if __MIPSEB
+# define C_STHI swl /* high part is left in big-endian */
+# else
+# define C_STHI swr /* high part is right in little-endian */
+# endif
#endif
-ENTRY (memset)
+/* Bookkeeping values for 32 vs. 64 bit mode. */
+#ifdef USE_DOUBLE
+# define NSIZE 8
+# define NSIZEMASK 0x3f
+# define NSIZEDMASK 0x7f
+#else
+# define NSIZE 4
+# define NSIZEMASK 0x1f
+# define NSIZEDMASK 0x3f
+#endif
+#define UNIT(unit) ((unit)*NSIZE)
+#define UNITM1(unit) (((unit)*NSIZE)-1)
+
+#ifdef ANDROID_CHANGES
+LEAF(MEMSET_NAME,0)
+#else
+LEAF(MEMSET_NAME)
+#endif
+
+ .set nomips16
.set noreorder
+/* If the size is less than 2*NSIZE (8 or 16), go to L(lastb). Regardless of
+ size, copy dst pointer to v0 for the return value. */
+ slti t2,a2,(2 * NSIZE)
+ bne t2,zero,L(lastb)
+ move v0,a0
+
+/* If memset value is not zero, we copy it to all the bytes in a 32 or 64
+ bit word. */
+ beq a1,zero,L(set0) /* If memset value is zero no smear */
+ PTR_SUBU a3,zero,a0
+ nop
+
+ /* smear byte into 32 or 64 bit word */
+#if ((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2)
+# ifdef USE_DOUBLE
+ dins a1, a1, 8, 8 /* Replicate fill byte into half-word. */
+ dins a1, a1, 16, 16 /* Replicate fill byte into word. */
+ dins a1, a1, 32, 32 /* Replicate fill byte into dbl word. */
+# else
+ ins a1, a1, 8, 8 /* Replicate fill byte into half-word. */
+ ins a1, a1, 16, 16 /* Replicate fill byte into word. */
+# endif
+#else
+# ifdef USE_DOUBLE
+ and a1,0xff
+ dsll t2,a1,8
+ or a1,t2
+ dsll t2,a1,16
+ or a1,t2
+ dsll t2,a1,32
+ or a1,t2
+# else
+ and a1,0xff
+ sll t2,a1,8
+ or a1,t2
+ sll t2,a1,16
+ or a1,t2
+# endif
+#endif
+
+/* If the destination address is not aligned do a partial store to get it
+ aligned. If it is already aligned just jump to L(aligned). */
+L(set0):
+ andi t2,a3,(NSIZE-1) /* word-unaligned address? */
+ beq t2,zero,L(aligned) /* t2 is the unalignment count */
+ PTR_SUBU a2,a2,t2
+ C_STHI a1,0(a0)
+ PTR_ADDU a0,a0,t2
+
+L(aligned):
+/* If USE_DOUBLE is not set we may still want to align the data on a 16
+ byte boundry instead of an 8 byte boundry to maximize the opportunity
+ of proAptiv chips to do memory bonding (combining two sequential 4
+ byte stores into one 8 byte store). We know there are at least 4 bytes
+ left to store or we would have jumped to L(lastb) earlier in the code. */
+#ifdef DOUBLE_ALIGN
+ andi t2,a3,4
+ beq t2,zero,L(double_aligned)
+ PTR_SUBU a2,a2,t2
+ sw a1,0(a0)
+ PTR_ADDU a0,a0,t2
+L(double_aligned):
+#endif
- 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
+/* Now the destination is aligned to (word or double word) aligned address
+ Set a2 to count how many bytes we have to copy after all the 64/128 byte
+ chunks are copied and a3 to the dest pointer after all the 64/128 byte
+ chunks have been copied. We will loop, incrementing a0 until it equals
+ a3. */
+ andi t8,a2,NSIZEDMASK /* any whole 64-byte/128-byte chunks? */
+ beq a2,t8,L(chkw) /* if a2==t8, no 64-byte/128-byte chunks */
+ PTR_SUBU a3,a2,t8 /* subtract from a2 the reminder */
+ PTR_ADDU a3,a0,a3 /* Now a3 is the final dst after loop */
+/* When in the loop we may prefetch with the 'prepare to store' hint,
+ in this case the a0+x should not be past the "t0-32" address. This
+ means: for x=128 the last "safe" a0 address is "t0-160". Alternatively,
+ for x=64 the last "safe" a0 address is "t0-96" In the current version we
+ will use "prefetch hint,128(a0)", so "t0-160" is the limit. */
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ PTR_ADDU t0,a0,a2 /* t0 is the "past the end" address */
+ PTR_SUBU t9,t0,PREFETCH_LIMIT /* t9 is the "last safe pref" address */
+#endif
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT != PREFETCH_HINT_PREPAREFORSTORE)
+ PREFETCH_FOR_STORE (1, a0)
+ PREFETCH_FOR_STORE (2, a0)
+ PREFETCH_FOR_STORE (3, a0)
+#endif
+
+L(loop16w):
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0 /* If a0 > t9 don't use next prefetch */
+ bgtz v1,L(skip_pref)
+ nop
+#endif
+ PREFETCH_FOR_STORE (4, a0)
+ PREFETCH_FOR_STORE (5, a0)
+L(skip_pref):
+ C_ST a1,UNIT(0)(a0)
+ C_ST a1,UNIT(1)(a0)
+ C_ST a1,UNIT(2)(a0)
+ C_ST a1,UNIT(3)(a0)
+ C_ST a1,UNIT(4)(a0)
+ C_ST a1,UNIT(5)(a0)
+ C_ST a1,UNIT(6)(a0)
+ C_ST a1,UNIT(7)(a0)
+ C_ST a1,UNIT(8)(a0)
+ C_ST a1,UNIT(9)(a0)
+ C_ST a1,UNIT(10)(a0)
+ C_ST a1,UNIT(11)(a0)
+ C_ST a1,UNIT(12)(a0)
+ C_ST a1,UNIT(13)(a0)
+ C_ST a1,UNIT(14)(a0)
+ C_ST a1,UNIT(15)(a0)
+ PTR_ADDIU a0,a0,UNIT(16) /* adding 64/128 to dest */
+ bne a0,a3,L(loop16w)
+ nop
+ move a2,t8
+
+/* Here we have dest word-aligned but less than 64-bytes or 128 bytes to go.
+ Check for a 32(64) byte chunk and copy if if there is one. Otherwise
+ jump down to L(chk1w) to handle the tail end of the copy. */
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
+ andi t8,a2,NSIZEMASK /* is there a 32-byte/64-byte chunk. */
+ /* the t8 is the reminder count past 32-bytes */
+ beq a2,t8,L(chk1w)/* when a2==t8, no 32-byte chunk */
+ nop
+ C_ST a1,UNIT(0)(a0)
+ C_ST a1,UNIT(1)(a0)
+ C_ST a1,UNIT(2)(a0)
+ C_ST a1,UNIT(3)(a0)
+ C_ST a1,UNIT(4)(a0)
+ C_ST a1,UNIT(5)(a0)
+ C_ST a1,UNIT(6)(a0)
+ C_ST a1,UNIT(7)(a0)
+ PTR_ADDIU a0,a0,UNIT(8)
+
+/* Here we have less than 32(64) bytes to set. Set up for a loop to
+ copy one word (or double word) at a time. Set a2 to count how many
+ bytes we have to copy after all the word (or double word) chunks are
+ copied and a3 to the dest pointer after all the (d)word chunks have
+ been copied. We will loop, incrementing a0 until a0 equals a3. */
+L(chk1w):
+ andi a2,t8,(NSIZE-1) /* a2 is the reminder past one (d)word chunks */
+ beq a2,t8,L(lastb)
+ PTR_SUBU a3,t8,a2 /* a3 is count of bytes in one (d)word chunks */
+ PTR_ADDU a3,a0,a3 /* a3 is the dst address after loop */
+
+/* copying in words (4-byte or 8 byte chunks) */
+L(wordCopy_loop):
+ PTR_ADDIU a0,a0,UNIT(1)
+ bne a0,a3,L(wordCopy_loop)
+ C_ST a1,UNIT(-1)(a0)
+
+/* Copy the last 8 (or 16) bytes */
+L(lastb):
+ blez a2,L(leave)
+ PTR_ADDU a3,a0,a2 /* a3 is the last dst address */
+L(lastbloop):
+ PTR_ADDIU a0,a0,1
+ bne a0,a3,L(lastbloop)
+ sb a1,-1(a0)
+L(leave):
+ j ra
nop
+ .set at
.set reorder
-END (memset)
-libc_hidden_builtin_def (memset)
+END(MEMSET_NAME)
+#ifndef ANDROID_CHANGES
+# ifdef _LIBC
+libc_hidden_builtin_def (MEMSET_NAME)
+# endif
+#endif
diff --git a/libc/ports/sysdeps/mips/mips32/fpu/e_sqrt.c b/libc/ports/sysdeps/mips/mips32/fpu/e_sqrt.c
new file mode 100644
index 000000000..81f4e7769
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips32/fpu/e_sqrt.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrt.c>
diff --git a/libc/ports/sysdeps/mips/mips32/fpu/e_sqrtf.c b/libc/ports/sysdeps/mips/mips32/fpu/e_sqrtf.c
new file mode 100644
index 000000000..fb0700d45
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips32/fpu/e_sqrtf.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrtf.c>
diff --git a/libc/ports/sysdeps/mips/mips64/memset.S b/libc/ports/sysdeps/mips/mips64/memset.S
deleted file mode 100644
index 645333526..000000000
--- a/libc/ports/sysdeps/mips/mips64/memset.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2002-2013 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-
-/* void *memset(void *s, int c, size_t n);
-
- This could probably be optimized further. */
-
-#if __MIPSEB
-# 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/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrt.c b/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrt.c
new file mode 100644
index 000000000..81f4e7769
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrt.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrt.c>
diff --git a/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c b/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c
new file mode 100644
index 000000000..fb0700d45
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrtf.c>
diff --git a/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrt.c b/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrt.c
new file mode 100644
index 000000000..81f4e7769
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrt.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrt.c>
diff --git a/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c b/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c
new file mode 100644
index 000000000..fb0700d45
--- /dev/null
+++ b/libc/ports/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c
@@ -0,0 +1 @@
+#include <sysdeps/mips/fpu/e_sqrtf.c>
diff --git a/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h
index 9cfd6fbb7..5be50927d 100644
--- a/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h
+++ b/libc/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h
@@ -24,15 +24,25 @@
#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)
-#define _FP_NANFRAC_D (_FP_QNANBIT_D - 1)
-#define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1
+#ifdef __mips_nan2008
+# 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
+#else
+# define _FP_NANFRAC_S (_FP_QNANBIT_S - 1)
+# define _FP_NANFRAC_D (_FP_QNANBIT_D - 1)
+# define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1
+#endif
#define _FP_NANSIGN_S 0
#define _FP_NANSIGN_D 0
#define _FP_NANSIGN_Q 0
#define _FP_KEEPNANFRACP 1
-#define _FP_QNANNEGATEDP 1
+#ifdef __mips_nan2008
+# define _FP_QNANNEGATEDP 0
+#else
+# define _FP_QNANNEGATEDP 1
+#endif
/* From my experiments it seems X is chosen unless one of the
NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
diff --git a/libc/ports/sysdeps/mips/shlib-versions b/libc/ports/sysdeps/mips/shlib-versions
index 780939369..b153732c2 100644
--- a/libc/ports/sysdeps/mips/shlib-versions
+++ b/libc/ports/sysdeps/mips/shlib-versions
@@ -3,7 +3,11 @@ mips.*-.*-linux.* libm=6 GLIBC_2.0 GLIBC_2.2
# Working mips versions were never released between 2.0 and 2.2.
mips.*-.*-linux.* libc=6 GLIBC_2.0 GLIBC_2.2
+%ifdef HAVE_MIPS_NAN2008
+mips.*-.*-linux.* ld=ld-linux-mipsn8.so.1 GLIBC_2.0 GLIBC_2.2
+%else
mips.*-.*-linux.* ld=ld.so.1 GLIBC_2.0 GLIBC_2.2
+%endif
mips.*-.*-linux.* libdl=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libresolv=2 GLIBC_2.0 GLIBC_2.2
diff --git a/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h b/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h
index a60bef766..fff3b3c61 100644
--- a/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h
+++ b/libc/ports/sysdeps/mips/soft-fp/sfp-machine.h
@@ -21,15 +21,25 @@
#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)
-#define _FP_NANFRAC_D (_FP_QNANBIT_D - 1), -1
-#define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1, -1, -1
+#ifdef __mips_nan2008
+# 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
+#else
+# define _FP_NANFRAC_S (_FP_QNANBIT_S - 1)
+# define _FP_NANFRAC_D (_FP_QNANBIT_D - 1), -1
+# define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1, -1, -1
+#endif
#define _FP_NANSIGN_S 0
#define _FP_NANSIGN_D 0
#define _FP_NANSIGN_Q 0
#define _FP_KEEPNANFRACP 1
-#define _FP_QNANNEGATEDP 1
+#ifdef __mips_nan2008
+# define _FP_QNANNEGATEDP 0
+#else
+# define _FP_QNANNEGATEDP 1
+#endif
/* From my experiments it seems X is chosen unless one of the
NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/Makefile b/libc/ports/sysdeps/powerpc/powerpc32/Makefile
deleted file mode 100644
index 3d235deeb..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# Some Powerpc32 variants assume soft-fp is the default even though there is
-# an fp variant so provide -mhard-float if --with-fp is explicitly passed.
-
-ifeq ($(with-fp),yes)
-+cflags += -mhard-float
-ASFLAGS += -mhard-float
-sysdep-LDFLAGS += -mhard-float
-endif
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile
deleted file mode 100644
index 3e7c9e92f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-ifeq ($(subdir),stdlib)
-spepim_routines = atosfix16 atosfix32 atosfix64 atoufix16 atoufix32 atoufix64 \
- strtosfix16 strtosfix32 strtosfix64 strtoufix16 strtoufix32 strtoufix64
-sysdep_routines += $(spepim_routines)
-tests += tst-spepim
-ifeq ($(build-shared),yes)
-$(objpfx)tst-spepim: $(common-objpfx)math/libm.so$(libm.so-version)
-else
-$(objpfx)tst-spepim: $(common-objpfx)math/libm.a
-endif
-endif
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions
deleted file mode 100644
index bd45e1dab..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions
+++ /dev/null
@@ -1,8 +0,0 @@
-libc {
- GLIBC_2.3.3 {
- atosfix16; atosfix32; atosfix64;
- atoufix16; atoufix32; atoufix64;
- strtosfix16; strtosfix32; strtosfix64;
- strtoufix16; strtoufix32; strtoufix64;
- }
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S
deleted file mode 100644
index fbbee6023..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S
+++ /dev/null
@@ -1,107 +0,0 @@
-/* longjmp for PowerPC E500.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
- Contributed by Aldy Hernandez <aldyh@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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#ifdef __NO_VMX__
-# include <novmxsetjmp.h>
-#else
-# include <jmpbuf-offsets.h>
-#endif
-
-ENTRY (__longjmp)
-#if defined PTR_DEMANGLE || defined CHECK_SP
- lwz r24,(JB_GPR1*4)(r3)
-# ifdef CHECK_SP
-# ifdef PTR_DEMANGLE
- PTR_DEMANGLE3 (r24, r24, r25)
-# endif
- CHECK_SP (r24)
- mr r1,r24
-# endif
-#else
- lwz r1,(JB_GPR1*4)(r3)
-#endif
- lwz r0,(JB_LR*4)(r3)
- /*lfd fp14,((JB_FPRS+0*2)*4)(r3)*/
- evldd r14,((JB_FPRS+0*2)*4)(r3)
- lwz r14,((JB_GPRS+0)*4)(r3)
- /*lfd fp15,((JB_FPRS+1*2)*4)(r3)*/
- evldd r15,((JB_FPRS+1*2)*4)(r3)
- lwz r15,((JB_GPRS+1)*4)(r3)
- /*lfd fp16,((JB_FPRS+2*2)*4)(r3)*/
- evldd r16,((JB_FPRS+2*2)*4)(r3)
- lwz r16,((JB_GPRS+2)*4)(r3)
- /*lfd fp17,((JB_FPRS+3*2)*4)(r3)*/
- evldd r17,((JB_FPRS+3*2)*4)(r3)
- lwz r17,((JB_GPRS+3)*4)(r3)
- /*lfd fp18,((JB_FPRS+4*2)*4)(r3)*/
- evldd r18,((JB_FPRS+4*2)*4)(r3)
- lwz r18,((JB_GPRS+4)*4)(r3)
- /*lfd fp19,((JB_FPRS+5*2)*4)(r3)*/
- evldd r19,((JB_FPRS+5*2)*4)(r3)
- lwz r19,((JB_GPRS+5)*4)(r3)
- /*lfd fp20,((JB_FPRS+6*2)*4)(r3)*/
- evldd r20,((JB_FPRS+6*2)*4)(r3)
- lwz r20,((JB_GPRS+6)*4)(r3)
-#ifdef PTR_DEMANGLE
-# ifndef CHECK_SP
- PTR_DEMANGLE3 (r1, r24, r25)
-# endif
- PTR_DEMANGLE2 (r0, r25)
-#endif
- mtlr r0
- /*lfd fp21,((JB_FPRS+7*2)*4)(r3)*/
- evldd r21,((JB_FPRS+7*2)*4)(r3)
- lwz r21,((JB_GPRS+7)*4)(r3)
- /*lfd fp22,((JB_FPRS+8*2)*4)(r3)*/
- evldd r22,((JB_FPRS+8*2)*4)(r3)
- lwz r22,((JB_GPRS+8)*4)(r3)
- lwz r0,(JB_CR*4)(r3)
- /*lfd fp23,((JB_FPRS+9*2)*4)(r3)*/
- evldd r23,((JB_FPRS+9*2)*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
- /*lfd fp24,((JB_FPRS+10*2)*4)(r3)*/
- evldd r24,((JB_FPRS+10*2)*4)(r3)
- lwz r24,((JB_GPRS+10)*4)(r3)
- /*lfd fp25,((JB_FPRS+11*2)*4)(r3)*/
- evldd r25,((JB_FPRS+11*2)*4)(r3)
- lwz r25,((JB_GPRS+11)*4)(r3)
- mtcrf 0xFF,r0
- /*lfd fp26,((JB_FPRS+12*2)*4)(r3)*/
- evldd r26,((JB_FPRS+12*2)*4)(r3)
- lwz r26,((JB_GPRS+12)*4)(r3)
- /*lfd fp27,((JB_FPRS+13*2)*4)(r3)*/
- evldd r27,((JB_FPRS+13*2)*4)(r3)
- lwz r27,((JB_GPRS+13)*4)(r3)
- /*lfd fp28,((JB_FPRS+14*2)*4)(r3)*/
- evldd r28,((JB_FPRS+14*2)*4)(r3)
- lwz r28,((JB_GPRS+14)*4)(r3)
- /*lfd fp29,((JB_FPRS+15*2)*4)(r3)*/
- evldd r29,((JB_FPRS+15*2)*4)(r3)
- lwz r29,((JB_GPRS+15)*4)(r3)
- /*lfd fp30,((JB_FPRS+16*2)*4)(r3)*/
- evldd r30,((JB_FPRS+16*2)*4)(r3)
- lwz r30,((JB_GPRS+16)*4)(r3)
- /*lfd fp31,((JB_FPRS+17*2)*4)(r3)*/
- evldd r31,((JB_FPRS+17*2)*4)(r3)
- lwz r31,((JB_GPRS+17)*4)(r3)
- mr r3,r4
- blr
-END (__longjmp)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S
deleted file mode 100644
index 54d0c4b5a..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* AltiVec/VMX (new) version of __longjmp for PowerPC.
- Copyright (C) 1995-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <libc-symbols.h>
-#include <shlib-compat.h>
-
-#if defined NOT_IN_libc
-/* Build a non-versioned object for rtld-*. */
-# include "__longjmp-common.S"
-
-#else /* !NOT_IN_libc */
-strong_alias (__vmx__longjmp, __longjmp);
-# define __longjmp __vmx__longjmp
-# include "__longjmp-common.S"
-
-# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-# define __NO_VMX__
-# undef JB_SIZE
-# undef __longjmp
-# define __longjmp __novmx__longjmp
-# include "__longjmp-common.S"
-# endif
-#endif /* !NOT_IN_libc */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c
deleted file mode 100644
index 112c1b303..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 16-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-#include <spe.h>
-
-int16_t
-atosfix16 (const char *str)
-{
- return strtosfix16 (str, NULL);
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c
deleted file mode 100644
index 274b642da..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 64-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-#include <spe.h>
-
-int64_t
-atosfix64 (const char *str)
-{
- return strtosfix64 (str, NULL);
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c
deleted file mode 100644
index 111735485..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 16-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-#include <spe.h>
-
-uint16_t
-atoufix16 (const char *str)
-{
- return strtoufix16 (str, NULL);
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c
deleted file mode 100644
index de0f15f08..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 32-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-#include <spe.h>
-
-uint32_t
-atoufix32 (const char *str)
-{
- return strtoufix32 (str, NULL);
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c
deleted file mode 100644
index b4abaae0f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 64-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-#include <spe.h>
-
-uint64_t
-atoufix64 (const char *str)
-{
- return strtoufix64 (str, NULL);
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c
deleted file mode 100644
index bdbeff477..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/e_sqrt.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c
deleted file mode 100644
index 8b2f552e1..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/e_sqrtf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c
deleted file mode 100644
index bf5ed73b2..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Procedure definition for FE_NOMASK_ENV.
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <fenv.h>
-#include <errno.h>
-
-/* This is presently a stub, until it's decided how the kernels should
- support this. */
-
-const fenv_t *
-__fe_nomask_env(void)
-{
- __set_errno (ENOSYS);
- return FE_ENABLED_ENV;
-}
-stub_warning (__fe_nomask_env)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h
deleted file mode 100644
index e99166bfc..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h
deleted file mode 100644
index 4909535f8..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Bypass sysdeps/powerpc/fpu/math_private.h and use generic header. */
-#include <../sysdeps/generic/math_private.h>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c
deleted file mode 100644
index f3f34216f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_ceil.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c
deleted file mode 100644
index 2a71fcd7c..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_ceilf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c
deleted file mode 100644
index 8616ca0bb..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_copysign.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c
deleted file mode 100644
index 34bcb6cce..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_copysignf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c
deleted file mode 100644
index 29a02868f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/ldbl-128ibm/s_copysignl.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c
deleted file mode 100644
index 2ef531d44..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_fabs.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c
deleted file mode 100644
index 33ebe78cb..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/ldbl-128ibm/s_fabsl.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c
deleted file mode 100644
index 5fb35edb5..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fdim.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c
deleted file mode 100644
index 42df1302d..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fdimf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c
deleted file mode 100644
index 2a43c817c..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_floor.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c
deleted file mode 100644
index d129d378f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_floorf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c
deleted file mode 100644
index 2ee721413..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#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/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c
deleted file mode 100644
index 5b7663f9a..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fmaf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c
deleted file mode 100644
index 95edd5f3d..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fmax.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c
deleted file mode 100644
index 084fe72e9..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fmaxf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c
deleted file mode 100644
index e072a91e7..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fmin.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c
deleted file mode 100644
index e37e4ac4e..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/s_fminf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c
deleted file mode 100644
index dec5dd0bf..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_isnan.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c
deleted file mode 100644
index 3be64a220..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_isnanf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c
deleted file mode 100644
index c8215aa17..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_llrint.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c
deleted file mode 100644
index b74275e9c..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_llrintf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c
deleted file mode 100644
index 69658f335..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_llround.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c
deleted file mode 100644
index 386777ea9..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_llroundf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c
deleted file mode 100644
index 909e699a0..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_lrint.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S
deleted file mode 100644
index 3d399a08e..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Round float to long int. PowerPC E500 version.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-ENTRY(__lrintf)
-/* long int [r3] lrintf (float [r3] x) ; */
- efsctsi r3,r3
- blr
-END(__lrintf)
-
-weak_alias(__lrintf,lrintf)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c
deleted file mode 100644
index 83a87836b..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_lround.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c
deleted file mode 100644
index 930abb527..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_lroundf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyint.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyint.c
deleted file mode 100644
index a8b7973ac..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyint.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#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/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyintf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyintf.c
deleted file mode 100644
index 487742619..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_nearbyintf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_nearbyintf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c
deleted file mode 100644
index b610359d3..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_rint.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c
deleted file mode 100644
index 6593140fa..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_rintf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c
deleted file mode 100644
index 4c006d482..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_round.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c
deleted file mode 100644
index e82d90aa1..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_roundf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c
deleted file mode 100644
index bc5ec5401..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/dbl-64/s_trunc.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c
deleted file mode 100644
index b8cc5f6bc..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/ieee754/flt-32/s_truncf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S
deleted file mode 100644
index bba304375..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S
+++ /dev/null
@@ -1,103 +0,0 @@
-/* setjmp for PowerPC E500.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
- Contributed by Aldy Hernandez <aldyh@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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ASM
-#ifdef __NO_VMX__
-# include <novmxsetjmp.h>
-#else
-# include <jmpbuf-offsets.h>
-#endif
-
-ENTRY (__sigsetjmp)
-#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
- /*stfd fp14,((JB_FPRS+0*2)*4)(3)*/
- evstdd r14,((JB_FPRS+0*2)*4)(3)
- stw r0,(JB_LR*4)(3)
- stw r15,((JB_GPRS+1)*4)(3)
- /*stfd fp15,((JB_FPRS+1*2)*4)(3)*/
- evstdd r15,((JB_FPRS+1*2)*4)(3)
- mfcr r0
- stw r16,((JB_GPRS+2)*4)(3)
- /*stfd fp16,((JB_FPRS+2*2)*4)(3)*/
- evstdd r16,((JB_FPRS+2*2)*4)(3)
- stw r0,(JB_CR*4)(3)
- stw r17,((JB_GPRS+3)*4)(3)
- /*stfd fp17,((JB_FPRS+3*2)*4)(3)*/
- evstdd r17,((JB_FPRS+3*2)*4)(3)
- stw r18,((JB_GPRS+4)*4)(3)
- /*stfd fp18,((JB_FPRS+4*2)*4)(3)*/
- evstdd r18,((JB_FPRS+4*2)*4)(3)
- stw r19,((JB_GPRS+5)*4)(3)
- /*stfd fp19,((JB_FPRS+5*2)*4)(3)*/
- evstdd r19,((JB_FPRS+5*2)*4)(3)
- stw r20,((JB_GPRS+6)*4)(3)
- /*stfd fp20,((JB_FPRS+6*2)*4)(3)*/
- evstdd r20,((JB_FPRS+6*2)*4)(3)
- stw r21,((JB_GPRS+7)*4)(3)
- /*stfd fp21,((JB_FPRS+7*2)*4)(3)*/
- evstdd r21,((JB_FPRS+7*2)*4)(3)
- stw r22,((JB_GPRS+8)*4)(3)
- /*stfd fp22,((JB_FPRS+8*2)*4)(3)*/
- evstdd r22,((JB_FPRS+8*2)*4)(3)
- stw r23,((JB_GPRS+9)*4)(3)
- /*stfd fp23,((JB_FPRS+9*2)*4)(3)*/
- evstdd r23,((JB_FPRS+9*2)*4)(3)
- stw r24,((JB_GPRS+10)*4)(3)
- /*stfd fp24,((JB_FPRS+10*2)*4)(3)*/
- evstdd r24,((JB_FPRS+10*2)*4)(3)
- stw r25,((JB_GPRS+11)*4)(3)
- /*stfd fp25,((JB_FPRS+11*2)*4)(3)*/
- evstdd r25,((JB_FPRS+11*2)*4)(3)
- stw r26,((JB_GPRS+12)*4)(3)
- /*stfd fp26,((JB_FPRS+12*2)*4)(3)*/
- evstdd r26,((JB_FPRS+12*2)*4)(3)
- stw r27,((JB_GPRS+13)*4)(3)
- /*stfd fp27,((JB_FPRS+13*2)*4)(3)*/
- evstdd r27,((JB_FPRS+13*2)*4)(3)
- stw r28,((JB_GPRS+14)*4)(3)
- /*stfd fp28,((JB_FPRS+14*2)*4)(3)*/
- evstdd r28,((JB_FPRS+14*2)*4)(3)
- stw r29,((JB_GPRS+15)*4)(3)
- /*stfd fp29,((JB_FPRS+15*2)*4)(3)*/
- evstdd r29,((JB_FPRS+15*2)*4)(3)
- stw r30,((JB_GPRS+16)*4)(3)
- /*stfd fp30,((JB_FPRS+16*2)*4)(3)*/
- evstdd r30,((JB_FPRS+16*2)*4)(3)
- stw r31,((JB_GPRS+17)*4)(3)
- /*stfd fp31,((JB_FPRS+17*2)*4)(3)*/
- evstdd r31,((JB_FPRS+17*2)*4)(3)
-#if defined NOT_IN_libc && defined IS_IN_rtld
- li r3,0
- blr
-#else
- b __sigjmp_save@local
-#endif
-END (__sigsetjmp)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S
deleted file mode 100644
index 851a5b908..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* non alitivec (old) version of setjmp for PowerPC.
- Copyright (C) 1995-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <shlib-compat.h>
-#include <libc-symbols.h>
-
-#if defined NOT_IN_libc
-/* Build a non-versioned object for rtld-*. */
-# include "setjmp-common.S"
-
-#else /* !NOT_IN_libc */
-/* Build a versioned object for libc. */
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
-# define __sigsetjmp __vmx__sigsetjmp
-# define __sigjmp_save __vmx__sigjmp_save
-# include "setjmp-common.S"
-
-# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-# define __NO_VMX__
-# undef __sigsetjmp
-# undef __sigjmp_save
-# undef JB_SIZE
-symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
-# define __sigsetjmp __novmx__sigsetjmp
-# define __sigjmp_save __novmx__sigjmp_save
-# include "setjmp-common.S"
-# endif
-#endif /* !NOT_IN_libc */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/spe.h b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/spe.h
deleted file mode 100644
index 91bca2710..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/spe.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _SPE_H
-
-#include_next <spe.h>
-
-libc_hidden_proto (strtosfix16)
-libc_hidden_proto (strtosfix32)
-libc_hidden_proto (strtosfix64)
-libc_hidden_proto (strtoufix16)
-libc_hidden_proto (strtoufix32)
-libc_hidden_proto (strtoufix64)
-
-#endif
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c
deleted file mode 100644
index e04e5be40..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/* Convert string representing a number to float value, using given locale.
- Copyright (C) 1997-2013 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, see
- <http://www.gnu.org/licenses/>. */
-
-/* Cut down from strtod_l.c for converting to fixed-point, no locale
- choice, no grouping, narrow strings only. */
-
-
-#include <ctype.h>
-#include <errno.h>
-#include <fenv_libc.h>
-#include <locale/localeinfo.h>
-#include <locale.h>
-#include <math.h>
-#include <spe.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* The gmp headers need some configuration frobs. */
-#define HAVE_ALLOCA 1
-
-/* Include gmp-mparam.h first, such that definitions of _SHORT_LIMB
- and _LONG_LONG_LIMB in it can take effect into gmp.h. */
-#include <gmp-mparam.h>
-#include <gmp.h>
-#include <stdlib/gmp-impl.h>
-#include <stdlib/longlong.h>
-#include <stdlib/fpioconst.h>
-
-/*#define NDEBUG 1*/
-#include <assert.h>
-
-#if UNSIGNED
-#define RETURN_FRAC_BITS RETURN_TYPE_BITS
-#else
-#define RETURN_FRAC_BITS (RETURN_TYPE_BITS - 1)
-#endif
-
-#define RETURN(val,end) \
- do { if (endptr != NULL) *endptr = (char *) (end); \
- return val; } while (0)
-
-/* Definitions according to limb size used. */
-#if BITS_PER_MP_LIMB == 32
-# define MAX_DIG_PER_LIMB 9
-# define MAX_FAC_PER_LIMB 1000000000UL
-#elif BITS_PER_MP_LIMB == 64
-# define MAX_DIG_PER_LIMB 19
-# define MAX_FAC_PER_LIMB 10000000000000000000ULL
-#else
-# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
-#endif
-
-/* Local data structure. */
-static const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
-{ 0, 10, 100,
- 1000, 10000, 100000L,
- 1000000L, 10000000L, 100000000L,
- 1000000000L
-#if BITS_PER_MP_LIMB > 32
- , 10000000000ULL, 100000000000ULL,
- 1000000000000ULL, 10000000000000ULL, 100000000000000ULL,
- 1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL,
- 1000000000000000000ULL, 10000000000000000000ULL
-#endif
-#if BITS_PER_MP_LIMB > 64
- #error "Need to expand tens_in_limb table to" MAX_DIG_PER_LIMB
-#endif
-};
-
-/* Define pow5 to be 5^(RETURN_FRAC_BITS + 1), shifted left so the
- most significant bit is set (as required by mpn_divrem), pow5size
- to be the size in limbs and pow5shift to be the shift. */
-#if RETURN_FRAC_BITS + 1 == 16
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0x04000000, 0x8e1bc9bf };
-# define pow5shift 26
-# define pow5size 2
-# else
-static const mp_limb_t pow5[] = { 0x8e1bc9bf04000000ull };
-# define pow5shift 26
-# define pow5size 1
-# endif
-#elif RETURN_FRAC_BITS + 1 == 17
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0xc5000000, 0xb1a2bc2e };
-# define pow5shift 24
-# define pow5size 2
-# else
-static const mp_limb_t pow5[] = { 0xb1a2bc2ec5000000ull };
-# define pow5shift 24
-# define pow5size 1
-# endif
-#elif RETURN_FRAC_BITS + 1 == 32
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0xf0200000, 0x2b70b59d, 0x9dc5ada8 };
-# define pow5shift 21
-# define pow5size 3
-# else
-static const mp_limb_t pow5[] = { 0xf020000000000000ull, 0x9dc5ada82b70b59dull };
-# define pow5shift 53
-# define pow5size 2
-# endif
-#elif RETURN_FRAC_BITS + 1 == 33
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0x6c280000, 0x364ce305, 0xc5371912 };
-# define pow5shift 19
-# define pow5size 3
-# else
-static const mp_limb_t pow5[] = { 0x6c28000000000000ull, 0xc5371912364ce305ull };
-# define pow5shift 51
-# define pow5size 2
-# endif
-#elif RETURN_FRAC_BITS + 1 == 64
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0x50f80800, 0xc76b25fb, 0x3cbf6b71, 0xffcfa6d5, 0xc2781f49 };
-# define pow5shift 11
-# define pow5size 5
-# else
-static const mp_limb_t pow5[] = { 0x50f8080000000000ull, 0x3cbf6b71c76b25fbull, 0xc2781f49ffcfa6d5ull };
-# define pow5shift 43
-# define pow5size 3
-# endif
-#elif RETURN_FRAC_BITS + 1 == 65
-# if BITS_PER_MP_LIMB == 32
-static const mp_limb_t pow5[] = { 0x25360a00, 0x3945ef7a, 0x8bef464e, 0x7fc3908a, 0xf316271c };
-# define pow5shift 9
-# define pow5size 5
-# else
-static const mp_limb_t pow5[] = { 0x25360a0000000000ull, 8bef464e3945ef7aull, 0xf316271c7fc3908aull };
-# define pow5shift 41
-# define pow5size 3
-# endif
-#else
-# error "Unknown RETURN_FRAC_BITS value."
-#endif
-
-/* Read a multi-precision integer starting at STR with exactly DIGCNT digits
- into N. Return the size of the number limbs in NSIZE. */
-static void
-str_to_mpn (const char *str, int digcnt, mp_limb_t *n, mp_size_t *nsize)
-{
- /* Number of digits for actual limb. */
- int cnt = 0;
- mp_limb_t low = 0;
- mp_limb_t start;
-
- *nsize = 0;
- assert (digcnt > 0);
- do
- {
- if (cnt == MAX_DIG_PER_LIMB)
- {
- if (*nsize == 0)
- {
- n[0] = low;
- *nsize = 1;
- }
- else
- {
- mp_limb_t cy;
- cy = __mpn_mul_1 (n, n, *nsize, MAX_FAC_PER_LIMB);
- cy += __mpn_add_1 (n, n, *nsize, low);
- if (cy != 0)
- {
- n[*nsize] = cy;
- ++(*nsize);
- }
- }
- cnt = 0;
- low = 0;
- }
-
- low = low * 10 + *str++ - '0';
- ++cnt;
- }
- while (--digcnt > 0);
-
- start = _tens_in_limb[cnt];
-
- if (*nsize == 0)
- {
- n[0] = low;
- *nsize = 1;
- }
- else
- {
- mp_limb_t cy;
- cy = __mpn_mul_1 (n, n, *nsize, start);
- cy += __mpn_add_1 (n, n, *nsize, low);
- if (cy != 0)
- n[(*nsize)++] = cy;
- }
-}
-
-/* Round a fixed point number according to the current rounding mode
- and set its sign. VAL is the initial part of the number
- (RETURN_TYPE_BITS for unsigned, one fewer for signed; values equal
- to -1.0 do not come here). SIGN is 1 for negative, 0 for positive;
- this function will not be called for negative numbers in the
- unsigned case. HALF is 1 if the next bit is 1; REST is 1 if any of
- the subsequent bits are 1. */
-static RETURN_TYPE
-round_and_set_sign (RETURN_TYPE val, int sign, int half, int rest)
-{
- int incr = 0;
- unsigned int mode = fegetenv_register ();
- mode &= 3;
- switch (mode)
- {
- case FE_TONEAREST:
- incr = (half && (rest || (val & 1)));
- break;
- case FE_TOWARDZERO:
- break;
- case FE_UPWARD:
- incr = (!sign && (half || rest));
- break;
- case FE_DOWNWARD:
- incr = (sign && (half || rest));
- break;
- }
- if (incr)
- {
- if (val == SAT_MAX)
- {
- if (sign)
- val = SAT_MIN;
- else
- {
- __set_errno (ERANGE);
- return SAT_MAX;
- }
- }
- else
- {
- val++;
- if (sign)
- val = -val;
- }
- }
- else if (sign)
- val = -val;
- return val;
-}
-
-/* Return a fixed point number with the value of the given string
- NPTR, handling out-of-range numbers as described in the SPE PIM.
- Set *ENDPTR to the character after the last used one. */
-RETURN_TYPE
-STRTOFIX (const char *nptr, char **endptr)
-{
- int negative; /* The sign of the number. */
- int exponent; /* Exponent of the number. */
-
- /* Numbers starting `0X' or `0x' have to be processed with base 16. */
- int base = 10;
-
- /* Running pointer after the last character processed in the string. */
- const char *cp;
- /* Start of significant part of the number. */
- const char *startp, *start_of_digits;
- /* Points at the character following the integer and fractional digits. */
- const char *expp;
- /* Total number of digit and number of digits in integer part. */
- int dig_no, int_no, lead_zero;
- /* Contains the last character read. */
- char c;
-
- /* The radix character of the current locale. */
- const char *decimal;
- size_t decimal_len;
- /* Used in several places. */
- int cnt;
-
- decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
- decimal_len = strlen (decimal);
- assert (decimal_len > 0);
-
- /* Prepare number representation. */
- exponent = 0;
- negative = 0;
-
- /* Parse string to get maximal legal prefix. We need the number of
- characters of the integer part, the fractional part and the exponent. */
- cp = nptr - 1;
- /* Ignore leading white space. */
- do
- c = *++cp;
- while (isspace (c));
-
- /* Get sign of the result. */
- if (c == '-')
- {
- negative = 1;
- c = *++cp;
- }
- else if (c == '+')
- c = *++cp;
-
- /* Return 0.0 if no legal string is found.
- No character is used even if a sign was found. */
- for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
- if (cp[cnt] != decimal[cnt])
- break;
- if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9')
- {
- /* We accept it. This funny construct is here only to indent
- the code directly. */
- }
- else if (c < '0' || c > '9')
- {
- /* The SPE PIM says NaN and Inf are not supported. */
- /* It is really a text we do not recognize. */
- RETURN (0, nptr);
- }
-
- /* First look whether we are faced with a hexadecimal number. */
- if (c == '0' && tolower (cp[1]) == 'x')
- {
- /* Okay, it is a hexa-decimal number. Remember this and skip
- the characters. BTW: hexadecimal numbers must not be
- grouped. */
- base = 16;
- cp += 2;
- c = *cp;
- }
-
- /* Record the start of the digits, in case we will check their grouping. */
- start_of_digits = startp = cp;
-
- /* Ignore leading zeroes. This helps us to avoid useless computations. */
- while (c == '0')
- c = *++cp;
-
- /* If no other digit but a '0' is found the result is 0.0.
- Return current read pointer. */
- if ((c < '0' || c > '9')
- && (base != 16 || (c < (char) tolower ('a')
- || c > (char) tolower ('f')))
- && ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
- if (decimal[cnt] != cp[cnt])
- break;
- decimal[cnt] != '\0'; })
- && (base != 16 || (cp == start_of_digits
- || (char) tolower (c) != 'p'))
- && (base == 16 || (char) tolower (c) != 'e'))
- {
- /* If CP is at the start of the digits, there was no correctly
- grouped prefix of the string; so no number found. */
- RETURN (0, cp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : cp);
- }
-
- /* Remember first significant digit and read following characters until the
- decimal point, exponent character or any non-FP number character. */
- startp = cp;
- dig_no = 0;
- while (1)
- {
- if ((c >= '0' && c <= '9')
- || (base == 16 && tolower (c) >= 'a'
- && tolower (c) <= 'f'))
- ++dig_no;
- else
- {
- break;
- }
- c = *++cp;
- }
-
- /* We have the number digits in the integer part. Whether these are all or
- any is really a fractional digit will be decided later. */
- int_no = dig_no;
- lead_zero = int_no == 0 ? -1 : 0;
-
- /* Read the fractional digits. A special case are the 'american style'
- numbers like `16.' i.e. with decimal but without trailing digits. */
- if (
- ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
- if (decimal[cnt] != cp[cnt])
- break;
- decimal[cnt] == '\0'; })
- )
- {
- cp += decimal_len;
- c = *cp;
- while ((c >= '0' && c <= '9') ||
- (base == 16 && tolower (c) >= 'a' && tolower (c) <= 'f'))
- {
- if (c != '0' && lead_zero == -1)
- lead_zero = dig_no - int_no;
- ++dig_no;
- c = *++cp;
- }
- }
-
- /* For numbers like "0x." with no hex digits, only the "0" is valid. */
- if (base == 16
- && startp == start_of_digits
- && dig_no == 0)
- RETURN (0, start_of_digits - 1);
-
- /* Remember start of exponent (if any). */
- expp = cp;
-
- /* Read exponent. */
- if ((base == 16 && tolower (c) == 'p')
- || (base != 16 && tolower (c) == 'e'))
- {
- int exp_negative = 0;
-
- c = *++cp;
- if (c == '-')
- {
- exp_negative = 1;
- c = *++cp;
- }
- else if (c == '+')
- c = *++cp;
-
- if (c >= '0' && c <= '9')
- {
- int exp_limit;
-
- /* Get the exponent limit. */
- if (base == 16)
- exp_limit = (exp_negative ?
- RETURN_TYPE_BITS + 4 * int_no :
- 4 - 4 * int_no + 4 * lead_zero);
- else
- exp_limit = (exp_negative ?
- (RETURN_TYPE_BITS + 2) / 3 + int_no :
- 1 - int_no + lead_zero);
-
- do
- {
- exponent *= 10;
-
- if (exponent > exp_limit)
- /* The exponent is too large/small to represent a valid
- number. */
- {
- RETURN_TYPE result;
-
- /* Accept all following digits as part of the exponent. */
- do
- ++cp;
- while (*cp >= '0' && *cp <= '9');
-
- /* We have to take care for special situation: a joker
- might have written "0.0e100000" which is in fact
- zero. */
- if (lead_zero == -1)
- result = 0;
-#if UNSIGNED
- else if (negative)
- {
- /* Saturate to 0. */
- __set_errno (ERANGE);
- result = SAT_MIN;
- }
-#endif
- else if (exp_negative)
- {
- /* Round to either 0 or smallest value. */
- result = round_and_set_sign (0, negative, 0, 1);
- }
- else
- {
- /* Overflow. */
- __set_errno (ERANGE);
- result = (negative ? SAT_MIN : SAT_MAX);
- }
-
- RETURN (result, cp);
- /* NOTREACHED */
- }
-
- exponent += c - '0';
- c = *++cp;
- }
- while (c >= '0' && c <= '9');
-
- if (exp_negative)
- exponent = -exponent;
- }
- else
- cp = expp;
- }
-
- /* We don't want to have to work with trailing zeroes after the radix. */
- if (dig_no > int_no)
- {
- while (expp[-1] == '0')
- {
- --expp;
- --dig_no;
- }
- assert (dig_no >= int_no);
- }
-
- if (dig_no == int_no && dig_no > 0)
- do
- {
- while (! (base == 16 ? isxdigit (expp[-1]) : isdigit (expp[-1])))
- --expp;
-
- if (expp[-1] != '0')
- break;
-
- --expp;
- --dig_no;
- --int_no;
- exponent += (base == 16 ? 4 : 1);
- }
- while (dig_no > 0);
-
- /* The whole string is parsed. Store the address of the next character. */
- if (endptr)
- *endptr = (char *) cp;
-
- if (dig_no == 0)
- return 0;
-
-#if UNSIGNED
- if (negative)
- {
- /* Saturate to 0. */
- __set_errno (ERANGE);
- return SAT_MIN;
- }
-#endif
-
- if (lead_zero)
- {
- /* Find the decimal point */
- while (1)
- {
- if (*startp == decimal[0])
- {
- for (cnt = 1; decimal[cnt] != '\0'; ++cnt)
- if (decimal[cnt] != startp[cnt])
- break;
- if (decimal[cnt] == '\0')
- break;
- }
- ++startp;
- }
- startp += lead_zero + decimal_len;
- exponent -= base == 16 ? 4 * lead_zero : lead_zero;
- dig_no -= lead_zero;
- }
-
- /* Normalize the exponent so that all digits can be considered to
- start just after the point. */
- exponent += base == 16 ? 4 * int_no : int_no;
-
- if (exponent > (base == 16 ? 4 : 1))
- {
- /* Overflow. */
- __set_errno (ERANGE);
- return (negative ? SAT_MIN : SAT_MAX);
- }
-
- /* Copy just the digits needed to a separate buffer. */
- int digits_needed = (base == 16 ? RETURN_TYPE_BITS / 4 + 2 : RETURN_FRAC_BITS + 1);
- char buf[RETURN_TYPE_BITS + 1];
- int digits_copied = 0;
- int extra = 0;
- int rdigno = dig_no;
- while (exponent < 0)
- {
- buf[digits_copied++] = '0';
- exponent += (base == 16 ? 4 : 1);
- if (digits_copied == digits_needed)
- return round_and_set_sign (0, negative, 0, 1);
- }
- while (digits_copied < digits_needed && rdigno > 0)
- {
- if (!(base == 16 ? isxdigit (*startp) : isdigit (*startp)))
- startp += decimal_len;
- buf[digits_copied++] = *startp++;
- rdigno--;
- }
- if (rdigno)
- extra = 1;
- else
- while (digits_copied < digits_needed)
- buf[digits_copied++] = '0';
-
- if (base == 10 && exponent == 1)
- {
- assert (buf[0] != '0');
- /* At least 1.0; see if there is overflow. */
- if (UNSIGNED
- || !negative
- || buf[0] > '1'
- || dig_no > 1)
- __set_errno (ERANGE);
- return (negative ? SAT_MIN : SAT_MAX);
- }
-
- if (base == 16 && exponent > 0)
- {
- int max_dig = (16 >> exponent) + '0';
- assert (buf[0] != '0');
- if (buf[0] >= max_dig)
- {
- /* At least 1.0; see if there is overflow. */
- if (UNSIGNED
- || !negative
- || buf[0] > max_dig
- || dig_no > 1)
- __set_errno (ERANGE);
- return (negative ? SAT_MIN : SAT_MAX);
- }
- }
-
- /* Now strictly in the range (0, 1) (though rounding may yet
- saturate to 1.0). */
- if (base == 10)
- assert (exponent == 0);
- else
- assert (exponent >= 0 && exponent <= 3);
-
- if (base == 16)
- {
- RETURN_TYPE r = 0;
- int half = 0;
- for (int i = 0; i < digits_needed; i++)
- {
- RETURN_TYPE val;
- int shift;
- if (isdigit (buf[i]))
- val = buf[i] - '0';
- else
- val = 10 + tolower (buf[i]) - 'a';
- shift = RETURN_FRAC_BITS - 4 + exponent - 4 * i;
- if (shift >= 0)
- r |= val << shift;
- else if (shift < -4)
- extra |= (val != 0);
- else
- {
- r |= val >> -shift;
- half = (val & (1 << (-shift - 1))) != 0;
- extra |= (val & ((1 << (-shift - 1)) - 1)) != 0;
- }
- }
- return round_and_set_sign (r, negative, half, extra);
- }
-
- /* Now we have RETURN_FRAC_BITS + 1 digits after the decimal point.
- Interpret these as an integer and divide by 5^(RETURN_FRAC_BITS +
- 1). If there is a remainder, set extra. If the result of the
- division is odd, set half. Divide by 2 again, and round the
- result. */
- mp_limb_t frac[8];
- mp_size_t fracsize;
- str_to_mpn (buf, digits_needed, frac, &fracsize);
- if (fracsize < pow5size)
- return round_and_set_sign (0, negative, 0, 1);
- frac[fracsize] = __mpn_lshift (frac, frac, fracsize, pow5shift);
- if (frac[fracsize])
- fracsize++;
- mp_limb_t quot[8];
- quot[fracsize - pow5size] = mpn_divmod (quot, frac, fracsize, pow5, pow5size);
- for (int i = 0; i < pow5size; i++)
- if (frac[i])
- extra = 1;
- int half = quot[0] & 1;
- RETURN_TYPE val = quot[0] >> 1;
-#if RETURN_FRAC_BITS > BITS_PER_MP_LIMB - 1
- val |= ((RETURN_TYPE) quot[1]) << (BITS_PER_MP_LIMB - 1);
-# if RETURN_FRAC_BITS > 2 * BITS_PER_MP_LIMB - 1
- val |= ((RETURN_TYPE) quot[2]) << (2 * BITS_PER_MP_LIMB - 1);
-# if RETURN_FRAC_BITS > 3 * BITS_PER_MP_LIMB - 1
-# error "Too many bits."
-# endif
-# endif
-#endif
- return round_and_set_sign (val, negative, half, extra);
-}
-
-libc_hidden_def (STRTOFIX)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix16.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix16.c
deleted file mode 100644
index b444f826b..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix16.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 16-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE int16_t
-#define UNSIGNED 0
-#define RETURN_TYPE_BITS 16
-#define SAT_MIN -0x8000
-#define SAT_MAX 0x7fff
-#define STRTOFIX strtosfix16
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix32.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix32.c
deleted file mode 100644
index 2b885d83f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix32.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 32-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE int32_t
-#define UNSIGNED 0
-#define RETURN_TYPE_BITS 32
-#define SAT_MIN 0x80000000
-#define SAT_MAX 0x7fffffff
-#define STRTOFIX strtosfix32
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix64.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix64.c
deleted file mode 100644
index 73bba1bd9..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 64-bit signed fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE int64_t
-#define UNSIGNED 0
-#define RETURN_TYPE_BITS 64
-#define SAT_MIN 0x8000000000000000LL
-#define SAT_MAX 0x7fffffffffffffffLL
-#define STRTOFIX strtosfix64
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix16.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix16.c
deleted file mode 100644
index 452bc7b45..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix16.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 16-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE uint16_t
-#define UNSIGNED 1
-#define RETURN_TYPE_BITS 16
-#define SAT_MIN 0
-#define SAT_MAX 0xffff
-#define STRTOFIX strtoufix16
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix32.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix32.c
deleted file mode 100644
index 8977212c8..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix32.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 32-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE uint32_t
-#define UNSIGNED 1
-#define RETURN_TYPE_BITS 32
-#define SAT_MIN 0
-#define SAT_MAX 0xffffffff
-#define STRTOFIX strtoufix32
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix64.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix64.c
deleted file mode 100644
index 2ace30c2d..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to 64-bit unsigned fixed point.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-#define RETURN_TYPE uint64_t
-#define UNSIGNED 1
-#define RETURN_TYPE_BITS 64
-#define SAT_MIN 0
-#define SAT_MAX 0xffffffffffffffffLL
-#define STRTOFIX strtoufix64
-
-#include "strtofix.c"
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/t_sqrt.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/t_sqrt.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/t_sqrt.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/tst-spepim.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/tst-spepim.c
deleted file mode 100644
index 220df545f..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/tst-spepim.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/* Test SPE PIM functions.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.com>, 2007.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <fenv.h>
-#include <spe.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef int16_t sint16_t;
-typedef int32_t sint32_t;
-typedef int64_t sint64_t;
-
-#define SAT_MAX_U16 0xffff
-#define SAT_MAX_U32 0xffffffffu
-#define SAT_MAX_U64 0xffffffffffffffffull
-#define SAT_MAX_S16 0x7fff
-#define SAT_MAX_S32 0x7fffffff
-#define SAT_MAX_S64 0x7fffffffffffffffll
-#define SAT_MIN_S16 (-SAT_MAX_S16 - 1)
-#define SAT_MIN_S32 (-SAT_MAX_S32 - 1)
-#define SAT_MIN_S64 (-SAT_MAX_S64 - 1)
-
-/* Test results for a single rounding mode. For each type of result,
- store the expected result and the expected errno. */
-struct res {
- sint16_t s16;
- int es16;
- sint32_t s32;
- int es32;
- sint64_t s64;
- int es64;
- uint16_t u16;
- int eu16;
- uint32_t u32;
- int eu32;
- uint64_t u64;
- int eu64;
-};
-
-struct testcase {
- /* String to test. */
- const char *s;
- /* Number of junk characters at end. */
- size_t njunk;
- /* Expected results for rounding to nearest, zero, upward and
- downward. */
- struct res res[4];
-};
-
-/* Saturating value. */
-#define SAT(VAL) VAL, ERANGE
-/* Unsaturating value. */
-#define UNSAT(VAL) VAL, 0
-/* Values saturating for both signed and unsigned. */
-#define SAT6(VAL0, VAL1, VAL2, VAL3, VAL4, VAL5) \
- { \
- SAT (VAL0), SAT (VAL1), SAT (VAL2), \
- SAT (VAL3), SAT (VAL4), SAT (VAL5) \
- }
-#define SAT6_MAX \
- SAT6 (SAT_MAX_S16, SAT_MAX_S32, SAT_MAX_S64, \
- SAT_MAX_U16, SAT_MAX_U32, SAT_MAX_U64)
-#define SAT6_MIN \
- SAT6 (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64, 0, 0, 0)
-/* Values saturating for unsigned but not signed. */
-#define SATNEG(VAL0, VAL1, VAL2) \
- { \
- UNSAT (VAL0), UNSAT (VAL1), UNSAT (VAL2), \
- SAT (0), SAT (0), SAT (0) \
- }
-/* Values not saturating. */
-#define UNSAT6(VAL0, VAL1, VAL2, VAL3, VAL4, VAL5) \
- { \
- UNSAT (VAL0), UNSAT (VAL1), UNSAT (VAL2), \
- UNSAT (VAL3), UNSAT (VAL4), UNSAT (VAL5) \
- }
-/* Results not depending on rounding mode. */
-#define EXACT_SAT6_MAX \
- { \
- SAT6_MAX, \
- SAT6_MAX, \
- SAT6_MAX, \
- SAT6_MAX \
- }
-#define EXACT_SAT6_MIN \
- { \
- SAT6_MIN, \
- SAT6_MIN, \
- SAT6_MIN, \
- SAT6_MIN \
- }
-#define EXACT_SATNEG(VAL0, VAL1, VAL2) \
- { \
- SATNEG (VAL0, VAL1, VAL2), \
- SATNEG (VAL0, VAL1, VAL2), \
- SATNEG (VAL0, VAL1, VAL2), \
- SATNEG (VAL0, VAL1, VAL2) \
- }
-#define EXACT_UNSAT6(VAL0, VAL1, VAL2, VAL3, VAL4, VAL5) \
- { \
- UNSAT6 (VAL0, VAL1, VAL2, VAL3, VAL4, VAL5), \
- UNSAT6 (VAL0, VAL1, VAL2, VAL3, VAL4, VAL5), \
- UNSAT6 (VAL0, VAL1, VAL2, VAL3, VAL4, VAL5), \
- UNSAT6 (VAL0, VAL1, VAL2, VAL3, VAL4, VAL5) \
- }
-
-static const struct testcase tests[] = {
- /* Strings evaluating to 0, including INF and NaN (not supported by
- SPE PIM functions). */
- { "", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "00", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "+0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "-0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0.0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { ".0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0.", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { " \n-0.", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0e100000000000000000", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { " \t 0e-100000000000000000", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x0.", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x.0", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x0.p100000000000000000", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "-0x0.p002000000000000000", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x.0p-100000000000000000", 0, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x", 1, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x.", 2, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { ".", 1, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { " .", 2, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "+.", 2, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { " +.", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { " -.", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0xp", 2, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x.p", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "+0x.p", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "-0x.p0", 4, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "0x0q", 1, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "INF", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- { "nan", 3, EXACT_UNSAT6 (0, 0, 0, 0, 0, 0) },
- /* Strings evaluating to 1.0 or greater, saturating unconditionally. */
- { "1", 0, EXACT_SAT6_MAX },
- { "1.0", 0, EXACT_SAT6_MAX },
- { "1e0", 0, EXACT_SAT6_MAX },
- { "10e-1", 0, EXACT_SAT6_MAX },
- { "0.1e1", 0, EXACT_SAT6_MAX },
- { "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-100", 0, EXACT_SAT6_MAX },
- { "2", 0, EXACT_SAT6_MAX },
- { "0x1", 0, EXACT_SAT6_MAX },
- { "0x2p-1", 0, EXACT_SAT6_MAX },
- { "0x.8p1", 0, EXACT_SAT6_MAX },
- { "0x.40p2", 0, EXACT_SAT6_MAX },
- /* Strings evaluating to less than -1.0, saturating unconditionally. */
- { "-1.1", 0, EXACT_SAT6_MIN },
- { "-.11e1", 0, EXACT_SAT6_MIN },
- { "-11e-1", 0, EXACT_SAT6_MIN },
- { "-100", 0, EXACT_SAT6_MIN },
- { "-2", 0, EXACT_SAT6_MIN },
- { "-0x1.00000000000000000000000001", 0, EXACT_SAT6_MIN },
- { "-0x2.00000000000000000000000001p-1", 0, EXACT_SAT6_MIN },
- { "-0x0.80000000000000000000000001p1", 0, EXACT_SAT6_MIN },
- { "-1.000000000000000000000000000000000000000000000000000000000000000000000000000000001", 0, EXACT_SAT6_MIN },
- /* Strings evaluating to -1.0 exactly, saturating for unsigned but
- exactly representable for signed. */
- { "-1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-1e", 1, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-1.0", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-10e-1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-.1e+1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-.0000000001e+10", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-10000000000e-10", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x1p+", 2, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x2p-1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x4.0p-2", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x8.p-3", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x10p-4", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x.8p1", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x.4p+2", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x.2p+3", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x.1p+4", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- { "-0x.08p5", 0, EXACT_SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64) },
- /* Strings evaluating to exactly representable values between -1.0
- and 0.0, saturating for unsigned. */
- { "-0.5", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0.5e-", 2, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-05e-1", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-05000000000e-10", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0.5e0", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0.00000000005e10", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0x.8", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0x1p-1", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0x.4p1", 0, EXACT_SATNEG (-0x4000, -0x40000000, -0x4000000000000000ll) },
- { "-0.25", 0, EXACT_SATNEG (-0x2000, -0x20000000, -0x2000000000000000ll) },
- { "-2.5e-1", 0, EXACT_SATNEG (-0x2000, -0x20000000, -0x2000000000000000ll) },
- { "-0.75", 0, EXACT_SATNEG (-0x6000, -0x60000000, -0x6000000000000000ll) },
- { "-0.000030517578125", 0, EXACT_SATNEG (-0x0001, -0x00010000, -0x0001000000000000ll) },
- { "-0.376739501953125", 0, EXACT_SATNEG (-12345, -12345*0x10000, -12345*0x1000000000000ll) },
- { "-0x.dcba", 0, EXACT_SATNEG (-0x6e5d, -0x6e5d0000, -0x6e5d000000000000ll) },
- { "-0xd.cbap-4", 0, EXACT_SATNEG (-0x6e5d, -0x6e5d0000, -0x6e5d000000000000ll) },
- /* Strings evaluating to exactly representable values between 0.0
- and 1.0. */
- { "0.5", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0.5e-", 2, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "05e-1", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "05000000000e-10", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0.5e0", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0.00000000005e10", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0x.8", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0x1p-1", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0x.4p1", 0, EXACT_UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000000ull) },
- { "0.25", 0, EXACT_UNSAT6 (0x2000, 0x20000000, 0x2000000000000000ll, 0x4000, 0x40000000u, 0x4000000000000000ull) },
- { "2.5e-1", 0, EXACT_UNSAT6 (0x2000, 0x20000000, 0x2000000000000000ll, 0x4000, 0x40000000u, 0x4000000000000000ull) },
- { "0.75", 0, EXACT_UNSAT6 (0x6000, 0x60000000, 0x6000000000000000ll, 0xc000, 0xc0000000u, 0xc000000000000000ull) },
- { "0.000030517578125", 0, EXACT_UNSAT6 (0x0001, 0x00010000, 0x0001000000000000ll, 0x0002, 0x00020000u, 0x0002000000000000ull) },
- { "0.376739501953125", 0, EXACT_UNSAT6 (12345, 12345*0x10000, 12345*0x1000000000000ll, 12345*0x2, 12345*0x20000u, 12345*0x2000000000000ull) },
- { "0x.dcba", 0, EXACT_UNSAT6 (0x6e5d, 0x6e5d0000, 0x6e5d000000000000ll, 0xdcba, 0xdcba0000u, 0xdcba000000000000ull) },
- { "0xd.cbap-4", 0, EXACT_UNSAT6 (0x6e5d, 0x6e5d0000, 0x6e5d000000000000ll, 0xdcba, 0xdcba0000u, 0xdcba000000000000ull) },
- /* Strings evaluating to values between 0.0 and 1.0, depending on
- rounding mode. */
- { "0.1", 0,
- {
- UNSAT6 (0xccd, 0xccccccd, 0xccccccccccccccdll, 0x199a, 0x1999999au, 0x199999999999999aull),
- UNSAT6 (0xccc, 0xccccccc, 0xcccccccccccccccll, 0x1999, 0x19999999u, 0x1999999999999999ull),
- UNSAT6 (0xccd, 0xccccccd, 0xccccccccccccccdll, 0x199a, 0x1999999au, 0x199999999999999aull),
- UNSAT6 (0xccc, 0xccccccc, 0xcccccccccccccccll, 0x1999, 0x19999999u, 0x1999999999999999ull)
- }
- },
- { "0.5000152587890625", 0,
- {
- UNSAT6 (0x4000, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull),
- UNSAT6 (0x4000, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull),
- UNSAT6 (0x4001, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull),
- UNSAT6 (0x4000, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull)
- }
- },
- { "0.50001525878906250000000000000000000000000000000000000000000000000000000000001", 0,
- {
- UNSAT6 (0x4001, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull),
- UNSAT6 (0x4000, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull),
- UNSAT6 (0x4001, 0x40008001, 0x4000800000000001ll, 0x8002, 0x80010001u, 0x8001000000000001ull),
- UNSAT6 (0x4000, 0x40008000, 0x4000800000000000ll, 0x8001, 0x80010000u, 0x8001000000000000ull)
- }
- },
- { "0.50000000000000000008131516293641283255055896006524562835693359375", 0,
- {
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000001ll, 0x8000, 0x80000000u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4001, 0x40000001, 0x4000000000000001ll, 0x8001, 0x80000001u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull)
- }
- },
- { "0.50000000000000000008131516293641283255055896006524562835693359376", 0,
- {
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000001ll, 0x8000, 0x80000000u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4001, 0x40000001, 0x4000000000000001ll, 0x8001, 0x80000001u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull)
- }
- },
- { "0.50000000000000000008131516293641283255055896006524562835693359374", 0,
- {
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000001ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4001, 0x40000001, 0x4000000000000001ll, 0x8001, 0x80000001u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull)
- }
- },
- { "0x0.80000000000000018", 0,
- {
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000001ll, 0x8000, 0x80000000u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4001, 0x40000001, 0x4000000000000001ll, 0x8001, 0x80000001u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull)
- }
- },
- { "0x0.80000000000000017", 0,
- {
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000001ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull),
- UNSAT6 (0x4001, 0x40000001, 0x4000000000000001ll, 0x8001, 0x80000001u, 0x8000000000000002ull),
- UNSAT6 (0x4000, 0x40000000, 0x4000000000000000ll, 0x8000, 0x80000000u, 0x8000000000000001ull)
- }
- },
- /* Strings evaluating to values between -1.0 and 0.0, depending on
- rounding mode. */
- { "-0.1", 0,
- {
- SATNEG (-0xccd, -0xccccccd, -0xccccccccccccccdll),
- SATNEG (-0xccc, -0xccccccc, -0xcccccccccccccccll),
- SATNEG (-0xccc, -0xccccccc, -0xcccccccccccccccll),
- SATNEG (-0xccd, -0xccccccd, -0xccccccccccccccdll)
- }
- },
- { "-0.5000000000000000001626303258728256651011179201304912567138671875", 0,
- {
- SATNEG (-0x4000, -0x40000000, -0x4000000000000002ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4001, -0x40000001, -0x4000000000000002ll)
- }
- },
- { "-0.5000000000000000001626303258728256651011179201304912567138671874", 0,
- {
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4001, -0x40000001, -0x4000000000000002ll)
- }
- },
- { "-0.5000000000000000001626303258728256651011179201304912567138671876", 0,
- {
- SATNEG (-0x4000, -0x40000000, -0x4000000000000002ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4001, -0x40000001, -0x4000000000000002ll)
- }
- },
- { "-0x.8000000000000003", 0,
- {
- SATNEG (-0x4000, -0x40000000, -0x4000000000000002ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4001, -0x40000001, -0x4000000000000002ll)
- }
- },
- { "-0x.8000000000000002f", 0,
- {
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4000, -0x40000000, -0x4000000000000001ll),
- SATNEG (-0x4001, -0x40000001, -0x4000000000000002ll)
- }
- },
- /* Strings evaluating very close to 1.0, saturation depending on
- rounding mode. */
- { "0x.fffe1", 0,
- {
- { UNSAT (0x7fff), UNSAT (0x7fff0800), UNSAT (0x7fff080000000000ll), UNSAT (0xfffe), UNSAT (0xfffe1000u), UNSAT (0xfffe100000000000ull) },
- { UNSAT (0x7fff), UNSAT (0x7fff0800), UNSAT (0x7fff080000000000ll), UNSAT (0xfffe), UNSAT (0xfffe1000u), UNSAT (0xfffe100000000000ull) },
- { SAT (0x7fff), UNSAT (0x7fff0800), UNSAT (0x7fff080000000000ll), UNSAT (0xffff), UNSAT (0xfffe1000u), UNSAT (0xfffe100000000000ull) },
- { UNSAT (0x7fff), UNSAT (0x7fff0800), UNSAT (0x7fff080000000000ll), UNSAT (0xfffe), UNSAT (0xfffe1000u), UNSAT (0xfffe100000000000ull) }
- }
- },
- { "0x.ffff8", 0,
- {
- { SAT (0x7fff), UNSAT (0x7fffc000), UNSAT (0x7fffc00000000000ll), SAT (0xffff), UNSAT (0xffff8000u), UNSAT (0xffff800000000000ull) },
- { UNSAT (0x7fff), UNSAT (0x7fffc000), UNSAT (0x7fffc00000000000ll), UNSAT (0xffff), UNSAT (0xffff8000u), UNSAT (0xffff800000000000ull) },
- { SAT (0x7fff), UNSAT (0x7fffc000), UNSAT (0x7fffc00000000000ll), SAT (0xffff), UNSAT (0xffff8000u), UNSAT (0xffff800000000000ull) },
- { UNSAT (0x7fff), UNSAT (0x7fffc000), UNSAT (0x7fffc00000000000ll), UNSAT (0xffff), UNSAT (0xffff8000u), UNSAT (0xffff800000000000ull) }
- }
- },
- { "0x.fffffffffffffffff", 0,
- {
- { SAT (0x7fff), SAT (0x7fffffff), SAT (0x7fffffffffffffffll), SAT (0xffff), SAT (0xffffffffu), SAT (0xffffffffffffffffull) },
- { UNSAT (0x7fff), UNSAT (0x7fffffff), UNSAT (0x7fffffffffffffffll), UNSAT (0xffff), UNSAT (0xffffffffu), UNSAT (0xffffffffffffffffull) },
- { SAT (0x7fff), SAT (0x7fffffff), SAT (0x7fffffffffffffffll), SAT (0xffff), SAT (0xffffffffu), SAT (0xffffffffffffffffull) },
- { UNSAT (0x7fff), UNSAT (0x7fffffff), UNSAT (0x7fffffffffffffffll), UNSAT (0xffff), UNSAT (0xffffffffu), UNSAT (0xffffffffffffffffull) }
- }
- },
- /* Strings evaluating very close to -1.0, may round to -1 but only
- saturate for unsigned. */
- { "-0x.fffe1", 0,
- {
- SATNEG (-0x7fff, -0x7fff0800, -0x7fff080000000000ll),
- SATNEG (-0x7fff, -0x7fff0800, -0x7fff080000000000ll),
- SATNEG (-0x7fff, -0x7fff0800, -0x7fff080000000000ll),
- SATNEG (SAT_MIN_S16, -0x7fff0800, -0x7fff080000000000ll)
- }
- },
- { "-0x.ffffffffffffffff", 0,
- {
- SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64),
- SATNEG (-0x7fff, -0x7fffffff, -0x7fffffffffffffffll),
- SATNEG (-0x7fff, -0x7fffffff, -0x7fffffffffffffffll),
- SATNEG (SAT_MIN_S16, SAT_MIN_S32, SAT_MIN_S64)
- }
- }
-};
-
-static const int rounding_modes[4] = {
- FE_TONEAREST,
- FE_TOWARDZERO,
- FE_UPWARD,
- FE_DOWNWARD
-};
-
-static const char *const mode_names[4] = {
- "FE_TONEAREST",
- "FE_TOWARDZERO",
- "FE_UPWARD",
- "FE_DOWNWARD"
-};
-
-int
-main (void)
-{
- int passes = 0;
- int fails = 0;
- size_t i;
- for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
- {
- size_t j;
- for (j = 0; j < 4; j++)
- {
- if (fesetround (rounding_modes[j]) != 0)
- {
- printf ("fesetround (%s) failed.\n", mode_names[j]);
- abort ();
- }
-#define DO_TEST(SU, SZ, PR) \
- do { \
- SU##int##SZ##_t expret = tests[i].res[j].SU##SZ; \
- int experr = tests[i].res[j].e##SU##SZ; \
- size_t explen = strlen (tests[i].s) - tests[i].njunk; \
- SU##int##SZ##_t ret0, ret1; \
- int reterr; \
- size_t retlen; \
- char *ep; \
- errno = 0; \
- ret0 = strto##SU##fix##SZ (tests[i].s, &ep); \
- reterr = errno; \
- retlen = ep - tests[i].s; \
- if (ret0 == expret) \
- passes++; \
- else \
- { \
- fails++; \
- printf ("strto"#SU"fix"#SZ" (\"%s\") in mode %s " \
- "returned %0"PR"x, expected %0"PR"x.\n", \
- tests[i].s, mode_names[j], ret0, expret); \
- } \
- if (reterr == experr) \
- passes++; \
- else \
- { \
- fails++; \
- printf ("strto"#SU"fix"#SZ" (\"%s\") in mode %s " \
- "left errno as %d, expected %d.\n", \
- tests[i].s, mode_names[j], reterr, experr); \
- } \
- if (retlen == explen) \
- passes++; \
- else \
- { \
- fails++; \
- printf ("strto"#SU"fix"#SZ" (\"%s\") in mode %s " \
- "consumed %zu characters, expected %zu.\n", \
- tests[i].s, mode_names[j], retlen, explen); \
- } \
- if (experr == 0) \
- { \
- ret1 = ato##SU##fix##SZ (tests[i].s); \
- if (ret1 == expret) \
- passes++; \
- else \
- { \
- fails++; \
- printf ("ato"#SU"fix"#SZ" (\"%s\") in mode %s " \
- "returned %0"PR"x, expected %0"PR"x.\n", \
- tests[i].s, mode_names[j], ret1, expret); \
- } \
- } \
- } while (0)
- DO_TEST (s, 16, "4h");
- DO_TEST (s, 32, "8");
- DO_TEST (s, 64, "16ll");
- DO_TEST (u, 16, "4h");
- DO_TEST (u, 32, "8");
- DO_TEST (u, 64, "16ll");
- }
- }
- printf ("Number of passes: %d\nNumber of failures: %d\n", passes, fails);
- return fails != 0;
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrt.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrt.c
deleted file mode 100644
index 3721f24a7..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrt.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/w_sqrt.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrtf.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrtf.c
deleted file mode 100644
index 7c6ca901a..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrtf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/w_sqrtf.c>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Makefile b/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Makefile
deleted file mode 100644
index 2d7d09205..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# Double precision floating point gets emulated.
-ifeq ($(subdir),soft-fp)
-sysdep_routines += $(gcc-double-routines) fraiseexcept-soft
-endif
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Subdirs b/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Subdirs
deleted file mode 100644
index 87eadf302..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Subdirs
+++ /dev/null
@@ -1 +0,0 @@
-soft-fp
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Versions b/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Versions
deleted file mode 100644
index f126c9a8a..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Versions
+++ /dev/null
@@ -1,19 +0,0 @@
-libc {
- GLIBC_2.3.3 {
- __feraiseexcept_soft;
- __adddf3; __truncdfsf2;
- __divdf3; __eqdf2;
- __extendsfdf2; __fixdfdi; __fixdfsi; __fixsfdi;
- __fixtfdi;
- __fixunsdfdi; __fixunsdfsi;
- __floatdidf; __floatsidf;
- __gedf2; __ledf2; __muldf3;
- __negdf2; __sqrtdf2; __subdf3;
- __truncdfsf2;
- }
- GLIBC_2.5 {
- __floatundidf; __floatunsidf;
- __unorddf2; __nedf2;
- __gtdf2; __ltdf2;
- }
-}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/sfp-machine.h b/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/sfp-machine.h
deleted file mode 100644
index 8b80e128b..000000000
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/sfp-machine.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _SFP_MACHINE_H_
-#define _SFP_MACHINE_H_
-#include <fenv_libc.h>
-#include <libc-symbols.h>
-
-int __feraiseexcept_soft (int);
-libc_hidden_proto (__feraiseexcept_soft)
-
-#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_loop(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
-#define _FP_QNANNEGATEDP 0
-
-/* Someone please check this. */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
- do { \
- if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
- && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
- { \
- R##_s = Y##_s; \
- _FP_FRAC_COPY_##wc(R,Y); \
- } \
- else \
- { \
- R##_s = X##_s; \
- _FP_FRAC_COPY_##wc(R,X); \
- } \
- R##_c = FP_CLS_NAN; \
- } while (0)
-
-/* Exception flags. We use the bit positions of the appropriate bits
- in the FPEFSCR, which also correspond to the FE_* bits. This makes
- everything easier ;-). */
-#define FP_EX_INEXACT (1 << (63 - 42))
-#define FP_EX_INVALID (1 << (63 - 43))
-#define FP_EX_DIVZERO (1 << (63 - 44))
-#define FP_EX_UNDERFLOW (1 << (63 - 45))
-#define FP_EX_OVERFLOW (1 << (63 - 46))
-
-/* This will work inasmuch as FP_EX_* are the same as FE_*. */
-#define FP_HANDLE_EXCEPTIONS __feraiseexcept_soft (_fex)
-
-#define FP_ROUNDMODE (fegetenv_register() & 0x3)
-#endif /* _SFP_MACHINE_H_ */
diff --git a/libc/ports/sysdeps/powerpc/preconfigure b/libc/ports/sysdeps/powerpc/preconfigure
deleted file mode 100644
index 57f24a086..000000000
--- a/libc/ports/sysdeps/powerpc/preconfigure
+++ /dev/null
@@ -1,20 +0,0 @@
-# Check for E500.
-
-case "$machine" in
-powerpc)
- if test "$with_fp" = "yes"; then
- variant=`(echo "#ifdef __NO_FPRS__"
- echo "#ifdef _SOFT_DOUBLE"
- echo "e500/single"
- echo "#else"
- echo "e500"
- echo "#endif"
- echo "#endif") |
- $CC $CFLAGS $CPPFLAGS -E - |
- grep '^[a-z]'`
- if test -n "$variant"; then
- base_machine=powerpc machine=powerpc/powerpc32/$variant
- fi
- fi
- ;;
-esac
diff --git a/libc/ports/sysdeps/tile/ffs.c b/libc/ports/sysdeps/tile/ffs.c
index 93ad9801b..eb982a6dd 100644
--- a/libc/ports/sysdeps/tile/ffs.c
+++ b/libc/ports/sysdeps/tile/ffs.c
@@ -27,6 +27,7 @@ __ffs (int x)
return __builtin_ffs (x);
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsll
diff --git a/libc/ports/sysdeps/tile/stackguard-macros.h b/libc/ports/sysdeps/tile/stackguard-macros.h
index 589ea2b0d..f2e041b99 100644
--- a/libc/ports/sysdeps/tile/stackguard-macros.h
+++ b/libc/ports/sysdeps/tile/stackguard-macros.h
@@ -4,11 +4,17 @@
# if __WORDSIZE == 64
# define STACK_CHK_GUARD \
({ uintptr_t x; asm ("addi %0, tp, -16; ld %0, %0" : "=r" (x)); x; })
+# define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("addi %0, tp, -24; ld %0, %0" : "=r" (x)); x; })
# else
# define STACK_CHK_GUARD \
({ uintptr_t x; asm ("addi %0, tp, -8; ld4s %0, %0" : "=r" (x)); x; })
+# define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("addi %0, tp, -12; ld4s %0, %0" : "=r" (x)); x; })
# endif
#else
# define STACK_CHK_GUARD \
({ uintptr_t x; asm ("addi %0, tp, -8; lw %0, %0" : "=r" (x)); x; })
+# define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("addi %0, tp, -12; lw %0, %0" : "=r" (x)); x; })
#endif
diff --git a/libc/ports/sysdeps/unix/alpha/sysdep.h b/libc/ports/sysdeps/unix/alpha/sysdep.h
index d20bcd6d3..150a91906 100644
--- a/libc/ports/sysdeps/unix/alpha/sysdep.h
+++ b/libc/ports/sysdeps/unix/alpha/sysdep.h
@@ -343,53 +343,43 @@ __LABEL(name) \
: : inline_syscall_clobbers); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
+#endif /* ASSEMBLER */
/* 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__
+#ifdef __ASSEMBLER__
+# if defined NOT_IN_libc && defined IS_IN_rtld
# 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__
+# elif defined SHARED
# define PTR_MANGLE(dst, src, tmp) \
ldq tmp, __pointer_chk_guard; \
xor src, tmp, dst
-# define PTR_MANGLE2(dst, src, tmp) \
+# else
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard_local; \
xor src, tmp, dst
-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# endif
+# 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
+# include <stdint.h>
+# if (defined NOT_IN_libc && defined IS_IN_rtld) \
+ || (!defined SHARED && (!defined NOT_IN_libc || defined IS_IN_libpthread))
+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)
# else
extern const uintptr_t __pointer_chk_guard attribute_relro;
-# define PTR_MANGLE(var) \
+# define PTR_MANGLE(var) \
(var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
# endif
-#else
-/* There exists generic C code that assumes that PTR_MANGLE is always
- defined. When generating code for the static libc, we don't have
- __pointer_chk_guard defined. Nor is there any place that would
- initialize it if it were defined, so there's little point in doing
- anything more than nothing. */
-# ifndef __ASSEMBLER__
-# define PTR_MANGLE(var)
-# define PTR_DEMANGLE(var)
-# endif
-#endif
-
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
#endif /* ASSEMBLER */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
index 6620a9f13..42ff38ece 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
@@ -1,7 +1,6 @@
-/* Raise given exceptions.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+/* AArch64 definitions for signal handling calling conventions.
+ Copyright (C) 1996-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -17,12 +16,20 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv_libc.h>
+#include <sys/ucontext.h>
+#include "kernel-features.h"
-#undef feraiseexcept
+#define SIGCONTEXT siginfo_t *_si, struct ucontext *
+#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc)
-#define __FERAISEEXCEPT_INTERNAL feraiseexcept
-#include "../spe-raise.c"
+/* There is no reliable way to get the sigcontext unless we use a
+ three-argument signal handler. */
+#define __sigaction(sig, act, oact) ({ \
+ (act)->sa_flags |= SA_SIGINFO; \
+ (__sigaction) (sig, act, oact); \
+})
-strong_alias (feraiseexcept, __feraiseexcept)
-libm_hidden_def (feraiseexcept)
+#define sigaction(sig, act, oact) ({ \
+ (act)->sa_flags |= SA_SIGINFO; \
+ (sigaction) (sig, act, oact); \
+})
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 849c90499..9a7b16735 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -134,7 +134,7 @@ __local_syscall_error: \
str x19, [sp,16]; \
neg x19, x0; \
bl C_SYMBOL_NAME(__errno_location); \
- str x19, [x0]; \
+ str w19, [x0]; \
mov x0, -1; \
ldr x19, [sp,16]; \
ldp x29, x30, [sp], 32; \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index 2e31691c2..02c9a7f75 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -36,6 +36,7 @@
#define __O_DIRECT 02000000 /* Direct disk access. */
#define __O_NOATIME 04000000 /* Do not set atime. */
#define __O_PATH 040000000 /* Resolve pathname but do not open file. */
+#define __O_TMPFILE 0100100000 /* Atomically create nameless file. */
/* Not necessary, files are always with 64bit off_t. */
#define __O_LARGEFILE 0
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S
index d9629b9ec..50b152d0c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S
@@ -25,7 +25,7 @@
ldl a2, PID_OFFSET(v0); \
mov v0, a1; \
/* Write back its negation, to indicate that the pid value is \
- uninitialized in the the child, and in the window between \
+ uninitialized in the child, and in the window between \
here and the point at which we restore the value. */ \
negl a2, t0; \
stl t0, PID_OFFSET(v0);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S
index 1ca7678d1..03aa37f43 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S
@@ -26,7 +26,7 @@
mov v0, a1; \
/* If the cached value is initialized (nonzero), then write \
back its negation, or INT_MIN, to indicate that the pid \
- value is uninitialized in the the child, and in the window \
+ value is uninitialized in the child, and in the window \
between here and the point at which we restore the value. */ \
ldah t0, -0x8000; \
negl a2, t1; \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
index 6ee7a1aeb..6777ef646 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
@@ -15,8 +15,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* ??? Needs more rearrangement for the LDM to handle thumb mode. */
-#define NO_THUMB
#include <sysdep.h>
.section .rodata.str1.1,"aMS",%progbits,1
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
index b195d8ea1..6cfe4e08a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -435,8 +435,44 @@ __local_syscall_error: \
#endif /* __ASSEMBLER__ */
-/* Pointer mangling is not yet supported for ARM. */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
+/* Pointer mangling support. */
+#if (defined NOT_IN_libc && defined IS_IN_rtld) || \
+ (!defined SHARED && (!defined NOT_IN_libc || defined IS_IN_libpthread))
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, guard, tmp) \
+ LDST_PCREL(ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local)); \
+ PTR_MANGLE2(dst, src, guard)
+/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+# define PTR_MANGLE2(dst, src, guard) \
+ eor dst, src, guard
+# define PTR_DEMANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE (dst, src, guard, tmp)
+# define PTR_DEMANGLE2(dst, src, guard) \
+ PTR_MANGLE2 (dst, src, guard)
+# 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
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, guard, tmp) \
+ LDST_GLOBAL(ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard)); \
+ PTR_MANGLE2(dst, src, guard)
+/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+# define PTR_MANGLE2(dst, src, guard) \
+ eor dst, src, guard
+# define PTR_DEMANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE (dst, src, guard, tmp)
+# define PTR_DEMANGLE2(dst, src, guard) \
+ PTR_MANGLE2 (dst, src, guard)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif
#endif /* linux/arm/sysdep.h */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
index 744548a03..76faa4086 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
@@ -37,6 +37,7 @@
#define __O_CLOEXEC 010000000 /* Set close_on_exec. */
#define __O_NOATIME 004000000 /* Do not set atime. */
#define __O_PATH 020000000
+#define __O_TMPFILE 040010000 /* Atomically create nameless file. */
#define __O_LARGEFILE 00004000
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
index 1e54036bf..9070b775c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
@@ -8,7 +8,9 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set
sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
endif
-abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard
+abi-variants := o32_soft o32_hard o32_soft_2008 o32_hard_2008
+abi-variants += n32_soft n32_hard n32_soft_2008 n32_hard_2008
+abi-variants += n64_soft n64_hard n64_soft_2008 n64_hard_2008
ifeq (,$(filter $(default-abi),$(abi-variants)))
Unknown ABI, must be one of $(abi-variants)
@@ -18,29 +20,89 @@ abi-includes := sgidefs.h
# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
- -D__mips_soft_float -U__mips_hard_float
-abi-o32_soft-condition := defined(__mips_soft_float) \
- && (_MIPS_SIM == _MIPS_SIM_ABI32)
+ -D__mips_soft_float -U__mips_hard_float \
+ -U__mips_nan2008
+abi-o32_soft-condition := !defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_soft-ld-soname := ld.so.1
abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
- -D__mips_hard_float -U__mips_soft_float
-abi-o32_hard-condition := defined(__mips_hard_float) \
+ -D__mips_hard_float -U__mips_soft_float \
+ -U__mips_nan2008
+abi-o32_hard-condition := !defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
&& (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard-ld-soname := ld.so.1
+abi-o32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+ -D__mips_soft_float -U__mips_hard_float \
+ -D__mips_nan2008
+abi-o32_soft_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-o32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+ -D__mips_hard_float -U__mips_soft_float \
+ -D__mips_nan2008
+abi-o32_hard_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard_2008-ld-soname := ld-linux-mipsn8.so.1
abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
- -D__mips_soft_float -U__mips_hard_float
-abi-n32_soft-condition := defined(__mips_soft_float) \
+ -D__mips_soft_float -U__mips_hard_float \
+ -U__mips_nan2008
+abi-n32_soft-condition := !defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_soft-ld-soname := ld.so.1
abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
- -D__mips_hard_float -U__mips_soft_float
-abi-n32_hard-condition := defined(__mips_hard_float) \
+ -D__mips_hard_float -U__mips_soft_float \
+ -U__mips_nan2008
+abi-n32_hard-condition := !defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard-ld-soname := ld.so.1
+abi-n32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+ -D__mips_soft_float -U__mips_hard_float \
+ -D__mips_nan2008
+abi-n32_soft_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-n32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+ -D__mips_hard_float -U__mips_soft_float \
+ -D__mips_nan2008
+abi-n32_hard_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard_2008-ld-soname := ld-linux-mipsn8.so.1
abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
- -D__mips_soft_float -U__mips_hard_float
-abi-n64_soft-condition := defined(__mips_soft_float) \
+ -D__mips_soft_float -U__mips_hard_float \
+ -U__mips_nan2008
+abi-n64_soft-condition := !defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_soft-ld-soname := ld.so.1
abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
- -D__mips_hard_float -U__mips_soft_float
-abi-n64_hard-condition := defined(__mips_hard_float) \
+ -D__mips_hard_float -U__mips_soft_float \
+ -U__mips_nan2008
+abi-n64_hard-condition := !defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard-ld-soname := ld.so.1
+abi-n64_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+ -D__mips_soft_float -U__mips_hard_float \
+ -D__mips_nan2008
+abi-n64_soft_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_soft_2008-ld-soname := ld-linux-mipsn8.so.1
+abi-n64_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+ -D__mips_hard_float -U__mips_soft_float \
+ -D__mips_nan2008
+abi-n64_hard_2008-condition := defined(__mips_nan2008) \
+ && defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard_2008-ld-soname := ld-linux-mipsn8.so.1
ifeq ($(subdir),elf)
ifeq ($(build-shared),yes)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure b/libc/ports/sysdeps/unix/sysv/linux/mips/configure
index b4ee83e3a..088210ff9 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure
@@ -105,8 +105,168 @@ if test -z "$libc_mips_float"; then
as_fn_error $? "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5
fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is using the 2008 NaN encoding" >&5
+$as_echo_n "checking whether the compiler is using the 2008 NaN encoding... " >&6; }
+if ${libc_cv_mips_nan2008+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+dnl
+#ifdef __mips_nan2008
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then :
+ libc_cv_mips_nan2008=yes
+else
+ libc_cv_mips_nan2008=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mips_nan2008" >&5
+$as_echo "$libc_cv_mips_nan2008" >&6; }
+
+libc_mips_nan=
+if test x"$libc_cv_mips_nan2008" = xyes; then
+ libc_mips_nan=_2008
+fi
+
config_vars="$config_vars
-default-abi = ${libc_mips_abi}_${libc_mips_float}"
+default-abi = ${libc_mips_abi}_${libc_mips_float}${libc_mips_nan}"
case "$prefix" in
/usr | /usr/)
@@ -138,3 +298,12 @@ case "$prefix" in
esac
libc_cv_gcc_unwind_find_fde=yes
+
+if test -z "$arch_minimum_kernel"; then
+ if test x$libc_cv_mips_nan2008 = xyes; then
+ # FIXME: Adjust this setting to the actual first upstream kernel
+ # version to support the 2008 NaN encoding and then remove this
+ # comment.
+ arch_minimum_kernel=10.0.0
+ fi
+fi
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
index b8dde6ef7..7087a14a5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
@@ -44,7 +44,19 @@ if test -z "$libc_mips_float"; then
AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI])
fi
-LIBC_CONFIG_VAR([default-abi], [${libc_mips_abi}_${libc_mips_float}])
+AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+ libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
+#ifdef __mips_nan2008
+yes
+#endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+
+libc_mips_nan=
+if test x"$libc_cv_mips_nan2008" = xyes; then
+ libc_mips_nan=_2008
+fi
+
+LIBC_CONFIG_VAR([default-abi],
+ [${libc_mips_abi}_${libc_mips_float}${libc_mips_nan}])
case "$prefix" in
/usr | /usr/)
@@ -76,3 +88,12 @@ case "$prefix" in
esac
libc_cv_gcc_unwind_find_fde=yes
+
+if test -z "$arch_minimum_kernel"; then
+ if test x$libc_cv_mips_nan2008 = xyes; then
+ # FIXME: Adjust this setting to the actual first upstream kernel
+ # version to support the 2008 NaN encoding and then remove this
+ # comment.
+ arch_minimum_kernel=10.0.0
+ fi
+fi
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h b/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h
index 4a7f3f1f2..49ad99ab9 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/dl-cache.h
@@ -18,11 +18,27 @@
#include <ldconfig.h>
-/* Redefine the cache ID for new ABIs; o32 keeps using the generic check. */
-#if _MIPS_SIM == _ABI64
-# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN64 | FLAG_ELF_LIBC6)
-#elif _MIPS_SIM == _ABIN32
-# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN32 | FLAG_ELF_LIBC6)
+#if ((defined __mips_nan2008 && !defined HAVE_MIPS_NAN2008) \
+ || (!defined __mips_nan2008 && defined HAVE_MIPS_NAN2008))
+# error "Configuration inconsistency: __mips_nan2008 != HAVE_MIPS_NAN2008, overridden CFLAGS?"
+#endif
+
+/* Redefine the cache ID for new ABIs and 2008 NaN support; legacy o32
+ keeps using the generic check. */
+#ifdef __mips_nan2008
+# if _MIPS_SIM == _ABIO32
+# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS_LIB32_NAN2008 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABI64
+# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN64_NAN2008 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABIN32
+# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN32_NAN2008 | FLAG_ELF_LIBC6)
+# endif
+#else
+# if _MIPS_SIM == _ABI64
+# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN64 | FLAG_ELF_LIBC6)
+# elif _MIPS_SIM == _ABIN32
+# define _DL_CACHE_DEFAULT_ID (FLAG_MIPS64_LIBN32 | FLAG_ELF_LIBC6)
+# endif
#endif
#ifdef _DL_CACHE_DEFAULT_ID
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c b/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c
index 10f0ff702..fd57a735c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/readelflib.c
@@ -33,19 +33,32 @@ 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;
+ union
+ {
+ Elf64_Ehdr *eh64;
+ Elf32_Ehdr *eh32;
+ ElfW(Ehdr) *eh;
+ }
+ elf_header;
int ret;
- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
+ elf_header.eh = file_contents;
+ if (elf_header.eh->e_ident [EI_CLASS] == ELFCLASS32)
{
- Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
-
ret = process_elf32_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
+ if (!ret)
+ {
+ Elf32_Word flags = elf_header.eh32->e_flags;
+ int nan2008 = (flags & EF_MIPS_NAN2008) != 0;
- /* n32 libraries are always libc.so.6+. */
- if (!ret && (elf32_header->e_flags & EF_MIPS_ABI2) != 0)
- *flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
+ /* n32 libraries are always libc.so.6+, o32 only if 2008 NaN. */
+ if ((flags & EF_MIPS_ABI2) != 0)
+ *flag = (nan2008 ? FLAG_MIPS64_LIBN32_NAN2008
+ : FLAG_MIPS64_LIBN32) | FLAG_ELF_LIBC6;
+ else if (nan2008)
+ *flag = FLAG_MIPS_LIB32_NAN2008 | FLAG_ELF_LIBC6;
+ }
}
else
{
@@ -53,7 +66,13 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
file_contents, file_length);
/* n64 libraries are always libc.so.6+. */
if (!ret)
- *flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
+ {
+ Elf64_Word flags = elf_header.eh64->e_flags;
+ int nan2008 = (flags & EF_MIPS_NAN2008) != 0;
+
+ *flag = (nan2008 ? FLAG_MIPS64_LIBN64_NAN2008
+ : FLAG_MIPS64_LIBN64) | FLAG_ELF_LIBC6;
+ }
}
return ret;
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/Implies b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/Implies
deleted file mode 100644
index be4188aac..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/Implies
+++ /dev/null
@@ -1 +0,0 @@
-powerpc/powerpc32/e500/fpu
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext-extra.S b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext-extra.S
deleted file mode 100644
index 5966bc57b..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext-extra.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Save current context. Support for saving high parts of registers.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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, see
- <http://www.gnu.org/licenses/>. */
-
-/* We follow the kernel's layout, which saves the high parts of the
- SPE registers in the vregs area, immediately followed by the
- SPEFSCR value. */
-.macro getcontext_extra
- la r10,(_UC_VREGS)(r3)
- evstwwe r0,(0*4)(r10)
- evstwwe r1,(1*4)(r10)
- evstwwe r2,(2*4)(r10)
- evstwwe r3,(3*4)(r10)
- evstwwe r4,(4*4)(r10)
- evstwwe r5,(5*4)(r10)
- evstwwe r6,(6*4)(r10)
- evstwwe r7,(7*4)(r10)
- evstwwe r8,(8*4)(r10)
- evstwwe r9,(9*4)(r10)
- evstwwe r10,(10*4)(r10)
- evstwwe r11,(11*4)(r10)
- evstwwe r12,(12*4)(r10)
- evstwwe r13,(13*4)(r10)
- evstwwe r14,(14*4)(r10)
- evstwwe r15,(15*4)(r10)
- evstwwe r16,(16*4)(r10)
- evstwwe r17,(17*4)(r10)
- evstwwe r18,(18*4)(r10)
- evstwwe r19,(19*4)(r10)
- evstwwe r20,(20*4)(r10)
- evstwwe r21,(21*4)(r10)
- evstwwe r22,(22*4)(r10)
- evstwwe r23,(23*4)(r10)
- evstwwe r24,(24*4)(r10)
- evstwwe r25,(25*4)(r10)
- evstwwe r26,(26*4)(r10)
- evstwwe r27,(27*4)(r10)
- evstwwe r28,(28*4)(r10)
- evstwwe r29,(29*4)(r10)
- evstwwe r30,(30*4)(r10)
- evstwwe r31,(31*4)(r10)
- mfspefscr r9
- stw r9,(32*4)(r10)
-.endm
-#define __GETCONTEXT_EXTRA getcontext_extra
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext.S b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext.S
deleted file mode 100644
index 3b14fbc4d..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Save current context.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-#include <shlib-compat.h>
-
-#define __ASSEMBLY__
-#include <asm/ptrace.h>
-#include "ucontext_i.h"
-
-#define __CONTEXT_FUNC_NAME __getcontext
-#undef __CONTEXT_ENABLE_FPRS
-#undef __CONTEXT_ENABLE_VRS
-#include "getcontext-extra.S"
-
-#include "getcontext-common.S"
-
-versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
-
-#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
-
-/* For the nofpu case the old/new versions are the same function. */
-strong_alias (__getcontext, __novec_getcontext)
-
-compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
-
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
-
-#define _ERRNO_H 1
-#include <bits/errno.h>
-
- compat_text_section
-ENTRY (__getcontext_stub)
- li r3,ENOSYS
- b __syscall_error@local
-END (__getcontext_stub)
- .previous
-
-compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
-
-#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext.S b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext.S
deleted file mode 100644
index ebbde8d9d..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Jump to a new context.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-#include <shlib-compat.h>
-
-#define __ASSEMBLY__
-#include <asm/ptrace.h>
-#include "ucontext_i.h"
-
-#define __CONTEXT_FUNC_NAME __setcontext
-#undef __CONTEXT_ENABLE_FPRS
-#undef __CONTEXT_ENABLE_VRS
-#include "setcontext-extra.S"
-
-#include "setcontext-common.S"
-
-versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
-
-#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
-
-/* For the nofpu case the old/new versions are the same function. */
-strong_alias (__setcontext, __novec_setcontext)
-
-compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
-
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
-
-#define _ERRNO_H 1
-#include <bits/errno.h>
-
- compat_text_section
-ENTRY (__setcontext_stub)
- li r3,ENOSYS
- b __syscall_error@local
-END (__setcontext_stub)
- .previous
-
-compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_0)
-
-#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/swapcontext.S b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/swapcontext.S
deleted file mode 100644
index 5175d8658..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/swapcontext.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Save current context and jump to a new context.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-#include <shlib-compat.h>
-
-#define __ASSEMBLY__
-#include <asm/ptrace.h>
-#include "ucontext_i.h"
-
-#define __CONTEXT_FUNC_NAME __swapcontext
-#undef __CONTEXT_ENABLE_FPRS
-#undef __CONTEXT_ENABLE_VRS
-#include "getcontext-extra.S"
-#include "setcontext-extra.S"
-
-# include "swapcontext-common.S"
-
-versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
-
-#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
-
-/* For the nofpu case the old/new versions are the same function. */
-strong_alias (__swapcontext, __novec_swapcontext)
-
-compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
-
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
-
-#define _ERRNO_H 1
-#include <bits/errno.h>
-
- compat_text_section
-ENTRY (__swapcontext_stub)
- li r3,ENOSYS
- b __syscall_error@local
-END (__swapcontext_stub)
- .previous
-
-compat_symbol (libc, __swapcontext_stub, swapcontext, GLIBC_2_1)
-
-#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libc.abilist
deleted file mode 100644
index ca8b42943..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libc.abilist
+++ /dev/null
@@ -1,2478 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _IO_adjust_column F
- _IO_default_doallocate F
- _IO_default_finish F
- _IO_default_pbackfail F
- _IO_default_uflow F
- _IO_default_xsgetn F
- _IO_default_xsputn F
- _IO_do_write F
- _IO_doallocbuf F
- _IO_fclose F
- _IO_fdopen F
- _IO_feof F
- _IO_ferror F
- _IO_fflush F
- _IO_fgetpos F
- _IO_fgets F
- _IO_file_attach F
- _IO_file_close F
- _IO_file_close_it F
- _IO_file_doallocate F
- _IO_file_fopen F
- _IO_file_init F
- _IO_file_jumps D 0x54
- _IO_file_open F
- _IO_file_overflow F
- _IO_file_read F
- _IO_file_seek F
- _IO_file_seekoff F
- _IO_file_setbuf F
- _IO_file_stat F
- _IO_file_sync F
- _IO_file_underflow F
- _IO_file_write F
- _IO_file_xsputn F
- _IO_flockfile F
- _IO_flush_all F
- _IO_flush_all_linebuffered F
- _IO_fopen F
- _IO_fprintf F
- _IO_fputs F
- _IO_fread F
- _IO_free_backup_area F
- _IO_fsetpos F
- _IO_ftell F
- _IO_ftrylockfile F
- _IO_funlockfile F
- _IO_fwrite F
- _IO_getc F
- _IO_getline F
- _IO_gets F
- _IO_init F
- _IO_init_marker F
- _IO_link_in F
- _IO_list_all D 0x4
- _IO_marker_delta F
- _IO_marker_difference F
- _IO_padn F
- _IO_peekc_locked F
- _IO_popen F
- _IO_printf F
- _IO_proc_close F
- _IO_proc_open F
- _IO_putc F
- _IO_puts F
- _IO_remove_marker F
- _IO_seekmark F
- _IO_seekoff F
- _IO_seekpos F
- _IO_setb F
- _IO_setbuffer F
- _IO_setvbuf F
- _IO_sgetn F
- _IO_sprintf F
- _IO_sputbackc F
- _IO_sscanf F
- _IO_stderr_ D 0x50
- _IO_stdin_ D 0x50
- _IO_stdout_ D 0x50
- _IO_str_init_readonly F
- _IO_str_init_static F
- _IO_str_overflow F
- _IO_str_pbackfail F
- _IO_str_seekoff F
- _IO_str_underflow F
- _IO_sungetc F
- _IO_switch_to_get_mode F
- _IO_un_link F
- _IO_ungetc F
- _IO_unsave_markers F
- _IO_vfprintf F
- _IO_vfscanf F
- _IO_vsprintf F
- __adjtimex F
- __after_morecore_hook D 0x4
- __argz_count F
- __argz_next F
- __argz_stringify F
- __ashldi3 F
- __ashrdi3 F
- __assert_fail F
- __assert_perror_fail F
- __bsd_getpgrp F
- __bzero F
- __check_rhosts_file D 0x4
- __clone F
- __close F
- __cmpdi2 F
- __cmsg_nxthdr F
- __connect F
- __ctype32_b D 0x4
- __ctype_b D 0x4
- __ctype_get_mb_cur_max F
- __ctype_tolower D 0x4
- __ctype_toupper D 0x4
- __curbrk D 0x4
- __daylight D 0x4
- __dcgettext F
- __default_morecore F
- __dgettext F
- __divdi3 F
- __dup2 F
- __environ D 0x4
- __errno_location F
- __fcntl F
- __ffs F
- __finite F
- __finitef F
- __finitel F
- __fixdfdi F
- __fixsfdi F
- __fixunsdfdi F
- __fixunssfdi F
- __floatdidf F
- __floatdisf F
- __fork F
- __fpu_control D 0x4
- __free_hook D 0x4
- __fxstat F
- __getdelim F
- __getpagesize F
- __getpgid F
- __getpid F
- __gettimeofday F
- __gmtime_r F
- __h_errno_location F
- __isinf F
- __isinff F
- __isinfl F
- __isnan F
- __isnanf F
- __iswctype F
- __ivaliduser F
- __libc_calloc F
- __libc_free F
- __libc_init_first F
- __libc_mallinfo F
- __libc_malloc F
- __libc_mallopt F
- __libc_memalign F
- __libc_pvalloc F
- __libc_realloc F
- __libc_start_main F
- __libc_valloc F
- __lseek F
- __lshrdi3 F
- __lxstat F
- __malloc_hook D 0x4
- __malloc_initialize_hook D 0x4
- __mbrlen F
- __mbrtowc F
- __memalign_hook D 0x4
- __mempcpy F
- __moddi3 F
- __monstartup F
- __morecore D 0x4
- __nss_configure_lookup F
- __nss_database_lookup F
- __nss_group_lookup F
- __nss_hosts_lookup F
- __nss_next F
- __nss_passwd_lookup F
- __open F
- __overflow F
- __pipe F
- __printf_fp F
- __profile_frequency F
- __progname D 0x4
- __progname_full D 0x4
- __rcmd_errstr D 0x4
- __read F
- __realloc_hook D 0x4
- __res_randomid F
- __sbrk F
- __sched_get_priority_max F
- __sched_get_priority_min F
- __sched_getparam F
- __sched_getscheduler F
- __sched_setscheduler F
- __sched_yield F
- __secure_getenv F
- __select F
- __send F
- __setpgid F
- __sigaction F
- __sigaddset F
- __sigdelset F
- __sigismember F
- __sigpause F
- __sigsetjmp F
- __stpcpy F
- __stpncpy F
- __strcasecmp F
- __strdup F
- __strerror_r F
- __strtod_internal F
- __strtof_internal F
- __strtok_r F
- __strtol_internal F
- __strtold_internal F
- __strtoll_internal F
- __strtoq_internal F
- __strtoul_internal F
- __strtoull_internal F
- __strtouq_internal F
- __sysv_signal F
- __timezone D 0x4
- __tzname D 0x8
- __ucmpdi2 F
- __udivdi3 F
- __uflow F
- __umoddi3 F
- __underflow F
- __vfscanf F
- __vsnprintf F
- __vsscanf F
- __wait F
- __waitpid F
- __wcstod_internal F
- __wcstof_internal F
- __wcstol_internal F
- __wcstold_internal F
- __wcstoll_internal F
- __wcstoul_internal F
- __wcstoull_internal F
- __write F
- __xmknod F
- __xpg_basename F
- __xstat F
- _environ D 0x4
- _exit F
- _libc_intl_domainname D 0x5
- _longjmp F
- _mcleanup F
- _mcount F
- _nl_default_dirname D 0x12
- _nl_domain_bindings D 0x4
- _nl_msg_cat_cntr D 0x4
- _null_auth D 0xc
- _obstack D 0x4
- _obstack_allocated_p F
- _obstack_begin F
- _obstack_begin_1 F
- _obstack_free F
- _obstack_memory_used F
- _obstack_newchunk F
- _res D 0x200
- _rpc_dtablesize F
- _seterr_reply F
- _setjmp F
- _sys_errlist D 0x1ec
- _sys_nerr D 0x4
- _sys_siglist D 0x80
- _tolower F
- _toupper F
- a64l F
- abort F
- abs F
- accept F
- access F
- acct F
- addmntent F
- adjtime F
- adjtimex F
- advance F
- alarm F
- alphasort F
- argz_add F
- argz_add_sep F
- argz_append F
- argz_count F
- argz_create F
- argz_create_sep F
- argz_delete F
- argz_extract F
- argz_insert F
- argz_next F
- argz_replace F
- argz_stringify F
- asctime F
- asctime_r F
- asprintf F
- atexit F
- atof F
- atoi F
- atol F
- atoll F
- authnone_create F
- authunix_create F
- authunix_create_default F
- basename F
- bcmp F
- bcopy F
- bdflush F
- bind F
- bindresvport F
- bindtextdomain F
- brk F
- bsd_signal F
- bsearch F
- btowc F
- bzero F
- calloc F
- callrpc F
- canonicalize_file_name F
- catclose F
- catgets F
- catopen F
- cfgetispeed F
- cfgetospeed F
- cfmakeraw F
- cfree F
- cfsetispeed F
- cfsetospeed F
- cfsetspeed F
- chdir F
- chflags F
- chmod F
- chown F
- chroot F
- clearenv F
- clearerr F
- clearerr_unlocked F
- clnt_broadcast F
- clnt_create F
- clnt_pcreateerror F
- clnt_perrno F
- clnt_perror F
- clnt_spcreateerror F
- clnt_sperrno F
- clnt_sperror F
- clntraw_create F
- clnttcp_create F
- clntudp_bufcreate F
- clntudp_create F
- clock F
- clone F
- close F
- closedir F
- closelog F
- confstr F
- connect F
- copysign F
- copysignf F
- creat F
- create_module F
- ctermid F
- ctime F
- ctime_r F
- cuserid F
- daemon F
- daylight D 0x4
- dcgettext F
- delete_module F
- dgettext F
- difftime F
- dirfd F
- dirname F
- div F
- dprintf F
- drand48 F
- drand48_r F
- dup F
- dup2 F
- dysize F
- ecvt F
- ecvt_r F
- endaliasent F
- endfsent F
- endgrent F
- endhostent F
- endmntent F
- endnetent F
- endnetgrent F
- endprotoent F
- endpwent F
- endrpcent F
- endservent F
- endspent F
- endttyent F
- endusershell F
- endutent F
- environ D 0x4
- envz_add F
- envz_entry F
- envz_get F
- envz_merge F
- envz_remove F
- envz_strip F
- erand48 F
- erand48_r F
- err F
- error F
- error_at_line F
- error_message_count D 0x4
- error_one_per_line D 0x4
- error_print_progname D 0x4
- errx F
- ether_aton F
- ether_aton_r F
- ether_hostton F
- ether_line F
- ether_ntoa F
- ether_ntoa_r F
- ether_ntohost F
- euidaccess F
- execl F
- execle F
- execlp F
- execv F
- execve F
- execvp F
- exit F
- fchdir F
- fchflags F
- fchmod F
- fchown F
- fclose F
- fcloseall F
- fcntl F
- fcvt F
- fcvt_r F
- fdatasync F
- fdopen F
- feof F
- feof_unlocked F
- ferror F
- ferror_unlocked F
- fexecve F
- fflush F
- fflush_unlocked F
- ffs F
- fgetc F
- fgetgrent F
- fgetgrent_r F
- fgetpos F
- fgetpwent F
- fgetpwent_r F
- fgets F
- fgetspent F
- fgetspent_r F
- fileno F
- fileno_unlocked F
- finite F
- finitef F
- finitel F
- flock F
- flockfile F
- fnmatch F
- fopen F
- fopencookie F
- fork F
- fpathconf F
- fprintf F
- fputc F
- fputc_unlocked F
- fputs F
- fread F
- free F
- freeaddrinfo F
- freopen F
- frexp F
- frexpf F
- frexpl F
- fscanf F
- fseek F
- fsetpos F
- fstatfs F
- fsync F
- ftell F
- ftime F
- ftok F
- ftruncate F
- ftrylockfile F
- fts_children F
- fts_close F
- fts_open F
- fts_read F
- fts_set F
- ftw F
- funlockfile F
- fwrite F
- gcvt F
- get_avphys_pages F
- get_current_dir_name F
- get_kernel_syms F
- get_myaddress F
- get_nprocs F
- get_nprocs_conf F
- get_phys_pages F
- getaddrinfo F
- getaliasbyname F
- getaliasbyname_r F
- getaliasent F
- getaliasent_r F
- getc F
- getc_unlocked F
- getchar F
- getchar_unlocked F
- getcwd F
- getdelim F
- getdirentries F
- getdomainname F
- getdtablesize F
- getegid F
- getenv F
- geteuid F
- getfsent F
- getfsfile F
- getfsspec F
- getgid F
- getgrent F
- getgrent_r F
- getgrgid F
- getgrgid_r F
- getgrnam F
- getgrnam_r F
- getgroups F
- gethostbyaddr F
- gethostbyaddr_r F
- gethostbyname F
- gethostbyname2 F
- gethostbyname2_r F
- gethostbyname_r F
- gethostent F
- gethostent_r F
- gethostid F
- gethostname F
- getitimer F
- getline F
- getlogin F
- getlogin_r F
- getmntent F
- getmntent_r F
- getnetbyaddr F
- getnetbyaddr_r F
- getnetbyname F
- getnetbyname_r F
- getnetent F
- getnetent_r F
- getnetgrent F
- getnetgrent_r F
- getopt F
- getopt_long F
- getopt_long_only F
- getpagesize F
- getpass F
- getpeername F
- getpgid F
- getpgrp F
- getpid F
- getppid F
- getpriority F
- getprotobyname F
- getprotobyname_r F
- getprotobynumber F
- getprotobynumber_r F
- getprotoent F
- getprotoent_r F
- getpublickey F
- getpw F
- getpwent F
- getpwent_r F
- getpwnam F
- getpwnam_r F
- getpwuid F
- getpwuid_r F
- getresgid F
- getresuid F
- getrlimit F
- getrpcbyname F
- getrpcbyname_r F
- getrpcbynumber F
- getrpcbynumber_r F
- getrpcent F
- getrpcent_r F
- getrpcport F
- getrusage F
- gets F
- getsecretkey F
- getservbyname F
- getservbyname_r F
- getservbyport F
- getservbyport_r F
- getservent F
- getservent_r F
- getsid F
- getsockname F
- getsockopt F
- getspent F
- getspent_r F
- getspnam F
- getspnam_r F
- getsubopt F
- gettext F
- gettimeofday F
- getttyent F
- getttynam F
- getuid F
- getusershell F
- getutent F
- getutent_r F
- getutid F
- getutid_r F
- getutline F
- getutline_r F
- getw F
- getwd F
- glob F
- glob_pattern_p F
- globfree F
- gmtime F
- gmtime_r F
- group_member F
- gsignal F
- gtty F
- h_errlist D 0x14
- h_nerr D 0x4
- hasmntopt F
- hcreate F
- hcreate_r F
- hdestroy F
- hdestroy_r F
- herror F
- hsearch F
- hsearch_r F
- hstrerror F
- htonl F
- htons F
- index F
- inet_addr F
- inet_aton F
- inet_lnaof F
- inet_makeaddr F
- inet_netof F
- inet_network F
- inet_nsap_addr F
- inet_nsap_ntoa F
- inet_ntoa F
- inet_ntop F
- inet_pton F
- init_module F
- initgroups F
- initstate F
- initstate_r F
- innetgr F
- insque F
- ioctl F
- iruserok F
- isalnum F
- isalpha F
- isascii F
- isatty F
- isblank F
- iscntrl F
- isdigit F
- isfdtype F
- isgraph F
- isinf F
- isinff F
- isinfl F
- islower F
- isnan F
- isnanf F
- isprint F
- ispunct F
- isspace F
- isupper F
- iswalnum F
- iswalpha F
- iswcntrl F
- iswctype F
- iswdigit F
- iswgraph F
- iswlower F
- iswprint F
- iswpunct F
- iswspace F
- iswupper F
- iswxdigit F
- isxdigit F
- jrand48 F
- jrand48_r F
- kill F
- killpg F
- klogctl F
- l64a F
- labs F
- lchown F
- lckpwdf F
- lcong48 F
- lcong48_r F
- ldexp F
- ldexpf F
- ldexpl F
- ldiv F
- lfind F
- link F
- listen F
- llabs F
- lldiv F
- llseek F
- loc1 D 0x4
- loc2 D 0x4
- localeconv F
- localtime F
- localtime_r F
- lockf F
- locs D 0x4
- longjmp F
- lrand48 F
- lrand48_r F
- lsearch F
- lseek F
- madvise F
- mallinfo F
- malloc F
- malloc_get_state F
- malloc_set_state F
- malloc_stats F
- malloc_trim F
- malloc_usable_size F
- mallopt F
- mallwatch D 0x4
- mblen F
- mbrlen F
- mbrtowc F
- mbsinit F
- mbsnrtowcs F
- mbsrtowcs F
- mbstowcs F
- mbtowc F
- mcheck F
- memalign F
- memccpy F
- memchr F
- memcmp F
- memcpy F
- memfrob F
- memmem F
- memmove F
- memset F
- mkdir F
- mkfifo F
- mkstemp F
- mktemp F
- mktime F
- mlock F
- mlockall F
- mmap F
- modf F
- modff F
- modfl F
- monstartup F
- mount F
- mprobe F
- mprotect F
- mrand48 F
- mrand48_r F
- mremap F
- msgctl F
- msgget F
- msgrcv F
- msgsnd F
- msync F
- mtrace F
- munlock F
- munlockall F
- munmap F
- muntrace F
- nanosleep F
- nfsservctl F
- nice F
- nl_langinfo F
- nrand48 F
- nrand48_r F
- ntohl F
- ntohs F
- obstack_alloc_failed_handler D 0x4
- obstack_exit_failure D 0x4
- obstack_free F
- obstack_printf F
- obstack_vprintf F
- on_exit F
- open F
- open_memstream F
- opendir F
- openlog F
- optarg D 0x4
- opterr D 0x4
- optind D 0x4
- optopt D 0x4
- parse_printf_format F
- pathconf F
- pause F
- pclose F
- perror F
- personality F
- pipe F
- pmap_getmaps F
- pmap_getport F
- pmap_rmtcall F
- pmap_set F
- pmap_unset F
- poll F
- popen F
- prctl F
- printf F
- profil F
- program_invocation_name D 0x4
- program_invocation_short_name D 0x4
- pselect F
- psignal F
- pthread_attr_destroy F
- pthread_attr_getdetachstate F
- pthread_attr_getinheritsched F
- pthread_attr_getschedparam F
- pthread_attr_getschedpolicy F
- pthread_attr_getscope F
- pthread_attr_init F
- pthread_attr_setdetachstate F
- pthread_attr_setinheritsched F
- pthread_attr_setschedparam F
- pthread_attr_setschedpolicy F
- pthread_attr_setscope F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- pthread_condattr_destroy F
- pthread_condattr_init F
- pthread_equal F
- pthread_exit F
- pthread_getschedparam F
- pthread_mutex_destroy F
- pthread_mutex_init F
- pthread_mutex_lock F
- pthread_mutex_unlock F
- pthread_self F
- pthread_setcancelstate F
- pthread_setcanceltype F
- pthread_setschedparam F
- ptrace F
- putc F
- putc_unlocked F
- putchar F
- putchar_unlocked F
- putenv F
- putpwent F
- puts F
- putspent F
- pututline F
- putw F
- pvalloc F
- qecvt F
- qecvt_r F
- qfcvt F
- qfcvt_r F
- qgcvt F
- qsort F
- query_module F
- quotactl F
- raise F
- rand F
- rand_r F
- random F
- random_r F
- rcmd F
- re_comp F
- re_compile_fastmap F
- re_compile_pattern F
- re_exec F
- re_match F
- re_match_2 F
- re_max_failures D 0x4
- re_search F
- re_search_2 F
- re_set_registers F
- re_set_syntax F
- re_syntax_options D 0x4
- read F
- readdir F
- readdir_r F
- readlink F
- readv F
- realloc F
- realpath F
- reboot F
- recv F
- recvfrom F
- recvmsg F
- regcomp F
- regerror F
- regexec F
- regfree F
- register_printf_function F
- registerrpc F
- remove F
- remque F
- rename F
- res_init F
- revoke F
- rewind F
- rewinddir F
- rexec F
- rexecoptions D 0x4
- rindex F
- rmdir F
- rpc_createerr D 0x10
- rpmatch F
- rresvport F
- ruserok F
- ruserpass F
- sbrk F
- scalbn F
- scalbnf F
- scalbnl F
- scandir F
- scanf F
- sched_get_priority_max F
- sched_get_priority_min F
- sched_getparam F
- sched_getscheduler F
- sched_rr_get_interval F
- sched_setparam F
- sched_setscheduler F
- sched_yield F
- seed48 F
- seed48_r F
- seekdir F
- select F
- semctl F
- semget F
- semop F
- send F
- sendmsg F
- sendto F
- setaliasent F
- setbuf F
- setbuffer F
- setcontext F
- setdomainname F
- setegid F
- setenv F
- seteuid F
- setfsent F
- setfsgid F
- setfsuid F
- setgid F
- setgrent F
- setgroups F
- sethostent F
- sethostid F
- sethostname F
- setitimer F
- setjmp F
- setlinebuf F
- setlocale F
- setlogin F
- setlogmask F
- setmntent F
- setnetent F
- setnetgrent F
- setpgid F
- setpgrp F
- setpriority F
- setprotoent F
- setpwent F
- setregid F
- setresgid F
- setresuid F
- setreuid F
- setrlimit F
- setrpcent F
- setservent F
- setsid F
- setsockopt F
- setspent F
- setstate F
- setstate_r F
- settimeofday F
- setttyent F
- setuid F
- setusershell F
- setutent F
- setvbuf F
- sgetspent F
- sgetspent_r F
- shmat F
- shmctl F
- shmdt F
- shmget F
- shutdown F
- sigaction F
- sigaddset F
- sigaltstack F
- sigandset F
- sigblock F
- sigdelset F
- sigemptyset F
- sigfillset F
- siggetmask F
- siginterrupt F
- sigisemptyset F
- sigismember F
- siglongjmp F
- signal F
- sigorset F
- sigpause F
- sigpending F
- sigprocmask F
- sigreturn F
- sigsetmask F
- sigstack F
- sigsuspend F
- sigvec F
- sigwait F
- sleep F
- snprintf F
- socket F
- socketpair F
- sprintf F
- srand F
- srand48 F
- srand48_r F
- srandom F
- srandom_r F
- sscanf F
- ssignal F
- sstk F
- statfs F
- stderr D 0x4
- stdin D 0x4
- stdout D 0x4
- step F
- stime F
- stpcpy F
- stpncpy F
- strcasecmp F
- strcat F
- strchr F
- strcmp F
- strcoll F
- strcpy F
- strcspn F
- strdup F
- strerror F
- strerror_r F
- strfmon F
- strfry F
- strftime F
- strlen F
- strncasecmp F
- strncat F
- strncmp F
- strncpy F
- strndup F
- strnlen F
- strpbrk F
- strptime F
- strrchr F
- strsep F
- strsignal F
- strspn F
- strstr F
- strtod F
- strtof F
- strtok F
- strtok_r F
- strtol F
- strtold F
- strtoll F
- strtoq F
- strtoul F
- strtoull F
- strtouq F
- strxfrm F
- stty F
- svc_exit F
- svc_fdset D 0x80
- svc_getreq F
- svc_getreqset F
- svc_register F
- svc_run F
- svc_sendreply F
- svc_unregister F
- svcauthdes_stats D 0xc
- svcerr_auth F
- svcerr_decode F
- svcerr_noproc F
- svcerr_noprog F
- svcerr_progvers F
- svcerr_systemerr F
- svcerr_weakauth F
- svcfd_create F
- svcraw_create F
- svctcp_create F
- svcudp_bufcreate F
- svcudp_create F
- svcudp_enablecache F
- swab F
- swapoff F
- swapon F
- symlink F
- sync F
- sys_errlist D 0x1ec
- sys_nerr D 0x4
- sys_sigabbrev D 0x80
- sys_siglist D 0x80
- syscall F
- sysconf F
- sysctl F
- sysinfo F
- syslog F
- system F
- tcdrain F
- tcflow F
- tcflush F
- tcgetattr F
- tcgetpgrp F
- tcsendbreak F
- tcsetattr F
- tcsetpgrp F
- tdelete F
- telldir F
- tempnam F
- textdomain F
- tfind F
- time F
- timegm F
- timelocal F
- times F
- timezone D 0x4
- tmpfile F
- tmpnam F
- tmpnam_r F
- toascii F
- tolower F
- toupper F
- towctrans F
- towlower F
- towupper F
- tr_break F
- truncate F
- tsearch F
- ttyname F
- ttyname_r F
- ttyslot F
- twalk F
- tzname D 0x8
- tzset F
- ualarm F
- ulckpwdf F
- ulimit F
- umask F
- umount F
- uname F
- ungetc F
- unlink F
- unsetenv F
- updwtmp F
- uselib F
- usleep F
- ustat F
- utime F
- utimes F
- utmpname F
- valloc F
- vasprintf F
- vdprintf F
- verr F
- verrx F
- vfork F
- vfprintf F
- vfscanf F
- vhangup F
- vlimit F
- vprintf F
- vscanf F
- vsnprintf F
- vsprintf F
- vsscanf F
- vsyslog F
- vtimes F
- vwarn F
- vwarnx F
- wait F
- wait3 F
- wait4 F
- waitpid F
- warn F
- warnx F
- wcpcpy F
- wcpncpy F
- wcrtomb F
- wcscat F
- wcschr F
- wcscmp F
- wcscoll F
- wcscpy F
- wcscspn F
- wcsdup F
- wcslen F
- wcsncat F
- wcsncmp F
- wcsncpy F
- wcsnrtombs F
- wcspbrk F
- wcsrchr F
- wcsrtombs F
- wcsspn F
- wcsstr F
- wcstod F
- wcstof F
- wcstok F
- wcstol F
- wcstold F
- wcstombs F
- wcstoq F
- wcstoul F
- wcstouq F
- wcswidth F
- wcsxfrm F
- wctob F
- wctomb F
- wctrans F
- wctype F
- wcwidth F
- wmemchr F
- wmemcmp F
- wmemcpy F
- wmemmove F
- wmemset F
- write F
- writev F
- xdr_accepted_reply F
- xdr_array F
- xdr_authunix_parms F
- xdr_bool F
- xdr_bytes F
- xdr_callhdr F
- xdr_callmsg F
- xdr_char F
- xdr_cryptkeyarg F
- xdr_cryptkeyarg2 F
- xdr_cryptkeyres F
- xdr_des_block F
- xdr_double F
- xdr_enum F
- xdr_float F
- xdr_free F
- xdr_int F
- xdr_key_netstarg F
- xdr_key_netstres F
- xdr_keybuf F
- xdr_keystatus F
- xdr_long F
- xdr_netobj F
- xdr_opaque F
- xdr_opaque_auth F
- xdr_pmap F
- xdr_pmaplist F
- xdr_pointer F
- xdr_reference F
- xdr_rejected_reply F
- xdr_replymsg F
- xdr_rmtcall_args F
- xdr_rmtcallres F
- xdr_short F
- xdr_string F
- xdr_u_char F
- xdr_u_int F
- xdr_u_long F
- xdr_u_short F
- xdr_union F
- xdr_vector F
- xdr_void F
- xdr_wrapstring F
- xdrmem_create F
- xdrrec_create F
- xdrrec_endofrecord F
- xdrrec_eof F
- xdrrec_skiprecord F
- xdrstdio_create F
- xencrypt F
- xprt_register F
- xprt_unregister F
-GLIBC_2.1
- GLIBC_2.1 A
- _IO_2_1_stderr_ D 0xa0
- _IO_2_1_stdin_ D 0xa0
- _IO_2_1_stdout_ D 0xa0
- _IO_do_write F
- _IO_fclose F
- _IO_fdopen F
- _IO_fgetpos64 F
- _IO_file_attach F
- _IO_file_close_it F
- _IO_file_finish F
- _IO_file_fopen F
- _IO_file_init F
- _IO_file_overflow F
- _IO_file_seekoff F
- _IO_file_setbuf F
- _IO_file_sync F
- _IO_file_underflow F
- _IO_file_write F
- _IO_file_xsputn F
- _IO_fopen F
- _IO_fsetpos64 F
- _IO_getline_info F
- _IO_popen F
- _IO_proc_close F
- _IO_proc_open F
- __asprintf F
- __backtrace F
- __backtrace_symbols F
- __backtrace_symbols_fd F
- __duplocale F
- __freelocale F
- __fxstat64 F
- __isalnum_l F
- __isalpha_l F
- __isascii_l F
- __isblank_l F
- __iscntrl_l F
- __isdigit_l F
- __isgraph_l F
- __islower_l F
- __isprint_l F
- __ispunct_l F
- __isspace_l F
- __isupper_l F
- __iswalnum_l F
- __iswalpha_l F
- __iswblank_l F
- __iswcntrl_l F
- __iswctype_l F
- __iswdigit_l F
- __iswgraph_l F
- __iswlower_l F
- __iswprint_l F
- __iswpunct_l F
- __iswspace_l F
- __iswupper_l F
- __iswxdigit_l F
- __isxdigit_l F
- __key_decryptsession_pk_LOCAL D 0x4
- __key_encryptsession_pk_LOCAL D 0x4
- __key_gendes_LOCAL D 0x4
- __libc_allocate_rtsig F
- __libc_current_sigrtmax F
- __libc_current_sigrtmin F
- __libc_freeres F
- __libc_sa_len F
- __lxstat64 F
- __newlocale F
- __poll F
- __pread64 F
- __pwrite64 F
- __rawmemchr F
- __signbit F
- __signbitf F
- __strcasecmp_l F
- __strcasestr F
- __strcoll_l F
- __strfmon_l F
- __strncasecmp_l F
- __strtod_l F
- __strtof_l F
- __strtol_l F
- __strtold_l F
- __strtoll_l F
- __strtoul_l F
- __strtoull_l F
- __strxfrm_l F
- __toascii_l F
- __tolower_l F
- __toupper_l F
- __towctrans F
- __towctrans_l F
- __towlower_l F
- __towupper_l F
- __wcscasecmp_l F
- __wcscoll_l F
- __wcsncasecmp_l F
- __wcstod_l F
- __wcstof_l F
- __wcstol_l F
- __wcstold_l F
- __wcstoll_l F
- __wcstoul_l F
- __wcstoull_l F
- __wcsxfrm_l F
- __wctype_l F
- __xstat64 F
- _authenticate F
- _dl_mcount_wrapper F
- _dl_mcount_wrapper_check F
- _sys_errlist D 0x1f4
- _sys_nerr D 0x4
- _sys_siglist D 0x100
- addseverity F
- alphasort64 F
- argp_err_exit_status D 0x4
- argp_error F
- argp_failure F
- argp_help F
- argp_parse F
- argp_program_bug_address D 0x4
- argp_program_version D 0x4
- argp_program_version_hook D 0x4
- argp_state_help F
- argp_usage F
- authdes_create F
- authdes_getucred F
- authdes_pk_create F
- backtrace F
- backtrace_symbols F
- backtrace_symbols_fd F
- capget F
- capset F
- cbc_crypt F
- chown F
- clntunix_create F
- creat64 F
- des_setparity F
- ecb_crypt F
- endutxent F
- fattach F
- fclose F
- fdetach F
- fdopen F
- ffsl F
- ffsll F
- fgetc_unlocked F
- fgetpos64 F
- fgets_unlocked F
- fmtmsg F
- fopen F
- fopen64 F
- fputs_unlocked F
- fread_unlocked F
- freopen64 F
- fseeko F
- fseeko64 F
- fsetpos64 F
- fstatfs64 F
- fstatvfs F
- fstatvfs64 F
- ftello F
- ftello64 F
- ftruncate64 F
- ftw64 F
- fwrite_unlocked F
- gai_strerror F
- getcontext F
- getdate F
- getdate_err D 0x4
- getdate_r F
- getmsg F
- getnameinfo F
- getnetname F
- getpmsg F
- getpt F
- getrlimit64 F
- getutxent F
- getutxid F
- getutxline F
- glob64 F
- globfree64 F
- gnu_get_libc_release F
- gnu_get_libc_version F
- grantpt F
- host2netname F
- iconv F
- iconv_close F
- iconv_open F
- if_freenameindex F
- if_indextoname F
- if_nameindex F
- if_nametoindex F
- in6addr_any D 0x10
- in6addr_loopback D 0x10
- isastream F
- iswblank F
- key_decryptsession F
- key_decryptsession_pk F
- key_encryptsession F
- key_encryptsession_pk F
- key_gendes F
- key_get_conv F
- key_secretkey_is_set F
- key_setnet F
- key_setsecret F
- lockf64 F
- lseek64 F
- makecontext F
- mempcpy F
- mmap64 F
- netname2host F
- netname2user F
- nftw F
- nftw64 F
- ntp_adjtime F
- ntp_gettime F
- open64 F
- passwd2des F
- pclose F
- popen F
- pread F
- pread64 F
- printf_size F
- printf_size_info F
- pthread_attr_init F
- ptsname F
- ptsname_r F
- putgrent F
- putmsg F
- putpmsg F
- pututxline F
- pwrite F
- pwrite64 F
- rawmemchr F
- readdir64 F
- readdir64_r F
- rtime F
- scandir64 F
- sendfile F
- setrlimit64 F
- setutxent F
- sighold F
- sigignore F
- sigqueue F
- sigrelse F
- sigset F
- sigtimedwait F
- sigwaitinfo F
- statfs64 F
- statvfs F
- statvfs64 F
- strcasestr F
- strtoimax F
- strtoumax F
- strverscmp F
- svcunix_create F
- svcunixfd_create F
- swapcontext F
- sys_errlist D 0x1f4
- sys_nerr D 0x4
- sys_sigabbrev D 0x100
- sys_siglist D 0x100
- sysv_signal F
- tcgetsid F
- tdestroy F
- tmpfile F
- tmpfile64 F
- truncate64 F
- umount2 F
- unlockpt F
- updwtmpx F
- user2netname F
- utmpxname F
- versionsort F
- versionsort64 F
- waitid F
- wcscasecmp F
- wcsncasecmp F
- wcsnlen F
- wcstoimax F
- wcstoll F
- wcstoull F
- wcstoumax F
- wcswcs F
- wordexp F
- wordfree F
- xdecrypt F
- xdr_authdes_cred F
- xdr_authdes_verf F
- xdr_getcredres F
- xdr_int16_t F
- xdr_int32_t F
- xdr_int8_t F
- xdr_netnamestr F
- xdr_sizeof F
- xdr_uint16_t F
- xdr_uint32_t F
- xdr_uint8_t F
- xdr_unixcred F
-GLIBC_2.1.1
- GLIBC_2.1.1 A
- _Exit F
- __mempcpy_small F
- __stpcpy_small F
- __strcpy_small F
- __strcspn_c1 F
- __strcspn_c2 F
- __strcspn_c3 F
- __strpbrk_c2 F
- __strpbrk_c3 F
- __strsep_1c F
- __strsep_2c F
- __strsep_3c F
- __strsep_g F
- __strspn_c1 F
- __strspn_c2 F
- __strspn_c3 F
- __strtok_r_1c F
- __strverscmp F
- getutmp F
- getutmpx F
- imaxabs F
- imaxdiv F
- strchrnul F
- xdr_hyper F
- xdr_int64_t F
- xdr_longlong_t F
- xdr_u_hyper F
- xdr_u_longlong_t F
- xdr_uint64_t F
-GLIBC_2.1.2
- GLIBC_2.1.2 A
- __vfork F
- getaliasbyname_r F
- getaliasent_r F
- getgrent_r F
- getgrgid_r F
- getgrnam_r F
- gethostbyaddr_r F
- gethostbyname2_r F
- gethostbyname_r F
- gethostent_r F
- getnetbyaddr_r F
- getnetbyname_r F
- getnetent_r F
- getprotobyname_r F
- getprotobynumber_r F
- getprotoent_r F
- getpwent_r F
- getpwnam_r F
- getpwuid_r F
- getrpcbyname_r F
- getrpcbynumber_r F
- getrpcent_r F
- getservbyname_r F
- getservbyport_r F
- getservent_r F
- getspent_r F
- getspnam_r F
-GLIBC_2.1.3
- GLIBC_2.1.3 A
- __cxa_atexit F
- __cxa_finalize F
- __sigsuspend F
-GLIBC_2.10
- GLIBC_2.10 A
- __cxa_at_quick_exit F
- __posix_getopt F
- accept4 F
- endsgent F
- fallocate F
- fgetsgent F
- fgetsgent_r F
- getsgent F
- getsgent_r F
- getsgnam F
- getsgnam_r F
- malloc_info F
- preadv F
- preadv64 F
- psiginfo F
- putsgent F
- pwritev F
- pwritev64 F
- quick_exit F
- register_printf_modifier F
- register_printf_specifier F
- register_printf_type F
- setsgent F
- sgetsgent F
- sgetsgent_r F
-GLIBC_2.11
- GLIBC_2.11 A
- __longjmp_chk F
- execvpe F
- fallocate64 F
- mkostemps F
- mkostemps64 F
- mkstemps F
- mkstemps64 F
-GLIBC_2.12
- GLIBC_2.12 A
- _sys_errlist D 0x21c
- _sys_nerr D 0x4
- ntp_gettimex F
- recvmmsg F
- sys_errlist D 0x21c
- sys_nerr D 0x4
-GLIBC_2.13
- GLIBC_2.13 A
- fanotify_init F
- fanotify_mark F
- prlimit F
- prlimit64 F
-GLIBC_2.14
- GLIBC_2.14 A
- clock_adjtime F
- name_to_handle_at F
- open_by_handle_at F
- sendmmsg F
- setns F
- syncfs F
-GLIBC_2.15
- GLIBC_2.15 A
- __fdelt_chk F
- __fdelt_warn F
- posix_spawn F
- posix_spawnp F
- process_vm_readv F
- process_vm_writev F
- scandirat F
- scandirat64 F
-GLIBC_2.16
- GLIBC_2.16 A
- __getauxval F
- __mcount_internal F
- __poll_chk F
- __ppoll_chk F
- aligned_alloc F
- c16rtomb F
- c32rtomb F
- getauxval F
- mbrtoc16 F
- mbrtoc32 F
- timespec_get F
-GLIBC_2.17
- GLIBC_2.17 A
- __ppc_get_timebase_freq F
- clock_getcpuclockid F
- clock_getres F
- clock_gettime F
- clock_nanosleep F
- clock_settime F
- secure_getenv F
-GLIBC_2.18
- GLIBC_2.18 A
- __cxa_thread_atexit_impl F
-GLIBC_2.2
- GLIBC_2.2 A
- _IO_adjust_wcolumn F
- _IO_fgetpos F
- _IO_fgetpos64 F
- _IO_free_wbackup_area F
- _IO_fsetpos F
- _IO_fsetpos64 F
- _IO_init_wmarker F
- _IO_iter_begin F
- _IO_iter_end F
- _IO_iter_file F
- _IO_iter_next F
- _IO_least_wmarker F
- _IO_list_lock F
- _IO_list_resetlock F
- _IO_list_unlock F
- _IO_seekwmark F
- _IO_sputbackwc F
- _IO_sungetwc F
- _IO_switch_to_main_wget_area F
- _IO_switch_to_wbackup_area F
- _IO_switch_to_wget_mode F
- _IO_unsave_wmarkers F
- _IO_wdefault_doallocate F
- _IO_wdefault_finish F
- _IO_wdefault_pbackfail F
- _IO_wdefault_uflow F
- _IO_wdefault_xsgetn F
- _IO_wdefault_xsputn F
- _IO_wdo_write F
- _IO_wdoallocbuf F
- _IO_wfile_jumps D 0x54
- _IO_wfile_overflow F
- _IO_wfile_seekoff F
- _IO_wfile_sync F
- _IO_wfile_underflow F
- _IO_wfile_xsputn F
- _IO_wmarker_delta F
- _IO_wsetb F
- __assert F
- __ctype32_tolower D 0x4
- __ctype32_toupper D 0x4
- __cyg_profile_func_enter F
- __cyg_profile_func_exit F
- __endmntent F
- __fbufsize F
- __flbf F
- __fpending F
- __fpurge F
- __freadable F
- __freading F
- __fsetlocking F
- __fwritable F
- __fwriting F
- __fxstat64 F
- __getmntent_r F
- __lxstat64 F
- __nl_langinfo_l F
- __open64 F
- __res_init F
- __res_nclose F
- __res_ninit F
- __res_state F
- __setmntent F
- __statfs F
- __strndup F
- __sysconf F
- __sysctl F
- __wctrans_l F
- __woverflow F
- __wuflow F
- __wunderflow F
- __xpg_sigpause F
- __xstat64 F
- _flushlbf F
- _res_hconf D 0x30
- bind_textdomain_codeset F
- dcngettext F
- dngettext F
- fgetpos F
- fgetpos64 F
- fgetwc F
- fgetwc_unlocked F
- fgetws F
- fgetws_unlocked F
- fmemopen F
- fopencookie F
- fputwc F
- fputwc_unlocked F
- fputws F
- fputws_unlocked F
- fsetpos F
- fsetpos64 F
- fwide F
- fwprintf F
- fwscanf F
- getdirentries64 F
- getloadavg F
- getrlimit F
- getrlimit64 F
- getwc F
- getwc_unlocked F
- getwchar F
- getwchar_unlocked F
- glob64 F
- iruserok_af F
- localeconv F
- mcheck_check_all F
- mcheck_pedantic F
- memrchr F
- mincore F
- mkdtemp F
- mkstemp64 F
- moncontrol F
- msgctl F
- ngettext F
- posix_fadvise F
- posix_fadvise64 F
- posix_fallocate F
- posix_fallocate64 F
- posix_madvise F
- posix_memalign F
- posix_spawn F
- posix_spawn_file_actions_addclose F
- posix_spawn_file_actions_adddup2 F
- posix_spawn_file_actions_addopen F
- posix_spawn_file_actions_destroy F
- posix_spawn_file_actions_init F
- posix_spawnattr_destroy F
- posix_spawnattr_getflags F
- posix_spawnattr_getpgroup F
- posix_spawnattr_getschedparam F
- posix_spawnattr_getschedpolicy F
- posix_spawnattr_getsigdefault F
- posix_spawnattr_getsigmask F
- posix_spawnattr_init F
- posix_spawnattr_setflags F
- posix_spawnattr_setpgroup F
- posix_spawnattr_setschedparam F
- posix_spawnattr_setschedpolicy F
- posix_spawnattr_setsigdefault F
- posix_spawnattr_setsigmask F
- posix_spawnp F
- putwc F
- putwc_unlocked F
- putwchar F
- putwchar_unlocked F
- rcmd_af F
- readdir64 F
- readdir64_r F
- rexec_af F
- rresvport_af F
- ruserok_af F
- scandir64 F
- semctl F
- setrlimit F
- shmctl F
- svc_getreq_common F
- svc_getreq_poll F
- svc_max_pollfd D 0x4
- svc_pollfd D 0x4
- swprintf F
- swscanf F
- ungetwc F
- vfwprintf F
- vfwscanf F
- vswprintf F
- vswscanf F
- vwprintf F
- vwscanf F
- wcschrnul F
- wcsftime F
- wmempcpy F
- wprintf F
- wscanf F
-GLIBC_2.2.1
- GLIBC_2.2.1 A
- pivot_root F
- posix_openpt F
-GLIBC_2.2.2
- GLIBC_2.2.2 A
- __nss_hostname_digits_dots F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- __rpc_thread_createerr F
- __rpc_thread_svc_fdset F
- __rpc_thread_svc_max_pollfd F
- __rpc_thread_svc_pollfd F
- fnmatch F
- sprofil F
-GLIBC_2.2.4
- GLIBC_2.2.4 A
- dl_iterate_phdr F
- getgrouplist F
- sockatmark F
-GLIBC_2.2.6
- GLIBC_2.2.6 A
- __nanosleep F
-GLIBC_2.3
- GLIBC_2.3 A
- __ctype_b_loc F
- __ctype_tolower_loc F
- __ctype_toupper_loc F
- __isctype F
- __strftime_l F
- __uselocale F
- __wcsftime_l F
- _sys_errlist D 0x1f8
- _sys_nerr D 0x4
- duplocale F
- fgetxattr F
- flistxattr F
- freeifaddrs F
- freelocale F
- fremovexattr F
- fsetxattr F
- futimes F
- getifaddrs F
- getxattr F
- isalnum_l F
- isalpha_l F
- isblank_l F
- iscntrl_l F
- isctype F
- isdigit_l F
- isgraph_l F
- islower_l F
- isprint_l F
- ispunct_l F
- isspace_l F
- isupper_l F
- iswalnum_l F
- iswalpha_l F
- iswblank_l F
- iswcntrl_l F
- iswctype_l F
- iswdigit_l F
- iswgraph_l F
- iswlower_l F
- iswprint_l F
- iswpunct_l F
- iswspace_l F
- iswupper_l F
- iswxdigit_l F
- isxdigit_l F
- lgetxattr F
- listxattr F
- llistxattr F
- lremovexattr F
- lsetxattr F
- lutimes F
- newlocale F
- nl_langinfo_l F
- readahead F
- realpath F
- removexattr F
- sendfile64 F
- setxattr F
- strcasecmp_l F
- strcoll_l F
- strfmon_l F
- strftime_l F
- strncasecmp_l F
- strtod_l F
- strtof_l F
- strtol_l F
- strtold_l F
- strtoll_l F
- strtoul_l F
- strtoull_l F
- strxfrm_l F
- sys_errlist D 0x1f8
- sys_nerr D 0x4
- tolower_l F
- toupper_l F
- towctrans_l F
- towlower_l F
- towupper_l F
- uselocale F
- wcscasecmp_l F
- wcscoll_l F
- wcsftime_l F
- wcsncasecmp_l F
- wcstod_l F
- wcstof_l F
- wcstol_l F
- wcstold_l F
- wcstoll_l F
- wcstoul_l F
- wcstoull_l F
- wcsxfrm_l F
- wctrans_l F
- wctype_l F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- __register_atfork F
- epoll_create F
- epoll_ctl F
- epoll_wait F
- lchmod F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- strptime_l F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- _sys_siglist D 0x104
- atosfix16 F
- atosfix32 F
- atosfix64 F
- atoufix16 F
- atoufix32 F
- atoufix64 F
- getcontext F
- gnu_dev_major F
- gnu_dev_makedev F
- gnu_dev_minor F
- inet6_option_alloc F
- inet6_option_append F
- inet6_option_find F
- inet6_option_init F
- inet6_option_next F
- inet6_option_space F
- makecontext F
- nftw F
- nftw64 F
- posix_fadvise64 F
- posix_fallocate64 F
- remap_file_pages F
- sched_getaffinity F
- sched_setaffinity F
- semtimedop F
- setcontext F
- strtosfix16 F
- strtosfix32 F
- strtosfix64 F
- strtoufix16 F
- strtoufix32 F
- strtoufix64 F
- swapcontext F
- sys_sigabbrev D 0x104
- sys_siglist D 0x104
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- __chk_fail F
- __fprintf_chk F
- __gets_chk F
- __memcpy_chk F
- __memmove_chk F
- __mempcpy_chk F
- __memset_chk F
- __printf_chk F
- __sigsetjmp F
- __snprintf_chk F
- __sprintf_chk F
- __stpcpy_chk F
- __strcat_chk F
- __strcpy_chk F
- __strncat_chk F
- __strncpy_chk F
- __vfprintf_chk F
- __vprintf_chk F
- __vsnprintf_chk F
- __vsprintf_chk F
- __xpg_strerror_r F
- _longjmp F
- _setjmp F
- getcontext F
- getipv4sourcefilter F
- getsourcefilter F
- longjmp F
- makecontext F
- regexec F
- sched_getaffinity F
- sched_setaffinity F
- setcontext F
- setipv4sourcefilter F
- setjmp F
- setsourcefilter F
- siglongjmp F
- swapcontext F
- xdr_quad_t F
- xdr_u_quad_t F
-GLIBC_2.4
- GLIBC_2.4 A
- _IO_fprintf F
- _IO_printf F
- _IO_sprintf F
- _IO_sscanf F
- _IO_vfprintf F
- _IO_vfscanf F
- _IO_vsprintf F
- __asprintf F
- __confstr_chk F
- __fgets_chk F
- __fgets_unlocked_chk F
- __fgetws_chk F
- __fgetws_unlocked_chk F
- __finitel F
- __fprintf_chk F
- __fwprintf_chk F
- __fxstatat F
- __fxstatat64 F
- __getcwd_chk F
- __getdomainname_chk F
- __getgroups_chk F
- __gethostname_chk F
- __getlogin_r_chk F
- __getwd_chk F
- __isinfl F
- __isnanl F
- __mbsnrtowcs_chk F
- __mbsrtowcs_chk F
- __mbstowcs_chk F
- __nldbl__IO_fprintf F
- __nldbl__IO_printf F
- __nldbl__IO_sprintf F
- __nldbl__IO_sscanf F
- __nldbl__IO_vfprintf F
- __nldbl__IO_vfscanf F
- __nldbl__IO_vsprintf F
- __nldbl___asprintf F
- __nldbl___fprintf_chk F
- __nldbl___fwprintf_chk F
- __nldbl___printf_chk F
- __nldbl___printf_fp F
- __nldbl___snprintf_chk F
- __nldbl___sprintf_chk F
- __nldbl___strfmon_l F
- __nldbl___swprintf_chk F
- __nldbl___syslog_chk F
- __nldbl___vfprintf_chk F
- __nldbl___vfscanf F
- __nldbl___vfwprintf_chk F
- __nldbl___vprintf_chk F
- __nldbl___vsnprintf F
- __nldbl___vsnprintf_chk F
- __nldbl___vsprintf_chk F
- __nldbl___vsscanf F
- __nldbl___vstrfmon F
- __nldbl___vstrfmon_l F
- __nldbl___vswprintf_chk F
- __nldbl___vsyslog_chk F
- __nldbl___vwprintf_chk F
- __nldbl___wprintf_chk F
- __nldbl_asprintf F
- __nldbl_dprintf F
- __nldbl_fprintf F
- __nldbl_fscanf F
- __nldbl_fwprintf F
- __nldbl_fwscanf F
- __nldbl_obstack_printf F
- __nldbl_obstack_vprintf F
- __nldbl_printf F
- __nldbl_printf_size F
- __nldbl_scanf F
- __nldbl_snprintf F
- __nldbl_sprintf F
- __nldbl_sscanf F
- __nldbl_strfmon F
- __nldbl_strfmon_l F
- __nldbl_swprintf F
- __nldbl_swscanf F
- __nldbl_syslog F
- __nldbl_vasprintf F
- __nldbl_vdprintf F
- __nldbl_vfprintf F
- __nldbl_vfscanf F
- __nldbl_vfwprintf F
- __nldbl_vfwscanf F
- __nldbl_vprintf F
- __nldbl_vscanf F
- __nldbl_vsnprintf F
- __nldbl_vsprintf F
- __nldbl_vsscanf F
- __nldbl_vswprintf F
- __nldbl_vswscanf F
- __nldbl_vsyslog F
- __nldbl_vwprintf F
- __nldbl_vwscanf F
- __nldbl_wprintf F
- __nldbl_wscanf F
- __pread64_chk F
- __pread_chk F
- __printf_chk F
- __printf_fp F
- __ptsname_r_chk F
- __read_chk F
- __readlink_chk F
- __realpath_chk F
- __recv_chk F
- __recvfrom_chk F
- __signbitl F
- __snprintf_chk F
- __sprintf_chk F
- __stack_chk_fail F
- __stpncpy_chk F
- __strfmon_l F
- __strtold_internal F
- __strtold_l F
- __swprintf_chk F
- __syslog_chk F
- __ttyname_r_chk F
- __vfprintf_chk F
- __vfscanf F
- __vfwprintf_chk F
- __vprintf_chk F
- __vsnprintf F
- __vsnprintf_chk F
- __vsprintf_chk F
- __vsscanf F
- __vswprintf_chk F
- __vsyslog_chk F
- __vwprintf_chk F
- __wcpcpy_chk F
- __wcpncpy_chk F
- __wcrtomb_chk F
- __wcscat_chk F
- __wcscpy_chk F
- __wcsncat_chk F
- __wcsncpy_chk F
- __wcsnrtombs_chk F
- __wcsrtombs_chk F
- __wcstold_internal F
- __wcstold_l F
- __wcstombs_chk F
- __wctomb_chk F
- __wmemcpy_chk F
- __wmemmove_chk F
- __wmempcpy_chk F
- __wmemset_chk F
- __wprintf_chk F
- __xmknodat F
- _sys_errlist D 0x210
- _sys_nerr D 0x4
- asprintf F
- copysignl F
- dprintf F
- eaccess F
- faccessat F
- fchmodat F
- fchownat F
- fdopendir F
- finitel F
- fprintf F
- frexpl F
- fscanf F
- futimesat F
- fwprintf F
- fwscanf F
- inotify_add_watch F
- inotify_init F
- inotify_rm_watch F
- isinfl F
- isnanl F
- ldexpl F
- linkat F
- mkdirat F
- mkfifoat F
- modfl F
- obstack_printf F
- obstack_vprintf F
- open_wmemstream F
- openat F
- openat64 F
- ppoll F
- printf F
- printf_size F
- qecvt F
- qecvt_r F
- qfcvt F
- qfcvt_r F
- qgcvt F
- readlinkat F
- renameat F
- scalbnl F
- scanf F
- snprintf F
- sprintf F
- sscanf F
- strfmon F
- strfmon_l F
- strtold F
- strtold_l F
- swprintf F
- swscanf F
- symlinkat F
- sys_errlist D 0x210
- sys_nerr D 0x4
- syslog F
- unlinkat F
- unshare F
- vasprintf F
- vdprintf F
- vfprintf F
- vfscanf F
- vfwprintf F
- vfwscanf F
- vprintf F
- vscanf F
- vsnprintf F
- vsprintf F
- vsscanf F
- vswprintf F
- vswscanf F
- vsyslog F
- vwprintf F
- vwscanf F
- wcstold F
- wcstold_l F
- wprintf F
- wscanf F
-GLIBC_2.5
- GLIBC_2.5 A
- __readlinkat_chk F
- inet6_opt_append F
- inet6_opt_find F
- inet6_opt_finish F
- inet6_opt_get_val F
- inet6_opt_init F
- inet6_opt_next F
- inet6_opt_set_val F
- inet6_rth_add F
- inet6_rth_getaddr F
- inet6_rth_init F
- inet6_rth_reverse F
- inet6_rth_segments F
- inet6_rth_space F
- splice F
- tee F
- vmsplice F
-GLIBC_2.6
- GLIBC_2.6 A
- __sched_cpucount F
- epoll_pwait F
- futimens F
- sched_getcpu F
- strerror_l F
- sync_file_range F
- utimensat F
-GLIBC_2.7
- GLIBC_2.7 A
- __fread_chk F
- __fread_unlocked_chk F
- __isoc99_fscanf F
- __isoc99_fwscanf F
- __isoc99_scanf F
- __isoc99_sscanf F
- __isoc99_swscanf F
- __isoc99_vfscanf F
- __isoc99_vfwscanf F
- __isoc99_vscanf F
- __isoc99_vsscanf F
- __isoc99_vswscanf F
- __isoc99_vwscanf F
- __isoc99_wscanf F
- __nldbl___isoc99_fscanf F
- __nldbl___isoc99_fwscanf F
- __nldbl___isoc99_scanf F
- __nldbl___isoc99_sscanf F
- __nldbl___isoc99_swscanf F
- __nldbl___isoc99_vfscanf F
- __nldbl___isoc99_vfwscanf F
- __nldbl___isoc99_vscanf F
- __nldbl___isoc99_vsscanf F
- __nldbl___isoc99_vswscanf F
- __nldbl___isoc99_vwscanf F
- __nldbl___isoc99_wscanf F
- __open64_2 F
- __open_2 F
- __openat64_2 F
- __openat_2 F
- __sched_cpualloc F
- __sched_cpufree F
- eventfd F
- eventfd_read F
- eventfd_write F
- mkostemp F
- mkostemp64 F
- signalfd F
-GLIBC_2.8
- GLIBC_2.8 A
- __asprintf_chk F
- __dprintf_chk F
- __nldbl___asprintf_chk F
- __nldbl___dprintf_chk F
- __nldbl___obstack_printf_chk F
- __nldbl___obstack_vprintf_chk F
- __nldbl___vasprintf_chk F
- __nldbl___vdprintf_chk F
- __obstack_printf_chk F
- __obstack_vprintf_chk F
- __vasprintf_chk F
- __vdprintf_chk F
- qsort_r F
- timerfd_create F
- timerfd_gettime F
- timerfd_settime F
-GLIBC_2.9
- GLIBC_2.9 A
- dup3 F
- epoll_create1 F
- inotify_init1 F
- pipe2 F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libm.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libm.abilist
deleted file mode 100644
index b4a3f66a3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libm.abilist
+++ /dev/null
@@ -1,503 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _LIB_VERSION D 0x4
- acos F
- acosf F
- acosh F
- acoshf F
- acoshl F
- acosl F
- asin F
- asinf F
- asinh F
- asinhf F
- asinhl F
- asinl F
- atan F
- atan2 F
- atan2f F
- atan2l F
- atanf F
- atanh F
- atanhf F
- atanhl F
- atanl F
- cbrt F
- cbrtf F
- cbrtl F
- ceil F
- ceilf F
- copysign F
- copysignf F
- cos F
- cosf F
- cosh F
- coshf F
- coshl F
- cosl F
- drem F
- dremf F
- dreml F
- erf F
- erfc F
- erfcf F
- erfcl F
- erff F
- erfl F
- exp F
- expf F
- expl F
- expm1 F
- expm1f F
- expm1l F
- fabs F
- fabsf F
- finite F
- finitef F
- finitel F
- floor F
- floorf F
- fmod F
- fmodf F
- fmodl F
- frexp F
- frexpf F
- frexpl F
- gamma F
- gammaf F
- gammal F
- hypot F
- hypotf F
- hypotl F
- ilogb F
- ilogbf F
- ilogbl F
- j0 F
- j0f F
- j0l F
- j1 F
- j1f F
- j1l F
- jn F
- jnf F
- jnl F
- ldexp F
- ldexpf F
- ldexpl F
- lgamma F
- lgamma_r F
- lgammaf F
- lgammaf_r F
- lgammal F
- lgammal_r F
- log F
- log10 F
- log10f F
- log10l F
- log1p F
- log1pf F
- log1pl F
- logb F
- logbf F
- logbl F
- logf F
- logl F
- matherr F
- modf F
- modff F
- modfl F
- nextafter F
- nextafterf F
- nextafterl F
- pow F
- powf F
- powl F
- remainder F
- remainderf F
- remainderl F
- rint F
- rintf F
- scalb F
- scalbf F
- scalbl F
- scalbn F
- scalbnf F
- scalbnl F
- signgam D 0x4
- significand F
- significandf F
- significandl F
- sin F
- sinf F
- sinh F
- sinhf F
- sinhl F
- sinl F
- sqrt F
- sqrtf F
- tan F
- tanf F
- tanh F
- tanhf F
- tanhl F
- tanl F
- y0 F
- y0f F
- y0l F
- y1 F
- y1f F
- y1l F
- yn F
- ynf F
- ynl F
-GLIBC_2.1
- GLIBC_2.1 A
- __clog10 F
- __clog10f F
- __clog10l F
- __fe_dfl_env D 0x8
- __fe_enabled_env D 0x8
- __fe_nomask_env F
- __finite F
- __finitef F
- __finitel F
- __fpclassify F
- __fpclassifyf F
- __signbit F
- __signbitf F
- cabs F
- cabsf F
- cabsl F
- cacos F
- cacosf F
- cacosh F
- cacoshf F
- cacoshl F
- cacosl F
- carg F
- cargf F
- cargl F
- casin F
- casinf F
- casinh F
- casinhf F
- casinhl F
- casinl F
- catan F
- catanf F
- catanh F
- catanhf F
- catanhl F
- catanl F
- ccos F
- ccosf F
- ccosh F
- ccoshf F
- ccoshl F
- ccosl F
- cexp F
- cexpf F
- cexpl F
- cimag F
- cimagf F
- cimagl F
- clog F
- clog10 F
- clog10f F
- clog10l F
- clogf F
- clogl F
- conj F
- conjf F
- conjl F
- cpow F
- cpowf F
- cpowl F
- cproj F
- cprojf F
- cprojl F
- creal F
- crealf F
- creall F
- csin F
- csinf F
- csinh F
- csinhf F
- csinhl F
- csinl F
- csqrt F
- csqrtf F
- csqrtl F
- ctan F
- ctanf F
- ctanh F
- ctanhf F
- ctanhl F
- ctanl F
- exp10 F
- exp10f F
- exp10l F
- exp2 F
- exp2f F
- fdim F
- fdimf F
- feclearexcept F
- fegetenv F
- fegetexceptflag F
- fegetround F
- feholdexcept F
- feraiseexcept F
- fesetenv F
- fesetexceptflag F
- fesetround F
- fetestexcept F
- feupdateenv F
- fma F
- fmaf F
- fmal F
- fmax F
- fmaxf F
- fmin F
- fminf F
- llrint F
- llrintf F
- llround F
- llroundf F
- log2 F
- log2f F
- log2l F
- lrint F
- lrintf F
- lround F
- lroundf F
- nan F
- nanf F
- nanl F
- nearbyint F
- nearbyintf F
- nearbyintl F
- nexttoward F
- nexttowardf F
- nexttowardl F
- pow10 F
- pow10f F
- pow10l F
- remquo F
- remquof F
- remquol F
- round F
- roundf F
- scalbln F
- scalblnf F
- scalblnl F
- sincos F
- sincosf F
- sincosl F
- tgamma F
- tgammaf F
- tgammal F
- trunc F
- truncf F
-GLIBC_2.15
- GLIBC_2.15 A
- __acos_finite F
- __acosf_finite F
- __acosh_finite F
- __acoshf_finite F
- __acoshl_finite F
- __acosl_finite F
- __asin_finite F
- __asinf_finite F
- __asinl_finite F
- __atan2_finite F
- __atan2f_finite F
- __atan2l_finite F
- __atanh_finite F
- __atanhf_finite F
- __atanhl_finite F
- __cosh_finite F
- __coshf_finite F
- __coshl_finite F
- __exp10_finite F
- __exp10f_finite F
- __exp10l_finite F
- __exp2_finite F
- __exp2f_finite F
- __exp2l_finite F
- __exp_finite F
- __expf_finite F
- __expl_finite F
- __fmod_finite F
- __fmodf_finite F
- __fmodl_finite F
- __gamma_r_finite F
- __gammaf_r_finite F
- __gammal_r_finite F
- __hypot_finite F
- __hypotf_finite F
- __hypotl_finite F
- __j0_finite F
- __j0f_finite F
- __j0l_finite F
- __j1_finite F
- __j1f_finite F
- __j1l_finite F
- __jn_finite F
- __jnf_finite F
- __jnl_finite F
- __lgamma_r_finite F
- __lgammaf_r_finite F
- __lgammal_r_finite F
- __log10_finite F
- __log10f_finite F
- __log10l_finite F
- __log2_finite F
- __log2f_finite F
- __log2l_finite F
- __log_finite F
- __logf_finite F
- __logl_finite F
- __pow_finite F
- __powf_finite F
- __powl_finite F
- __remainder_finite F
- __remainderf_finite F
- __remainderl_finite F
- __scalb_finite F
- __scalbf_finite F
- __scalbl_finite F
- __sinh_finite F
- __sinhf_finite F
- __sinhl_finite F
- __sqrt_finite F
- __sqrtf_finite F
- __sqrtl_finite F
- __y0_finite F
- __y0f_finite F
- __y0l_finite F
- __y1_finite F
- __y1f_finite F
- __y1l_finite F
- __yn_finite F
- __ynf_finite F
- __ynl_finite F
-GLIBC_2.18
- GLIBC_2.18 A
- __issignaling F
- __issignalingf F
- __issignalingl F
-GLIBC_2.2
- GLIBC_2.2 A
- feclearexcept F
- fedisableexcept F
- feenableexcept F
- fegetenv F
- fegetexcept F
- fegetexceptflag F
- fesetenv F
- fesetexceptflag F
- feupdateenv F
-GLIBC_2.4
- GLIBC_2.4 A
- __clog10l F
- __finitel F
- __fpclassifyl F
- __nldbl_nexttowardf F
- __signbitl F
- acoshl F
- acosl F
- asinhl F
- asinl F
- atan2l F
- atanhl F
- atanl F
- cabsl F
- cacoshl F
- cacosl F
- cargl F
- casinhl F
- casinl F
- catanhl F
- catanl F
- cbrtl F
- ccoshl F
- ccosl F
- ceill F
- cexpl F
- cimagl F
- clog10l F
- clogl F
- conjl F
- copysignl F
- coshl F
- cosl F
- cpowl F
- cprojl F
- creall F
- csinhl F
- csinl F
- csqrtl F
- ctanhl F
- ctanl F
- dreml F
- erfcl F
- erfl F
- exp10l F
- exp2l F
- expl F
- expm1l F
- fabsl F
- fdiml F
- finitel F
- floorl F
- fmal F
- fmaxl F
- fminl F
- fmodl F
- frexpl F
- gammal F
- hypotl F
- ilogbl F
- j0l F
- j1l F
- jnl F
- ldexpl F
- lgammal F
- lgammal_r F
- llrintl F
- llroundl F
- log10l F
- log1pl F
- log2l F
- logbl F
- logl F
- lrintl F
- lroundl F
- modfl F
- nanl F
- nearbyintl F
- nextafterl F
- nexttoward F
- nexttowardf F
- nexttowardl F
- pow10l F
- powl F
- remainderl F
- remquol F
- rintl F
- roundl F
- scalbl F
- scalblnl F
- scalbnl F
- significandl F
- sincosl F
- sinhl F
- sinl F
- sqrtl F
- tanhl F
- tanl F
- tgammal F
- truncl F
- y0l F
- y1l F
- ynl F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/localplt.data b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/localplt.data
deleted file mode 100644
index 12cd6f143..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/localplt.data
+++ /dev/null
@@ -1,13 +0,0 @@
-libc.so: __signbit
-libc.so: __signbitl
-libc.so: abort ?
-libc.so: calloc
-libc.so: free
-libc.so: malloc
-libc.so: memalign
-libc.so: realloc
-libm.so: __signbit
-libm.so: __signbitf
-libm.so: __signbitl
-libm.so: fegetround
-libm.so: matherr
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/shlib-versions b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/shlib-versions
deleted file mode 100644
index 2ea2298f2..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/shlib-versions
+++ /dev/null
@@ -1 +0,0 @@
-powerpc.*-.*-.* ABI powerpce500v2-linux-gnu
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/Implies b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/Implies
deleted file mode 100644
index ec387963f..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/Implies
+++ /dev/null
@@ -1 +0,0 @@
-powerpc/powerpc32/e500/soft-fp
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/c++-types.data b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/c++-types.data
deleted file mode 100644
index fde53bf33..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/c++-types.data
+++ /dev/null
@@ -1,67 +0,0 @@
-blkcnt64_t:x
-blkcnt_t:l
-blksize_t:l
-caddr_t:Pc
-clockid_t:i
-clock_t:l
-daddr_t:i
-dev_t:y
-fd_mask:l
-fsblkcnt64_t:y
-fsblkcnt_t:m
-fsfilcnt64_t:y
-fsfilcnt_t:m
-fsid_t:8__fsid_t
-gid_t:j
-id_t:j
-ino64_t:y
-ino_t:m
-int16_t:s
-int32_t:i
-int64_t:x
-int8_t:a
-intptr_t:i
-key_t:i
-loff_t:x
-mode_t:j
-nlink_t:j
-off64_t:x
-off_t:l
-pid_t:i
-pthread_attr_t:14pthread_attr_t
-pthread_barrier_t:17pthread_barrier_t
-pthread_barrierattr_t:21pthread_barrierattr_t
-pthread_cond_t:14pthread_cond_t
-pthread_condattr_t:18pthread_condattr_t
-pthread_key_t:j
-pthread_mutex_t:15pthread_mutex_t
-pthread_mutexattr_t:19pthread_mutexattr_t
-pthread_once_t:i
-pthread_rwlock_t:16pthread_rwlock_t
-pthread_rwlockattr_t:20pthread_rwlockattr_t
-pthread_spinlock_t:i
-pthread_t:m
-quad_t:x
-register_t:i
-rlim64_t:y
-rlim_t:m
-sigset_t:10__sigset_t
-size_t:j
-socklen_t:j
-ssize_t:i
-suseconds_t:l
-time_t:l
-u_char:h
-uid_t:j
-uint:j
-u_int:j
-u_int16_t:t
-u_int32_t:j
-u_int64_t:y
-u_int8_t:h
-ulong:m
-u_long:m
-u_quad_t:y
-useconds_t:j
-ushort:t
-u_short:t
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/ld.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/ld.abilist
deleted file mode 100644
index d71611f02..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/ld.abilist
+++ /dev/null
@@ -1,17 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __libc_memalign F
- _r_debug D 0x14
- calloc F
- free F
- malloc F
- realloc F
-GLIBC_2.1
- GLIBC_2.1 A
- __libc_stack_end D 0x4
- _dl_mcount F
-GLIBC_2.3
- GLIBC_2.3 A
- __tls_get_addr F
-GLIBC_2.4
- GLIBC_2.4 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libBrokenLocale.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libBrokenLocale.abilist
deleted file mode 100644
index f4ca37f44..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libBrokenLocale.abilist
+++ /dev/null
@@ -1,3 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __ctype_get_mb_cur_max F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libanl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libanl.abilist
deleted file mode 100644
index c9755d8a3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libanl.abilist
+++ /dev/null
@@ -1,6 +0,0 @@
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- gai_cancel F
- gai_error F
- gai_suspend F
- getaddrinfo_a F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libc.abilist
deleted file mode 100644
index a9410c836..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libc.abilist
+++ /dev/null
@@ -1,2499 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _IO_adjust_column F
- _IO_default_doallocate F
- _IO_default_finish F
- _IO_default_pbackfail F
- _IO_default_uflow F
- _IO_default_xsgetn F
- _IO_default_xsputn F
- _IO_do_write F
- _IO_doallocbuf F
- _IO_fclose F
- _IO_fdopen F
- _IO_feof F
- _IO_ferror F
- _IO_fflush F
- _IO_fgetpos F
- _IO_fgets F
- _IO_file_attach F
- _IO_file_close F
- _IO_file_close_it F
- _IO_file_doallocate F
- _IO_file_fopen F
- _IO_file_init F
- _IO_file_jumps D 0x54
- _IO_file_open F
- _IO_file_overflow F
- _IO_file_read F
- _IO_file_seek F
- _IO_file_seekoff F
- _IO_file_setbuf F
- _IO_file_stat F
- _IO_file_sync F
- _IO_file_underflow F
- _IO_file_write F
- _IO_file_xsputn F
- _IO_flockfile F
- _IO_flush_all F
- _IO_flush_all_linebuffered F
- _IO_fopen F
- _IO_fprintf F
- _IO_fputs F
- _IO_fread F
- _IO_free_backup_area F
- _IO_fsetpos F
- _IO_ftell F
- _IO_ftrylockfile F
- _IO_funlockfile F
- _IO_fwrite F
- _IO_getc F
- _IO_getline F
- _IO_gets F
- _IO_init F
- _IO_init_marker F
- _IO_link_in F
- _IO_list_all D 0x4
- _IO_marker_delta F
- _IO_marker_difference F
- _IO_padn F
- _IO_peekc_locked F
- _IO_popen F
- _IO_printf F
- _IO_proc_close F
- _IO_proc_open F
- _IO_putc F
- _IO_puts F
- _IO_remove_marker F
- _IO_seekmark F
- _IO_seekoff F
- _IO_seekpos F
- _IO_setb F
- _IO_setbuffer F
- _IO_setvbuf F
- _IO_sgetn F
- _IO_sprintf F
- _IO_sputbackc F
- _IO_sscanf F
- _IO_stderr_ D 0x50
- _IO_stdin_ D 0x50
- _IO_stdout_ D 0x50
- _IO_str_init_readonly F
- _IO_str_init_static F
- _IO_str_overflow F
- _IO_str_pbackfail F
- _IO_str_seekoff F
- _IO_str_underflow F
- _IO_sungetc F
- _IO_switch_to_get_mode F
- _IO_un_link F
- _IO_ungetc F
- _IO_unsave_markers F
- _IO_vfprintf F
- _IO_vfscanf F
- _IO_vsprintf F
- __adjtimex F
- __after_morecore_hook D 0x4
- __argz_count F
- __argz_next F
- __argz_stringify F
- __ashldi3 F
- __ashrdi3 F
- __assert_fail F
- __assert_perror_fail F
- __bsd_getpgrp F
- __bzero F
- __check_rhosts_file D 0x4
- __clone F
- __close F
- __cmpdi2 F
- __cmsg_nxthdr F
- __connect F
- __ctype32_b D 0x4
- __ctype_b D 0x4
- __ctype_get_mb_cur_max F
- __ctype_tolower D 0x4
- __ctype_toupper D 0x4
- __curbrk D 0x4
- __daylight D 0x4
- __dcgettext F
- __default_morecore F
- __dgettext F
- __divdi3 F
- __dup2 F
- __environ D 0x4
- __errno_location F
- __fcntl F
- __ffs F
- __finite F
- __finitef F
- __finitel F
- __fixdfdi F
- __fixsfdi F
- __fixunsdfdi F
- __fixunssfdi F
- __floatdidf F
- __floatdisf F
- __fork F
- __fpu_control D 0x4
- __free_hook D 0x4
- __fxstat F
- __getdelim F
- __getpagesize F
- __getpgid F
- __getpid F
- __gettimeofday F
- __gmtime_r F
- __h_errno_location F
- __isinf F
- __isinff F
- __isinfl F
- __isnan F
- __isnanf F
- __iswctype F
- __ivaliduser F
- __libc_calloc F
- __libc_free F
- __libc_init_first F
- __libc_mallinfo F
- __libc_malloc F
- __libc_mallopt F
- __libc_memalign F
- __libc_pvalloc F
- __libc_realloc F
- __libc_start_main F
- __libc_valloc F
- __lseek F
- __lshrdi3 F
- __lxstat F
- __malloc_hook D 0x4
- __malloc_initialize_hook D 0x4
- __mbrlen F
- __mbrtowc F
- __memalign_hook D 0x4
- __mempcpy F
- __moddi3 F
- __monstartup F
- __morecore D 0x4
- __nss_configure_lookup F
- __nss_database_lookup F
- __nss_group_lookup F
- __nss_hosts_lookup F
- __nss_next F
- __nss_passwd_lookup F
- __open F
- __overflow F
- __pipe F
- __printf_fp F
- __profile_frequency F
- __progname D 0x4
- __progname_full D 0x4
- __rcmd_errstr D 0x4
- __read F
- __realloc_hook D 0x4
- __res_randomid F
- __sbrk F
- __sched_get_priority_max F
- __sched_get_priority_min F
- __sched_getparam F
- __sched_getscheduler F
- __sched_setscheduler F
- __sched_yield F
- __secure_getenv F
- __select F
- __send F
- __setpgid F
- __sigaction F
- __sigaddset F
- __sigdelset F
- __sigismember F
- __sigpause F
- __sigsetjmp F
- __stpcpy F
- __stpncpy F
- __strcasecmp F
- __strdup F
- __strerror_r F
- __strtod_internal F
- __strtof_internal F
- __strtok_r F
- __strtol_internal F
- __strtold_internal F
- __strtoll_internal F
- __strtoq_internal F
- __strtoul_internal F
- __strtoull_internal F
- __strtouq_internal F
- __sysv_signal F
- __timezone D 0x4
- __tzname D 0x8
- __ucmpdi2 F
- __udivdi3 F
- __uflow F
- __umoddi3 F
- __underflow F
- __vfscanf F
- __vsnprintf F
- __vsscanf F
- __wait F
- __waitpid F
- __wcstod_internal F
- __wcstof_internal F
- __wcstol_internal F
- __wcstold_internal F
- __wcstoll_internal F
- __wcstoul_internal F
- __wcstoull_internal F
- __write F
- __xmknod F
- __xpg_basename F
- __xstat F
- _environ D 0x4
- _exit F
- _libc_intl_domainname D 0x5
- _longjmp F
- _mcleanup F
- _mcount F
- _nl_default_dirname D 0x12
- _nl_domain_bindings D 0x4
- _nl_msg_cat_cntr D 0x4
- _null_auth D 0xc
- _obstack D 0x4
- _obstack_allocated_p F
- _obstack_begin F
- _obstack_begin_1 F
- _obstack_free F
- _obstack_memory_used F
- _obstack_newchunk F
- _res D 0x200
- _rpc_dtablesize F
- _seterr_reply F
- _setjmp F
- _sys_errlist D 0x1ec
- _sys_nerr D 0x4
- _sys_siglist D 0x80
- _tolower F
- _toupper F
- a64l F
- abort F
- abs F
- accept F
- access F
- acct F
- addmntent F
- adjtime F
- adjtimex F
- advance F
- alarm F
- alphasort F
- argz_add F
- argz_add_sep F
- argz_append F
- argz_count F
- argz_create F
- argz_create_sep F
- argz_delete F
- argz_extract F
- argz_insert F
- argz_next F
- argz_replace F
- argz_stringify F
- asctime F
- asctime_r F
- asprintf F
- atexit F
- atof F
- atoi F
- atol F
- atoll F
- authnone_create F
- authunix_create F
- authunix_create_default F
- basename F
- bcmp F
- bcopy F
- bdflush F
- bind F
- bindresvport F
- bindtextdomain F
- brk F
- bsd_signal F
- bsearch F
- btowc F
- bzero F
- calloc F
- callrpc F
- canonicalize_file_name F
- catclose F
- catgets F
- catopen F
- cfgetispeed F
- cfgetospeed F
- cfmakeraw F
- cfree F
- cfsetispeed F
- cfsetospeed F
- cfsetspeed F
- chdir F
- chflags F
- chmod F
- chown F
- chroot F
- clearenv F
- clearerr F
- clearerr_unlocked F
- clnt_broadcast F
- clnt_create F
- clnt_pcreateerror F
- clnt_perrno F
- clnt_perror F
- clnt_spcreateerror F
- clnt_sperrno F
- clnt_sperror F
- clntraw_create F
- clnttcp_create F
- clntudp_bufcreate F
- clntudp_create F
- clock F
- clone F
- close F
- closedir F
- closelog F
- confstr F
- connect F
- copysign F
- copysignf F
- creat F
- create_module F
- ctermid F
- ctime F
- ctime_r F
- cuserid F
- daemon F
- daylight D 0x4
- dcgettext F
- delete_module F
- dgettext F
- difftime F
- dirfd F
- dirname F
- div F
- dprintf F
- drand48 F
- drand48_r F
- dup F
- dup2 F
- dysize F
- ecvt F
- ecvt_r F
- endaliasent F
- endfsent F
- endgrent F
- endhostent F
- endmntent F
- endnetent F
- endnetgrent F
- endprotoent F
- endpwent F
- endrpcent F
- endservent F
- endspent F
- endttyent F
- endusershell F
- endutent F
- environ D 0x4
- envz_add F
- envz_entry F
- envz_get F
- envz_merge F
- envz_remove F
- envz_strip F
- erand48 F
- erand48_r F
- err F
- error F
- error_at_line F
- error_message_count D 0x4
- error_one_per_line D 0x4
- error_print_progname D 0x4
- errx F
- ether_aton F
- ether_aton_r F
- ether_hostton F
- ether_line F
- ether_ntoa F
- ether_ntoa_r F
- ether_ntohost F
- euidaccess F
- execl F
- execle F
- execlp F
- execv F
- execve F
- execvp F
- exit F
- fchdir F
- fchflags F
- fchmod F
- fchown F
- fclose F
- fcloseall F
- fcntl F
- fcvt F
- fcvt_r F
- fdatasync F
- fdopen F
- feof F
- feof_unlocked F
- ferror F
- ferror_unlocked F
- fexecve F
- fflush F
- fflush_unlocked F
- ffs F
- fgetc F
- fgetgrent F
- fgetgrent_r F
- fgetpos F
- fgetpwent F
- fgetpwent_r F
- fgets F
- fgetspent F
- fgetspent_r F
- fileno F
- fileno_unlocked F
- finite F
- finitef F
- finitel F
- flock F
- flockfile F
- fnmatch F
- fopen F
- fopencookie F
- fork F
- fpathconf F
- fprintf F
- fputc F
- fputc_unlocked F
- fputs F
- fread F
- free F
- freeaddrinfo F
- freopen F
- frexp F
- frexpf F
- frexpl F
- fscanf F
- fseek F
- fsetpos F
- fstatfs F
- fsync F
- ftell F
- ftime F
- ftok F
- ftruncate F
- ftrylockfile F
- fts_children F
- fts_close F
- fts_open F
- fts_read F
- fts_set F
- ftw F
- funlockfile F
- fwrite F
- gcvt F
- get_avphys_pages F
- get_current_dir_name F
- get_kernel_syms F
- get_myaddress F
- get_nprocs F
- get_nprocs_conf F
- get_phys_pages F
- getaddrinfo F
- getaliasbyname F
- getaliasbyname_r F
- getaliasent F
- getaliasent_r F
- getc F
- getc_unlocked F
- getchar F
- getchar_unlocked F
- getcwd F
- getdelim F
- getdirentries F
- getdomainname F
- getdtablesize F
- getegid F
- getenv F
- geteuid F
- getfsent F
- getfsfile F
- getfsspec F
- getgid F
- getgrent F
- getgrent_r F
- getgrgid F
- getgrgid_r F
- getgrnam F
- getgrnam_r F
- getgroups F
- gethostbyaddr F
- gethostbyaddr_r F
- gethostbyname F
- gethostbyname2 F
- gethostbyname2_r F
- gethostbyname_r F
- gethostent F
- gethostent_r F
- gethostid F
- gethostname F
- getitimer F
- getline F
- getlogin F
- getlogin_r F
- getmntent F
- getmntent_r F
- getnetbyaddr F
- getnetbyaddr_r F
- getnetbyname F
- getnetbyname_r F
- getnetent F
- getnetent_r F
- getnetgrent F
- getnetgrent_r F
- getopt F
- getopt_long F
- getopt_long_only F
- getpagesize F
- getpass F
- getpeername F
- getpgid F
- getpgrp F
- getpid F
- getppid F
- getpriority F
- getprotobyname F
- getprotobyname_r F
- getprotobynumber F
- getprotobynumber_r F
- getprotoent F
- getprotoent_r F
- getpublickey F
- getpw F
- getpwent F
- getpwent_r F
- getpwnam F
- getpwnam_r F
- getpwuid F
- getpwuid_r F
- getresgid F
- getresuid F
- getrlimit F
- getrpcbyname F
- getrpcbyname_r F
- getrpcbynumber F
- getrpcbynumber_r F
- getrpcent F
- getrpcent_r F
- getrpcport F
- getrusage F
- gets F
- getsecretkey F
- getservbyname F
- getservbyname_r F
- getservbyport F
- getservbyport_r F
- getservent F
- getservent_r F
- getsid F
- getsockname F
- getsockopt F
- getspent F
- getspent_r F
- getspnam F
- getspnam_r F
- getsubopt F
- gettext F
- gettimeofday F
- getttyent F
- getttynam F
- getuid F
- getusershell F
- getutent F
- getutent_r F
- getutid F
- getutid_r F
- getutline F
- getutline_r F
- getw F
- getwd F
- glob F
- glob_pattern_p F
- globfree F
- gmtime F
- gmtime_r F
- group_member F
- gsignal F
- gtty F
- h_errlist D 0x14
- h_nerr D 0x4
- hasmntopt F
- hcreate F
- hcreate_r F
- hdestroy F
- hdestroy_r F
- herror F
- hsearch F
- hsearch_r F
- hstrerror F
- htonl F
- htons F
- index F
- inet_addr F
- inet_aton F
- inet_lnaof F
- inet_makeaddr F
- inet_netof F
- inet_network F
- inet_nsap_addr F
- inet_nsap_ntoa F
- inet_ntoa F
- inet_ntop F
- inet_pton F
- init_module F
- initgroups F
- initstate F
- initstate_r F
- innetgr F
- insque F
- ioctl F
- iruserok F
- isalnum F
- isalpha F
- isascii F
- isatty F
- isblank F
- iscntrl F
- isdigit F
- isfdtype F
- isgraph F
- isinf F
- isinff F
- isinfl F
- islower F
- isnan F
- isnanf F
- isprint F
- ispunct F
- isspace F
- isupper F
- iswalnum F
- iswalpha F
- iswcntrl F
- iswctype F
- iswdigit F
- iswgraph F
- iswlower F
- iswprint F
- iswpunct F
- iswspace F
- iswupper F
- iswxdigit F
- isxdigit F
- jrand48 F
- jrand48_r F
- kill F
- killpg F
- klogctl F
- l64a F
- labs F
- lchown F
- lckpwdf F
- lcong48 F
- lcong48_r F
- ldexp F
- ldexpf F
- ldexpl F
- ldiv F
- lfind F
- link F
- listen F
- llabs F
- lldiv F
- llseek F
- loc1 D 0x4
- loc2 D 0x4
- localeconv F
- localtime F
- localtime_r F
- lockf F
- locs D 0x4
- longjmp F
- lrand48 F
- lrand48_r F
- lsearch F
- lseek F
- madvise F
- mallinfo F
- malloc F
- malloc_get_state F
- malloc_set_state F
- malloc_stats F
- malloc_trim F
- malloc_usable_size F
- mallopt F
- mallwatch D 0x4
- mblen F
- mbrlen F
- mbrtowc F
- mbsinit F
- mbsnrtowcs F
- mbsrtowcs F
- mbstowcs F
- mbtowc F
- mcheck F
- memalign F
- memccpy F
- memchr F
- memcmp F
- memcpy F
- memfrob F
- memmem F
- memmove F
- memset F
- mkdir F
- mkfifo F
- mkstemp F
- mktemp F
- mktime F
- mlock F
- mlockall F
- mmap F
- modf F
- modff F
- modfl F
- monstartup F
- mount F
- mprobe F
- mprotect F
- mrand48 F
- mrand48_r F
- mremap F
- msgctl F
- msgget F
- msgrcv F
- msgsnd F
- msync F
- mtrace F
- munlock F
- munlockall F
- munmap F
- muntrace F
- nanosleep F
- nfsservctl F
- nice F
- nl_langinfo F
- nrand48 F
- nrand48_r F
- ntohl F
- ntohs F
- obstack_alloc_failed_handler D 0x4
- obstack_exit_failure D 0x4
- obstack_free F
- obstack_printf F
- obstack_vprintf F
- on_exit F
- open F
- open_memstream F
- opendir F
- openlog F
- optarg D 0x4
- opterr D 0x4
- optind D 0x4
- optopt D 0x4
- parse_printf_format F
- pathconf F
- pause F
- pclose F
- perror F
- personality F
- pipe F
- pmap_getmaps F
- pmap_getport F
- pmap_rmtcall F
- pmap_set F
- pmap_unset F
- poll F
- popen F
- prctl F
- printf F
- profil F
- program_invocation_name D 0x4
- program_invocation_short_name D 0x4
- pselect F
- psignal F
- pthread_attr_destroy F
- pthread_attr_getdetachstate F
- pthread_attr_getinheritsched F
- pthread_attr_getschedparam F
- pthread_attr_getschedpolicy F
- pthread_attr_getscope F
- pthread_attr_init F
- pthread_attr_setdetachstate F
- pthread_attr_setinheritsched F
- pthread_attr_setschedparam F
- pthread_attr_setschedpolicy F
- pthread_attr_setscope F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- pthread_condattr_destroy F
- pthread_condattr_init F
- pthread_equal F
- pthread_exit F
- pthread_getschedparam F
- pthread_mutex_destroy F
- pthread_mutex_init F
- pthread_mutex_lock F
- pthread_mutex_unlock F
- pthread_self F
- pthread_setcancelstate F
- pthread_setcanceltype F
- pthread_setschedparam F
- ptrace F
- putc F
- putc_unlocked F
- putchar F
- putchar_unlocked F
- putenv F
- putpwent F
- puts F
- putspent F
- pututline F
- putw F
- pvalloc F
- qecvt F
- qecvt_r F
- qfcvt F
- qfcvt_r F
- qgcvt F
- qsort F
- query_module F
- quotactl F
- raise F
- rand F
- rand_r F
- random F
- random_r F
- rcmd F
- re_comp F
- re_compile_fastmap F
- re_compile_pattern F
- re_exec F
- re_match F
- re_match_2 F
- re_max_failures D 0x4
- re_search F
- re_search_2 F
- re_set_registers F
- re_set_syntax F
- re_syntax_options D 0x4
- read F
- readdir F
- readdir_r F
- readlink F
- readv F
- realloc F
- realpath F
- reboot F
- recv F
- recvfrom F
- recvmsg F
- regcomp F
- regerror F
- regexec F
- regfree F
- register_printf_function F
- registerrpc F
- remove F
- remque F
- rename F
- res_init F
- revoke F
- rewind F
- rewinddir F
- rexec F
- rexecoptions D 0x4
- rindex F
- rmdir F
- rpc_createerr D 0x10
- rpmatch F
- rresvport F
- ruserok F
- ruserpass F
- sbrk F
- scalbn F
- scalbnf F
- scalbnl F
- scandir F
- scanf F
- sched_get_priority_max F
- sched_get_priority_min F
- sched_getparam F
- sched_getscheduler F
- sched_rr_get_interval F
- sched_setparam F
- sched_setscheduler F
- sched_yield F
- seed48 F
- seed48_r F
- seekdir F
- select F
- semctl F
- semget F
- semop F
- send F
- sendmsg F
- sendto F
- setaliasent F
- setbuf F
- setbuffer F
- setcontext F
- setdomainname F
- setegid F
- setenv F
- seteuid F
- setfsent F
- setfsgid F
- setfsuid F
- setgid F
- setgrent F
- setgroups F
- sethostent F
- sethostid F
- sethostname F
- setitimer F
- setjmp F
- setlinebuf F
- setlocale F
- setlogin F
- setlogmask F
- setmntent F
- setnetent F
- setnetgrent F
- setpgid F
- setpgrp F
- setpriority F
- setprotoent F
- setpwent F
- setregid F
- setresgid F
- setresuid F
- setreuid F
- setrlimit F
- setrpcent F
- setservent F
- setsid F
- setsockopt F
- setspent F
- setstate F
- setstate_r F
- settimeofday F
- setttyent F
- setuid F
- setusershell F
- setutent F
- setvbuf F
- sgetspent F
- sgetspent_r F
- shmat F
- shmctl F
- shmdt F
- shmget F
- shutdown F
- sigaction F
- sigaddset F
- sigaltstack F
- sigandset F
- sigblock F
- sigdelset F
- sigemptyset F
- sigfillset F
- siggetmask F
- siginterrupt F
- sigisemptyset F
- sigismember F
- siglongjmp F
- signal F
- sigorset F
- sigpause F
- sigpending F
- sigprocmask F
- sigreturn F
- sigsetmask F
- sigstack F
- sigsuspend F
- sigvec F
- sigwait F
- sleep F
- snprintf F
- socket F
- socketpair F
- sprintf F
- srand F
- srand48 F
- srand48_r F
- srandom F
- srandom_r F
- sscanf F
- ssignal F
- sstk F
- statfs F
- stderr D 0x4
- stdin D 0x4
- stdout D 0x4
- step F
- stime F
- stpcpy F
- stpncpy F
- strcasecmp F
- strcat F
- strchr F
- strcmp F
- strcoll F
- strcpy F
- strcspn F
- strdup F
- strerror F
- strerror_r F
- strfmon F
- strfry F
- strftime F
- strlen F
- strncasecmp F
- strncat F
- strncmp F
- strncpy F
- strndup F
- strnlen F
- strpbrk F
- strptime F
- strrchr F
- strsep F
- strsignal F
- strspn F
- strstr F
- strtod F
- strtof F
- strtok F
- strtok_r F
- strtol F
- strtold F
- strtoll F
- strtoq F
- strtoul F
- strtoull F
- strtouq F
- strxfrm F
- stty F
- svc_exit F
- svc_fdset D 0x80
- svc_getreq F
- svc_getreqset F
- svc_register F
- svc_run F
- svc_sendreply F
- svc_unregister F
- svcauthdes_stats D 0xc
- svcerr_auth F
- svcerr_decode F
- svcerr_noproc F
- svcerr_noprog F
- svcerr_progvers F
- svcerr_systemerr F
- svcerr_weakauth F
- svcfd_create F
- svcraw_create F
- svctcp_create F
- svcudp_bufcreate F
- svcudp_create F
- svcudp_enablecache F
- swab F
- swapoff F
- swapon F
- symlink F
- sync F
- sys_errlist D 0x1ec
- sys_nerr D 0x4
- sys_sigabbrev D 0x80
- sys_siglist D 0x80
- syscall F
- sysconf F
- sysctl F
- sysinfo F
- syslog F
- system F
- tcdrain F
- tcflow F
- tcflush F
- tcgetattr F
- tcgetpgrp F
- tcsendbreak F
- tcsetattr F
- tcsetpgrp F
- tdelete F
- telldir F
- tempnam F
- textdomain F
- tfind F
- time F
- timegm F
- timelocal F
- times F
- timezone D 0x4
- tmpfile F
- tmpnam F
- tmpnam_r F
- toascii F
- tolower F
- toupper F
- towctrans F
- towlower F
- towupper F
- tr_break F
- truncate F
- tsearch F
- ttyname F
- ttyname_r F
- ttyslot F
- twalk F
- tzname D 0x8
- tzset F
- ualarm F
- ulckpwdf F
- ulimit F
- umask F
- umount F
- uname F
- ungetc F
- unlink F
- unsetenv F
- updwtmp F
- uselib F
- usleep F
- ustat F
- utime F
- utimes F
- utmpname F
- valloc F
- vasprintf F
- vdprintf F
- verr F
- verrx F
- vfork F
- vfprintf F
- vfscanf F
- vhangup F
- vlimit F
- vprintf F
- vscanf F
- vsnprintf F
- vsprintf F
- vsscanf F
- vsyslog F
- vtimes F
- vwarn F
- vwarnx F
- wait F
- wait3 F
- wait4 F
- waitpid F
- warn F
- warnx F
- wcpcpy F
- wcpncpy F
- wcrtomb F
- wcscat F
- wcschr F
- wcscmp F
- wcscoll F
- wcscpy F
- wcscspn F
- wcsdup F
- wcslen F
- wcsncat F
- wcsncmp F
- wcsncpy F
- wcsnrtombs F
- wcspbrk F
- wcsrchr F
- wcsrtombs F
- wcsspn F
- wcsstr F
- wcstod F
- wcstof F
- wcstok F
- wcstol F
- wcstold F
- wcstombs F
- wcstoq F
- wcstoul F
- wcstouq F
- wcswidth F
- wcsxfrm F
- wctob F
- wctomb F
- wctrans F
- wctype F
- wcwidth F
- wmemchr F
- wmemcmp F
- wmemcpy F
- wmemmove F
- wmemset F
- write F
- writev F
- xdr_accepted_reply F
- xdr_array F
- xdr_authunix_parms F
- xdr_bool F
- xdr_bytes F
- xdr_callhdr F
- xdr_callmsg F
- xdr_char F
- xdr_cryptkeyarg F
- xdr_cryptkeyarg2 F
- xdr_cryptkeyres F
- xdr_des_block F
- xdr_double F
- xdr_enum F
- xdr_float F
- xdr_free F
- xdr_int F
- xdr_key_netstarg F
- xdr_key_netstres F
- xdr_keybuf F
- xdr_keystatus F
- xdr_long F
- xdr_netobj F
- xdr_opaque F
- xdr_opaque_auth F
- xdr_pmap F
- xdr_pmaplist F
- xdr_pointer F
- xdr_reference F
- xdr_rejected_reply F
- xdr_replymsg F
- xdr_rmtcall_args F
- xdr_rmtcallres F
- xdr_short F
- xdr_string F
- xdr_u_char F
- xdr_u_int F
- xdr_u_long F
- xdr_u_short F
- xdr_union F
- xdr_vector F
- xdr_void F
- xdr_wrapstring F
- xdrmem_create F
- xdrrec_create F
- xdrrec_endofrecord F
- xdrrec_eof F
- xdrrec_skiprecord F
- xdrstdio_create F
- xencrypt F
- xprt_register F
- xprt_unregister F
-GLIBC_2.1
- GLIBC_2.1 A
- _IO_2_1_stderr_ D 0xa0
- _IO_2_1_stdin_ D 0xa0
- _IO_2_1_stdout_ D 0xa0
- _IO_do_write F
- _IO_fclose F
- _IO_fdopen F
- _IO_fgetpos64 F
- _IO_file_attach F
- _IO_file_close_it F
- _IO_file_finish F
- _IO_file_fopen F
- _IO_file_init F
- _IO_file_overflow F
- _IO_file_seekoff F
- _IO_file_setbuf F
- _IO_file_sync F
- _IO_file_underflow F
- _IO_file_write F
- _IO_file_xsputn F
- _IO_fopen F
- _IO_fsetpos64 F
- _IO_getline_info F
- _IO_popen F
- _IO_proc_close F
- _IO_proc_open F
- __asprintf F
- __backtrace F
- __backtrace_symbols F
- __backtrace_symbols_fd F
- __duplocale F
- __freelocale F
- __fxstat64 F
- __isalnum_l F
- __isalpha_l F
- __isascii_l F
- __isblank_l F
- __iscntrl_l F
- __isdigit_l F
- __isgraph_l F
- __islower_l F
- __isprint_l F
- __ispunct_l F
- __isspace_l F
- __isupper_l F
- __iswalnum_l F
- __iswalpha_l F
- __iswblank_l F
- __iswcntrl_l F
- __iswctype_l F
- __iswdigit_l F
- __iswgraph_l F
- __iswlower_l F
- __iswprint_l F
- __iswpunct_l F
- __iswspace_l F
- __iswupper_l F
- __iswxdigit_l F
- __isxdigit_l F
- __key_decryptsession_pk_LOCAL D 0x4
- __key_encryptsession_pk_LOCAL D 0x4
- __key_gendes_LOCAL D 0x4
- __libc_allocate_rtsig F
- __libc_current_sigrtmax F
- __libc_current_sigrtmin F
- __libc_freeres F
- __libc_sa_len F
- __lxstat64 F
- __newlocale F
- __poll F
- __pread64 F
- __pwrite64 F
- __rawmemchr F
- __signbit F
- __signbitf F
- __strcasecmp_l F
- __strcasestr F
- __strcoll_l F
- __strfmon_l F
- __strncasecmp_l F
- __strtod_l F
- __strtof_l F
- __strtol_l F
- __strtold_l F
- __strtoll_l F
- __strtoul_l F
- __strtoull_l F
- __strxfrm_l F
- __toascii_l F
- __tolower_l F
- __toupper_l F
- __towctrans F
- __towctrans_l F
- __towlower_l F
- __towupper_l F
- __wcscasecmp_l F
- __wcscoll_l F
- __wcsncasecmp_l F
- __wcstod_l F
- __wcstof_l F
- __wcstol_l F
- __wcstold_l F
- __wcstoll_l F
- __wcstoul_l F
- __wcstoull_l F
- __wcsxfrm_l F
- __wctype_l F
- __xstat64 F
- _authenticate F
- _dl_mcount_wrapper F
- _dl_mcount_wrapper_check F
- _sys_errlist D 0x1f4
- _sys_nerr D 0x4
- _sys_siglist D 0x100
- addseverity F
- alphasort64 F
- argp_err_exit_status D 0x4
- argp_error F
- argp_failure F
- argp_help F
- argp_parse F
- argp_program_bug_address D 0x4
- argp_program_version D 0x4
- argp_program_version_hook D 0x4
- argp_state_help F
- argp_usage F
- authdes_create F
- authdes_getucred F
- authdes_pk_create F
- backtrace F
- backtrace_symbols F
- backtrace_symbols_fd F
- capget F
- capset F
- cbc_crypt F
- chown F
- clntunix_create F
- creat64 F
- des_setparity F
- ecb_crypt F
- endutxent F
- fattach F
- fclose F
- fdetach F
- fdopen F
- ffsl F
- ffsll F
- fgetc_unlocked F
- fgetpos64 F
- fgets_unlocked F
- fmtmsg F
- fopen F
- fopen64 F
- fputs_unlocked F
- fread_unlocked F
- freopen64 F
- fseeko F
- fseeko64 F
- fsetpos64 F
- fstatfs64 F
- fstatvfs F
- fstatvfs64 F
- ftello F
- ftello64 F
- ftruncate64 F
- ftw64 F
- fwrite_unlocked F
- gai_strerror F
- getcontext F
- getdate F
- getdate_err D 0x4
- getdate_r F
- getmsg F
- getnameinfo F
- getnetname F
- getpmsg F
- getpt F
- getrlimit64 F
- getutxent F
- getutxid F
- getutxline F
- glob64 F
- globfree64 F
- gnu_get_libc_release F
- gnu_get_libc_version F
- grantpt F
- host2netname F
- iconv F
- iconv_close F
- iconv_open F
- if_freenameindex F
- if_indextoname F
- if_nameindex F
- if_nametoindex F
- in6addr_any D 0x10
- in6addr_loopback D 0x10
- isastream F
- iswblank F
- key_decryptsession F
- key_decryptsession_pk F
- key_encryptsession F
- key_encryptsession_pk F
- key_gendes F
- key_get_conv F
- key_secretkey_is_set F
- key_setnet F
- key_setsecret F
- lockf64 F
- lseek64 F
- makecontext F
- mempcpy F
- mmap64 F
- netname2host F
- netname2user F
- nftw F
- nftw64 F
- ntp_adjtime F
- ntp_gettime F
- open64 F
- passwd2des F
- pclose F
- popen F
- pread F
- pread64 F
- printf_size F
- printf_size_info F
- pthread_attr_init F
- ptsname F
- ptsname_r F
- putgrent F
- putmsg F
- putpmsg F
- pututxline F
- pwrite F
- pwrite64 F
- rawmemchr F
- readdir64 F
- readdir64_r F
- rtime F
- scandir64 F
- sendfile F
- setrlimit64 F
- setutxent F
- sighold F
- sigignore F
- sigqueue F
- sigrelse F
- sigset F
- sigtimedwait F
- sigwaitinfo F
- statfs64 F
- statvfs F
- statvfs64 F
- strcasestr F
- strtoimax F
- strtoumax F
- strverscmp F
- svcunix_create F
- svcunixfd_create F
- swapcontext F
- sys_errlist D 0x1f4
- sys_nerr D 0x4
- sys_sigabbrev D 0x100
- sys_siglist D 0x100
- sysv_signal F
- tcgetsid F
- tdestroy F
- tmpfile F
- tmpfile64 F
- truncate64 F
- umount2 F
- unlockpt F
- updwtmpx F
- user2netname F
- utmpxname F
- versionsort F
- versionsort64 F
- waitid F
- wcscasecmp F
- wcsncasecmp F
- wcsnlen F
- wcstoimax F
- wcstoll F
- wcstoull F
- wcstoumax F
- wcswcs F
- wordexp F
- wordfree F
- xdecrypt F
- xdr_authdes_cred F
- xdr_authdes_verf F
- xdr_getcredres F
- xdr_int16_t F
- xdr_int32_t F
- xdr_int8_t F
- xdr_netnamestr F
- xdr_sizeof F
- xdr_uint16_t F
- xdr_uint32_t F
- xdr_uint8_t F
- xdr_unixcred F
-GLIBC_2.1.1
- GLIBC_2.1.1 A
- _Exit F
- __mempcpy_small F
- __stpcpy_small F
- __strcpy_small F
- __strcspn_c1 F
- __strcspn_c2 F
- __strcspn_c3 F
- __strpbrk_c2 F
- __strpbrk_c3 F
- __strsep_1c F
- __strsep_2c F
- __strsep_3c F
- __strsep_g F
- __strspn_c1 F
- __strspn_c2 F
- __strspn_c3 F
- __strtok_r_1c F
- __strverscmp F
- getutmp F
- getutmpx F
- imaxabs F
- imaxdiv F
- strchrnul F
- xdr_hyper F
- xdr_int64_t F
- xdr_longlong_t F
- xdr_u_hyper F
- xdr_u_longlong_t F
- xdr_uint64_t F
-GLIBC_2.1.2
- GLIBC_2.1.2 A
- __vfork F
- getaliasbyname_r F
- getaliasent_r F
- getgrent_r F
- getgrgid_r F
- getgrnam_r F
- gethostbyaddr_r F
- gethostbyname2_r F
- gethostbyname_r F
- gethostent_r F
- getnetbyaddr_r F
- getnetbyname_r F
- getnetent_r F
- getprotobyname_r F
- getprotobynumber_r F
- getprotoent_r F
- getpwent_r F
- getpwnam_r F
- getpwuid_r F
- getrpcbyname_r F
- getrpcbynumber_r F
- getrpcent_r F
- getservbyname_r F
- getservbyport_r F
- getservent_r F
- getspent_r F
- getspnam_r F
-GLIBC_2.1.3
- GLIBC_2.1.3 A
- __cxa_atexit F
- __cxa_finalize F
- __sigsuspend F
-GLIBC_2.10
- GLIBC_2.10 A
- __cxa_at_quick_exit F
- __posix_getopt F
- accept4 F
- endsgent F
- fallocate F
- fgetsgent F
- fgetsgent_r F
- getsgent F
- getsgent_r F
- getsgnam F
- getsgnam_r F
- malloc_info F
- preadv F
- preadv64 F
- psiginfo F
- putsgent F
- pwritev F
- pwritev64 F
- quick_exit F
- register_printf_modifier F
- register_printf_specifier F
- register_printf_type F
- setsgent F
- sgetsgent F
- sgetsgent_r F
-GLIBC_2.11
- GLIBC_2.11 A
- __longjmp_chk F
- execvpe F
- fallocate64 F
- mkostemps F
- mkostemps64 F
- mkstemps F
- mkstemps64 F
-GLIBC_2.12
- GLIBC_2.12 A
- _sys_errlist D 0x21c
- _sys_nerr D 0x4
- ntp_gettimex F
- recvmmsg F
- sys_errlist D 0x21c
- sys_nerr D 0x4
-GLIBC_2.13
- GLIBC_2.13 A
- fanotify_init F
- fanotify_mark F
- prlimit F
- prlimit64 F
-GLIBC_2.14
- GLIBC_2.14 A
- clock_adjtime F
- name_to_handle_at F
- open_by_handle_at F
- sendmmsg F
- setns F
- syncfs F
-GLIBC_2.15
- GLIBC_2.15 A
- __fdelt_chk F
- __fdelt_warn F
- posix_spawn F
- posix_spawnp F
- process_vm_readv F
- process_vm_writev F
- scandirat F
- scandirat64 F
-GLIBC_2.16
- GLIBC_2.16 A
- __getauxval F
- __mcount_internal F
- __poll_chk F
- __ppoll_chk F
- aligned_alloc F
- c16rtomb F
- c32rtomb F
- getauxval F
- mbrtoc16 F
- mbrtoc32 F
- timespec_get F
-GLIBC_2.17
- GLIBC_2.17 A
- __ppc_get_timebase_freq F
- clock_getcpuclockid F
- clock_getres F
- clock_gettime F
- clock_nanosleep F
- clock_settime F
- secure_getenv F
-GLIBC_2.18
- GLIBC_2.18 A
- __cxa_thread_atexit_impl F
-GLIBC_2.2
- GLIBC_2.2 A
- _IO_adjust_wcolumn F
- _IO_fgetpos F
- _IO_fgetpos64 F
- _IO_free_wbackup_area F
- _IO_fsetpos F
- _IO_fsetpos64 F
- _IO_init_wmarker F
- _IO_iter_begin F
- _IO_iter_end F
- _IO_iter_file F
- _IO_iter_next F
- _IO_least_wmarker F
- _IO_list_lock F
- _IO_list_resetlock F
- _IO_list_unlock F
- _IO_seekwmark F
- _IO_sputbackwc F
- _IO_sungetwc F
- _IO_switch_to_main_wget_area F
- _IO_switch_to_wbackup_area F
- _IO_switch_to_wget_mode F
- _IO_unsave_wmarkers F
- _IO_wdefault_doallocate F
- _IO_wdefault_finish F
- _IO_wdefault_pbackfail F
- _IO_wdefault_uflow F
- _IO_wdefault_xsgetn F
- _IO_wdefault_xsputn F
- _IO_wdo_write F
- _IO_wdoallocbuf F
- _IO_wfile_jumps D 0x54
- _IO_wfile_overflow F
- _IO_wfile_seekoff F
- _IO_wfile_sync F
- _IO_wfile_underflow F
- _IO_wfile_xsputn F
- _IO_wmarker_delta F
- _IO_wsetb F
- __assert F
- __ctype32_tolower D 0x4
- __ctype32_toupper D 0x4
- __cyg_profile_func_enter F
- __cyg_profile_func_exit F
- __endmntent F
- __fbufsize F
- __flbf F
- __fpending F
- __fpurge F
- __freadable F
- __freading F
- __fsetlocking F
- __fwritable F
- __fwriting F
- __fxstat64 F
- __getmntent_r F
- __lxstat64 F
- __nl_langinfo_l F
- __open64 F
- __res_init F
- __res_nclose F
- __res_ninit F
- __res_state F
- __setmntent F
- __statfs F
- __strndup F
- __sysconf F
- __sysctl F
- __wctrans_l F
- __woverflow F
- __wuflow F
- __wunderflow F
- __xpg_sigpause F
- __xstat64 F
- _flushlbf F
- _res_hconf D 0x30
- bind_textdomain_codeset F
- dcngettext F
- dngettext F
- fgetpos F
- fgetpos64 F
- fgetwc F
- fgetwc_unlocked F
- fgetws F
- fgetws_unlocked F
- fmemopen F
- fopencookie F
- fputwc F
- fputwc_unlocked F
- fputws F
- fputws_unlocked F
- fsetpos F
- fsetpos64 F
- fwide F
- fwprintf F
- fwscanf F
- getdirentries64 F
- getloadavg F
- getrlimit F
- getrlimit64 F
- getwc F
- getwc_unlocked F
- getwchar F
- getwchar_unlocked F
- glob64 F
- iruserok_af F
- localeconv F
- mcheck_check_all F
- mcheck_pedantic F
- memrchr F
- mincore F
- mkdtemp F
- mkstemp64 F
- moncontrol F
- msgctl F
- ngettext F
- posix_fadvise F
- posix_fadvise64 F
- posix_fallocate F
- posix_fallocate64 F
- posix_madvise F
- posix_memalign F
- posix_spawn F
- posix_spawn_file_actions_addclose F
- posix_spawn_file_actions_adddup2 F
- posix_spawn_file_actions_addopen F
- posix_spawn_file_actions_destroy F
- posix_spawn_file_actions_init F
- posix_spawnattr_destroy F
- posix_spawnattr_getflags F
- posix_spawnattr_getpgroup F
- posix_spawnattr_getschedparam F
- posix_spawnattr_getschedpolicy F
- posix_spawnattr_getsigdefault F
- posix_spawnattr_getsigmask F
- posix_spawnattr_init F
- posix_spawnattr_setflags F
- posix_spawnattr_setpgroup F
- posix_spawnattr_setschedparam F
- posix_spawnattr_setschedpolicy F
- posix_spawnattr_setsigdefault F
- posix_spawnattr_setsigmask F
- posix_spawnp F
- putwc F
- putwc_unlocked F
- putwchar F
- putwchar_unlocked F
- rcmd_af F
- readdir64 F
- readdir64_r F
- rexec_af F
- rresvport_af F
- ruserok_af F
- scandir64 F
- semctl F
- setrlimit F
- shmctl F
- svc_getreq_common F
- svc_getreq_poll F
- svc_max_pollfd D 0x4
- svc_pollfd D 0x4
- swprintf F
- swscanf F
- ungetwc F
- vfwprintf F
- vfwscanf F
- vswprintf F
- vswscanf F
- vwprintf F
- vwscanf F
- wcschrnul F
- wcsftime F
- wmempcpy F
- wprintf F
- wscanf F
-GLIBC_2.2.1
- GLIBC_2.2.1 A
- pivot_root F
- posix_openpt F
-GLIBC_2.2.2
- GLIBC_2.2.2 A
- __nss_hostname_digits_dots F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- __rpc_thread_createerr F
- __rpc_thread_svc_fdset F
- __rpc_thread_svc_max_pollfd F
- __rpc_thread_svc_pollfd F
- fnmatch F
- sprofil F
-GLIBC_2.2.4
- GLIBC_2.2.4 A
- dl_iterate_phdr F
- getgrouplist F
- sockatmark F
-GLIBC_2.2.6
- GLIBC_2.2.6 A
- __nanosleep F
-GLIBC_2.3
- GLIBC_2.3 A
- __ctype_b_loc F
- __ctype_tolower_loc F
- __ctype_toupper_loc F
- __isctype F
- __strftime_l F
- __uselocale F
- __wcsftime_l F
- _sys_errlist D 0x1f8
- _sys_nerr D 0x4
- duplocale F
- fgetxattr F
- flistxattr F
- freeifaddrs F
- freelocale F
- fremovexattr F
- fsetxattr F
- futimes F
- getifaddrs F
- getxattr F
- isalnum_l F
- isalpha_l F
- isblank_l F
- iscntrl_l F
- isctype F
- isdigit_l F
- isgraph_l F
- islower_l F
- isprint_l F
- ispunct_l F
- isspace_l F
- isupper_l F
- iswalnum_l F
- iswalpha_l F
- iswblank_l F
- iswcntrl_l F
- iswctype_l F
- iswdigit_l F
- iswgraph_l F
- iswlower_l F
- iswprint_l F
- iswpunct_l F
- iswspace_l F
- iswupper_l F
- iswxdigit_l F
- isxdigit_l F
- lgetxattr F
- listxattr F
- llistxattr F
- lremovexattr F
- lsetxattr F
- lutimes F
- newlocale F
- nl_langinfo_l F
- readahead F
- realpath F
- removexattr F
- sendfile64 F
- setxattr F
- strcasecmp_l F
- strcoll_l F
- strfmon_l F
- strftime_l F
- strncasecmp_l F
- strtod_l F
- strtof_l F
- strtol_l F
- strtold_l F
- strtoll_l F
- strtoul_l F
- strtoull_l F
- strxfrm_l F
- sys_errlist D 0x1f8
- sys_nerr D 0x4
- tolower_l F
- toupper_l F
- towctrans_l F
- towlower_l F
- towupper_l F
- uselocale F
- wcscasecmp_l F
- wcscoll_l F
- wcsftime_l F
- wcsncasecmp_l F
- wcstod_l F
- wcstof_l F
- wcstol_l F
- wcstold_l F
- wcstoll_l F
- wcstoul_l F
- wcstoull_l F
- wcsxfrm_l F
- wctrans_l F
- wctype_l F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- __register_atfork F
- epoll_create F
- epoll_ctl F
- epoll_wait F
- lchmod F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- strptime_l F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- __adddf3 F
- __divdf3 F
- __eqdf2 F
- __extendsfdf2 F
- __feraiseexcept_soft F
- __fixdfsi F
- __fixunsdfsi F
- __floatsidf F
- __gedf2 F
- __ledf2 F
- __muldf3 F
- __negdf2 F
- __sqrtdf2 F
- __subdf3 F
- __truncdfsf2 F
- _sys_siglist D 0x104
- atosfix16 F
- atosfix32 F
- atosfix64 F
- atoufix16 F
- atoufix32 F
- atoufix64 F
- getcontext F
- gnu_dev_major F
- gnu_dev_makedev F
- gnu_dev_minor F
- inet6_option_alloc F
- inet6_option_append F
- inet6_option_find F
- inet6_option_init F
- inet6_option_next F
- inet6_option_space F
- makecontext F
- nftw F
- nftw64 F
- posix_fadvise64 F
- posix_fallocate64 F
- remap_file_pages F
- sched_getaffinity F
- sched_setaffinity F
- semtimedop F
- setcontext F
- strtosfix16 F
- strtosfix32 F
- strtosfix64 F
- strtoufix16 F
- strtoufix32 F
- strtoufix64 F
- swapcontext F
- sys_sigabbrev D 0x104
- sys_siglist D 0x104
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- __chk_fail F
- __fprintf_chk F
- __gets_chk F
- __memcpy_chk F
- __memmove_chk F
- __mempcpy_chk F
- __memset_chk F
- __printf_chk F
- __sigsetjmp F
- __snprintf_chk F
- __sprintf_chk F
- __stpcpy_chk F
- __strcat_chk F
- __strcpy_chk F
- __strncat_chk F
- __strncpy_chk F
- __vfprintf_chk F
- __vprintf_chk F
- __vsnprintf_chk F
- __vsprintf_chk F
- __xpg_strerror_r F
- _longjmp F
- _setjmp F
- getcontext F
- getipv4sourcefilter F
- getsourcefilter F
- longjmp F
- makecontext F
- regexec F
- sched_getaffinity F
- sched_setaffinity F
- setcontext F
- setipv4sourcefilter F
- setjmp F
- setsourcefilter F
- siglongjmp F
- swapcontext F
- xdr_quad_t F
- xdr_u_quad_t F
-GLIBC_2.4
- GLIBC_2.4 A
- _IO_fprintf F
- _IO_printf F
- _IO_sprintf F
- _IO_sscanf F
- _IO_vfprintf F
- _IO_vfscanf F
- _IO_vsprintf F
- __asprintf F
- __confstr_chk F
- __fgets_chk F
- __fgets_unlocked_chk F
- __fgetws_chk F
- __fgetws_unlocked_chk F
- __finitel F
- __fprintf_chk F
- __fwprintf_chk F
- __fxstatat F
- __fxstatat64 F
- __getcwd_chk F
- __getdomainname_chk F
- __getgroups_chk F
- __gethostname_chk F
- __getlogin_r_chk F
- __getwd_chk F
- __isinfl F
- __isnanl F
- __mbsnrtowcs_chk F
- __mbsrtowcs_chk F
- __mbstowcs_chk F
- __nldbl__IO_fprintf F
- __nldbl__IO_printf F
- __nldbl__IO_sprintf F
- __nldbl__IO_sscanf F
- __nldbl__IO_vfprintf F
- __nldbl__IO_vfscanf F
- __nldbl__IO_vsprintf F
- __nldbl___asprintf F
- __nldbl___fprintf_chk F
- __nldbl___fwprintf_chk F
- __nldbl___printf_chk F
- __nldbl___printf_fp F
- __nldbl___snprintf_chk F
- __nldbl___sprintf_chk F
- __nldbl___strfmon_l F
- __nldbl___swprintf_chk F
- __nldbl___syslog_chk F
- __nldbl___vfprintf_chk F
- __nldbl___vfscanf F
- __nldbl___vfwprintf_chk F
- __nldbl___vprintf_chk F
- __nldbl___vsnprintf F
- __nldbl___vsnprintf_chk F
- __nldbl___vsprintf_chk F
- __nldbl___vsscanf F
- __nldbl___vstrfmon F
- __nldbl___vstrfmon_l F
- __nldbl___vswprintf_chk F
- __nldbl___vsyslog_chk F
- __nldbl___vwprintf_chk F
- __nldbl___wprintf_chk F
- __nldbl_asprintf F
- __nldbl_dprintf F
- __nldbl_fprintf F
- __nldbl_fscanf F
- __nldbl_fwprintf F
- __nldbl_fwscanf F
- __nldbl_obstack_printf F
- __nldbl_obstack_vprintf F
- __nldbl_printf F
- __nldbl_printf_size F
- __nldbl_scanf F
- __nldbl_snprintf F
- __nldbl_sprintf F
- __nldbl_sscanf F
- __nldbl_strfmon F
- __nldbl_strfmon_l F
- __nldbl_swprintf F
- __nldbl_swscanf F
- __nldbl_syslog F
- __nldbl_vasprintf F
- __nldbl_vdprintf F
- __nldbl_vfprintf F
- __nldbl_vfscanf F
- __nldbl_vfwprintf F
- __nldbl_vfwscanf F
- __nldbl_vprintf F
- __nldbl_vscanf F
- __nldbl_vsnprintf F
- __nldbl_vsprintf F
- __nldbl_vsscanf F
- __nldbl_vswprintf F
- __nldbl_vswscanf F
- __nldbl_vsyslog F
- __nldbl_vwprintf F
- __nldbl_vwscanf F
- __nldbl_wprintf F
- __nldbl_wscanf F
- __pread64_chk F
- __pread_chk F
- __printf_chk F
- __printf_fp F
- __ptsname_r_chk F
- __read_chk F
- __readlink_chk F
- __realpath_chk F
- __recv_chk F
- __recvfrom_chk F
- __signbitl F
- __snprintf_chk F
- __sprintf_chk F
- __stack_chk_fail F
- __stpncpy_chk F
- __strfmon_l F
- __strtold_internal F
- __strtold_l F
- __swprintf_chk F
- __syslog_chk F
- __ttyname_r_chk F
- __vfprintf_chk F
- __vfscanf F
- __vfwprintf_chk F
- __vprintf_chk F
- __vsnprintf F
- __vsnprintf_chk F
- __vsprintf_chk F
- __vsscanf F
- __vswprintf_chk F
- __vsyslog_chk F
- __vwprintf_chk F
- __wcpcpy_chk F
- __wcpncpy_chk F
- __wcrtomb_chk F
- __wcscat_chk F
- __wcscpy_chk F
- __wcsncat_chk F
- __wcsncpy_chk F
- __wcsnrtombs_chk F
- __wcsrtombs_chk F
- __wcstold_internal F
- __wcstold_l F
- __wcstombs_chk F
- __wctomb_chk F
- __wmemcpy_chk F
- __wmemmove_chk F
- __wmempcpy_chk F
- __wmemset_chk F
- __wprintf_chk F
- __xmknodat F
- _sys_errlist D 0x210
- _sys_nerr D 0x4
- asprintf F
- copysignl F
- dprintf F
- eaccess F
- faccessat F
- fchmodat F
- fchownat F
- fdopendir F
- finitel F
- fprintf F
- frexpl F
- fscanf F
- futimesat F
- fwprintf F
- fwscanf F
- inotify_add_watch F
- inotify_init F
- inotify_rm_watch F
- isinfl F
- isnanl F
- ldexpl F
- linkat F
- mkdirat F
- mkfifoat F
- modfl F
- obstack_printf F
- obstack_vprintf F
- open_wmemstream F
- openat F
- openat64 F
- ppoll F
- printf F
- printf_size F
- qecvt F
- qecvt_r F
- qfcvt F
- qfcvt_r F
- qgcvt F
- readlinkat F
- renameat F
- scalbnl F
- scanf F
- snprintf F
- sprintf F
- sscanf F
- strfmon F
- strfmon_l F
- strtold F
- strtold_l F
- swprintf F
- swscanf F
- symlinkat F
- sys_errlist D 0x210
- sys_nerr D 0x4
- syslog F
- unlinkat F
- unshare F
- vasprintf F
- vdprintf F
- vfprintf F
- vfscanf F
- vfwprintf F
- vfwscanf F
- vprintf F
- vscanf F
- vsnprintf F
- vsprintf F
- vsscanf F
- vswprintf F
- vswscanf F
- vsyslog F
- vwprintf F
- vwscanf F
- wcstold F
- wcstold_l F
- wprintf F
- wscanf F
-GLIBC_2.5
- GLIBC_2.5 A
- __floatundidf F
- __floatunsidf F
- __gtdf2 F
- __ltdf2 F
- __nedf2 F
- __readlinkat_chk F
- __unorddf2 F
- inet6_opt_append F
- inet6_opt_find F
- inet6_opt_finish F
- inet6_opt_get_val F
- inet6_opt_init F
- inet6_opt_next F
- inet6_opt_set_val F
- inet6_rth_add F
- inet6_rth_getaddr F
- inet6_rth_init F
- inet6_rth_reverse F
- inet6_rth_segments F
- inet6_rth_space F
- splice F
- tee F
- vmsplice F
-GLIBC_2.6
- GLIBC_2.6 A
- __sched_cpucount F
- epoll_pwait F
- futimens F
- sched_getcpu F
- strerror_l F
- sync_file_range F
- utimensat F
-GLIBC_2.7
- GLIBC_2.7 A
- __fread_chk F
- __fread_unlocked_chk F
- __isoc99_fscanf F
- __isoc99_fwscanf F
- __isoc99_scanf F
- __isoc99_sscanf F
- __isoc99_swscanf F
- __isoc99_vfscanf F
- __isoc99_vfwscanf F
- __isoc99_vscanf F
- __isoc99_vsscanf F
- __isoc99_vswscanf F
- __isoc99_vwscanf F
- __isoc99_wscanf F
- __nldbl___isoc99_fscanf F
- __nldbl___isoc99_fwscanf F
- __nldbl___isoc99_scanf F
- __nldbl___isoc99_sscanf F
- __nldbl___isoc99_swscanf F
- __nldbl___isoc99_vfscanf F
- __nldbl___isoc99_vfwscanf F
- __nldbl___isoc99_vscanf F
- __nldbl___isoc99_vsscanf F
- __nldbl___isoc99_vswscanf F
- __nldbl___isoc99_vwscanf F
- __nldbl___isoc99_wscanf F
- __open64_2 F
- __open_2 F
- __openat64_2 F
- __openat_2 F
- __sched_cpualloc F
- __sched_cpufree F
- eventfd F
- eventfd_read F
- eventfd_write F
- mkostemp F
- mkostemp64 F
- signalfd F
-GLIBC_2.8
- GLIBC_2.8 A
- __asprintf_chk F
- __dprintf_chk F
- __nldbl___asprintf_chk F
- __nldbl___dprintf_chk F
- __nldbl___obstack_printf_chk F
- __nldbl___obstack_vprintf_chk F
- __nldbl___vasprintf_chk F
- __nldbl___vdprintf_chk F
- __obstack_printf_chk F
- __obstack_vprintf_chk F
- __vasprintf_chk F
- __vdprintf_chk F
- qsort_r F
- timerfd_create F
- timerfd_gettime F
- timerfd_settime F
-GLIBC_2.9
- GLIBC_2.9 A
- dup3 F
- epoll_create1 F
- inotify_init1 F
- pipe2 F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libcrypt.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libcrypt.abilist
deleted file mode 100644
index 1df145f26..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libcrypt.abilist
+++ /dev/null
@@ -1,9 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- crypt F
- crypt_r F
- encrypt F
- encrypt_r F
- fcrypt F
- setkey F
- setkey_r F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libdl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libdl.abilist
deleted file mode 100644
index 62e6b41ed..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libdl.abilist
+++ /dev/null
@@ -1,18 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- dladdr F
- dlclose F
- dlerror F
- dlopen F
- dlsym F
-GLIBC_2.1
- GLIBC_2.1 A
- dlopen F
- dlvsym F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- dladdr1 F
- dlinfo F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- dlmopen F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libm.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libm.abilist
deleted file mode 100644
index b4a3f66a3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libm.abilist
+++ /dev/null
@@ -1,503 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _LIB_VERSION D 0x4
- acos F
- acosf F
- acosh F
- acoshf F
- acoshl F
- acosl F
- asin F
- asinf F
- asinh F
- asinhf F
- asinhl F
- asinl F
- atan F
- atan2 F
- atan2f F
- atan2l F
- atanf F
- atanh F
- atanhf F
- atanhl F
- atanl F
- cbrt F
- cbrtf F
- cbrtl F
- ceil F
- ceilf F
- copysign F
- copysignf F
- cos F
- cosf F
- cosh F
- coshf F
- coshl F
- cosl F
- drem F
- dremf F
- dreml F
- erf F
- erfc F
- erfcf F
- erfcl F
- erff F
- erfl F
- exp F
- expf F
- expl F
- expm1 F
- expm1f F
- expm1l F
- fabs F
- fabsf F
- finite F
- finitef F
- finitel F
- floor F
- floorf F
- fmod F
- fmodf F
- fmodl F
- frexp F
- frexpf F
- frexpl F
- gamma F
- gammaf F
- gammal F
- hypot F
- hypotf F
- hypotl F
- ilogb F
- ilogbf F
- ilogbl F
- j0 F
- j0f F
- j0l F
- j1 F
- j1f F
- j1l F
- jn F
- jnf F
- jnl F
- ldexp F
- ldexpf F
- ldexpl F
- lgamma F
- lgamma_r F
- lgammaf F
- lgammaf_r F
- lgammal F
- lgammal_r F
- log F
- log10 F
- log10f F
- log10l F
- log1p F
- log1pf F
- log1pl F
- logb F
- logbf F
- logbl F
- logf F
- logl F
- matherr F
- modf F
- modff F
- modfl F
- nextafter F
- nextafterf F
- nextafterl F
- pow F
- powf F
- powl F
- remainder F
- remainderf F
- remainderl F
- rint F
- rintf F
- scalb F
- scalbf F
- scalbl F
- scalbn F
- scalbnf F
- scalbnl F
- signgam D 0x4
- significand F
- significandf F
- significandl F
- sin F
- sinf F
- sinh F
- sinhf F
- sinhl F
- sinl F
- sqrt F
- sqrtf F
- tan F
- tanf F
- tanh F
- tanhf F
- tanhl F
- tanl F
- y0 F
- y0f F
- y0l F
- y1 F
- y1f F
- y1l F
- yn F
- ynf F
- ynl F
-GLIBC_2.1
- GLIBC_2.1 A
- __clog10 F
- __clog10f F
- __clog10l F
- __fe_dfl_env D 0x8
- __fe_enabled_env D 0x8
- __fe_nomask_env F
- __finite F
- __finitef F
- __finitel F
- __fpclassify F
- __fpclassifyf F
- __signbit F
- __signbitf F
- cabs F
- cabsf F
- cabsl F
- cacos F
- cacosf F
- cacosh F
- cacoshf F
- cacoshl F
- cacosl F
- carg F
- cargf F
- cargl F
- casin F
- casinf F
- casinh F
- casinhf F
- casinhl F
- casinl F
- catan F
- catanf F
- catanh F
- catanhf F
- catanhl F
- catanl F
- ccos F
- ccosf F
- ccosh F
- ccoshf F
- ccoshl F
- ccosl F
- cexp F
- cexpf F
- cexpl F
- cimag F
- cimagf F
- cimagl F
- clog F
- clog10 F
- clog10f F
- clog10l F
- clogf F
- clogl F
- conj F
- conjf F
- conjl F
- cpow F
- cpowf F
- cpowl F
- cproj F
- cprojf F
- cprojl F
- creal F
- crealf F
- creall F
- csin F
- csinf F
- csinh F
- csinhf F
- csinhl F
- csinl F
- csqrt F
- csqrtf F
- csqrtl F
- ctan F
- ctanf F
- ctanh F
- ctanhf F
- ctanhl F
- ctanl F
- exp10 F
- exp10f F
- exp10l F
- exp2 F
- exp2f F
- fdim F
- fdimf F
- feclearexcept F
- fegetenv F
- fegetexceptflag F
- fegetround F
- feholdexcept F
- feraiseexcept F
- fesetenv F
- fesetexceptflag F
- fesetround F
- fetestexcept F
- feupdateenv F
- fma F
- fmaf F
- fmal F
- fmax F
- fmaxf F
- fmin F
- fminf F
- llrint F
- llrintf F
- llround F
- llroundf F
- log2 F
- log2f F
- log2l F
- lrint F
- lrintf F
- lround F
- lroundf F
- nan F
- nanf F
- nanl F
- nearbyint F
- nearbyintf F
- nearbyintl F
- nexttoward F
- nexttowardf F
- nexttowardl F
- pow10 F
- pow10f F
- pow10l F
- remquo F
- remquof F
- remquol F
- round F
- roundf F
- scalbln F
- scalblnf F
- scalblnl F
- sincos F
- sincosf F
- sincosl F
- tgamma F
- tgammaf F
- tgammal F
- trunc F
- truncf F
-GLIBC_2.15
- GLIBC_2.15 A
- __acos_finite F
- __acosf_finite F
- __acosh_finite F
- __acoshf_finite F
- __acoshl_finite F
- __acosl_finite F
- __asin_finite F
- __asinf_finite F
- __asinl_finite F
- __atan2_finite F
- __atan2f_finite F
- __atan2l_finite F
- __atanh_finite F
- __atanhf_finite F
- __atanhl_finite F
- __cosh_finite F
- __coshf_finite F
- __coshl_finite F
- __exp10_finite F
- __exp10f_finite F
- __exp10l_finite F
- __exp2_finite F
- __exp2f_finite F
- __exp2l_finite F
- __exp_finite F
- __expf_finite F
- __expl_finite F
- __fmod_finite F
- __fmodf_finite F
- __fmodl_finite F
- __gamma_r_finite F
- __gammaf_r_finite F
- __gammal_r_finite F
- __hypot_finite F
- __hypotf_finite F
- __hypotl_finite F
- __j0_finite F
- __j0f_finite F
- __j0l_finite F
- __j1_finite F
- __j1f_finite F
- __j1l_finite F
- __jn_finite F
- __jnf_finite F
- __jnl_finite F
- __lgamma_r_finite F
- __lgammaf_r_finite F
- __lgammal_r_finite F
- __log10_finite F
- __log10f_finite F
- __log10l_finite F
- __log2_finite F
- __log2f_finite F
- __log2l_finite F
- __log_finite F
- __logf_finite F
- __logl_finite F
- __pow_finite F
- __powf_finite F
- __powl_finite F
- __remainder_finite F
- __remainderf_finite F
- __remainderl_finite F
- __scalb_finite F
- __scalbf_finite F
- __scalbl_finite F
- __sinh_finite F
- __sinhf_finite F
- __sinhl_finite F
- __sqrt_finite F
- __sqrtf_finite F
- __sqrtl_finite F
- __y0_finite F
- __y0f_finite F
- __y0l_finite F
- __y1_finite F
- __y1f_finite F
- __y1l_finite F
- __yn_finite F
- __ynf_finite F
- __ynl_finite F
-GLIBC_2.18
- GLIBC_2.18 A
- __issignaling F
- __issignalingf F
- __issignalingl F
-GLIBC_2.2
- GLIBC_2.2 A
- feclearexcept F
- fedisableexcept F
- feenableexcept F
- fegetenv F
- fegetexcept F
- fegetexceptflag F
- fesetenv F
- fesetexceptflag F
- feupdateenv F
-GLIBC_2.4
- GLIBC_2.4 A
- __clog10l F
- __finitel F
- __fpclassifyl F
- __nldbl_nexttowardf F
- __signbitl F
- acoshl F
- acosl F
- asinhl F
- asinl F
- atan2l F
- atanhl F
- atanl F
- cabsl F
- cacoshl F
- cacosl F
- cargl F
- casinhl F
- casinl F
- catanhl F
- catanl F
- cbrtl F
- ccoshl F
- ccosl F
- ceill F
- cexpl F
- cimagl F
- clog10l F
- clogl F
- conjl F
- copysignl F
- coshl F
- cosl F
- cpowl F
- cprojl F
- creall F
- csinhl F
- csinl F
- csqrtl F
- ctanhl F
- ctanl F
- dreml F
- erfcl F
- erfl F
- exp10l F
- exp2l F
- expl F
- expm1l F
- fabsl F
- fdiml F
- finitel F
- floorl F
- fmal F
- fmaxl F
- fminl F
- fmodl F
- frexpl F
- gammal F
- hypotl F
- ilogbl F
- j0l F
- j1l F
- jnl F
- ldexpl F
- lgammal F
- lgammal_r F
- llrintl F
- llroundl F
- log10l F
- log1pl F
- log2l F
- logbl F
- logl F
- lrintl F
- lroundl F
- modfl F
- nanl F
- nearbyintl F
- nextafterl F
- nexttoward F
- nexttowardf F
- nexttowardl F
- pow10l F
- powl F
- remainderl F
- remquol F
- rintl F
- roundl F
- scalbl F
- scalblnl F
- scalbnl F
- significandl F
- sincosl F
- sinhl F
- sinl F
- sqrtl F
- tanhl F
- tanl F
- tgammal F
- truncl F
- y0l F
- y1l F
- ynl F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libnsl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libnsl.abilist
deleted file mode 100644
index 4241e2d88..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libnsl.abilist
+++ /dev/null
@@ -1,127 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __yp_check F
- xdr_domainname F
- xdr_keydat F
- xdr_mapname F
- xdr_peername F
- xdr_valdat F
- xdr_yp_buf F
- xdr_ypbind_binding F
- xdr_ypbind_resp F
- xdr_ypbind_resptype F
- xdr_ypbind_setdom F
- xdr_ypdelete_args F
- xdr_ypmap_parms F
- xdr_ypmaplist F
- xdr_yppush_status F
- xdr_yppushresp_xfr F
- xdr_ypreq_key F
- xdr_ypreq_nokey F
- xdr_ypreq_xfr F
- xdr_ypresp_all F
- xdr_ypresp_key_val F
- xdr_ypresp_maplist F
- xdr_ypresp_master F
- xdr_ypresp_order F
- xdr_ypresp_val F
- xdr_ypresp_xfr F
- xdr_ypstat F
- xdr_ypupdate_args F
- xdr_ypxfrstat F
- yp_all F
- yp_bind F
- yp_first F
- yp_get_default_domain F
- yp_maplist F
- yp_master F
- yp_match F
- yp_next F
- yp_order F
- yp_unbind F
- yp_update F
- ypbinderr_string F
- yperr_string F
- ypprot_err F
-GLIBC_2.1
- GLIBC_2.1 A
- __free_fdresult F
- __nis_default_access F
- __nis_default_group F
- __nis_default_owner F
- __nis_default_ttl F
- __nis_finddirectory F
- __nis_hash F
- __nisbind_connect F
- __nisbind_create F
- __nisbind_destroy F
- __nisbind_next F
- nis_add F
- nis_add_entry F
- nis_addmember F
- nis_checkpoint F
- nis_clone_directory F
- nis_clone_object F
- nis_clone_result F
- nis_creategroup F
- nis_destroy_object F
- nis_destroygroup F
- nis_dir_cmp F
- nis_domain_of F
- nis_domain_of_r F
- nis_first_entry F
- nis_free_directory F
- nis_free_object F
- nis_free_request F
- nis_freenames F
- nis_freeresult F
- nis_freeservlist F
- nis_freetags F
- nis_getnames F
- nis_getservlist F
- nis_ismember F
- nis_leaf_of F
- nis_leaf_of_r F
- nis_lerror F
- nis_list F
- nis_local_directory F
- nis_local_group F
- nis_local_host F
- nis_local_principal F
- nis_lookup F
- nis_mkdir F
- nis_modify F
- nis_modify_entry F
- nis_name_of F
- nis_name_of_r F
- nis_next_entry F
- nis_perror F
- nis_ping F
- nis_print_directory F
- nis_print_entry F
- nis_print_group F
- nis_print_group_entry F
- nis_print_link F
- nis_print_object F
- nis_print_result F
- nis_print_rights F
- nis_print_table F
- nis_read_obj F
- nis_remove F
- nis_remove_entry F
- nis_removemember F
- nis_rmdir F
- nis_servstate F
- nis_sperrno F
- nis_sperror F
- nis_sperror_r F
- nis_stats F
- nis_verifygroup F
- nis_write_obj F
- readColdStartFile F
- writeColdStartFile F
- xdr_cback_data F
- xdr_obj_p F
-GLIBC_2.2
- GLIBC_2.2 A
- xdr_ypall F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libpthread.abilist
deleted file mode 100644
index c8a2a0471..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libpthread.abilist
+++ /dev/null
@@ -1,277 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _IO_flockfile F
- _IO_ftrylockfile F
- _IO_funlockfile F
- __close F
- __connect F
- __errno_location F
- __fcntl F
- __fork F
- __h_errno_location F
- __lseek F
- __open F
- __pthread_getspecific F
- __pthread_key_create F
- __pthread_mutex_destroy F
- __pthread_mutex_init F
- __pthread_mutex_lock F
- __pthread_mutex_trylock F
- __pthread_mutex_unlock F
- __pthread_mutexattr_destroy F
- __pthread_mutexattr_init F
- __pthread_mutexattr_settype F
- __pthread_once F
- __pthread_setspecific F
- __read F
- __send F
- __sigaction F
- __wait F
- __write F
- _pthread_cleanup_pop F
- _pthread_cleanup_pop_restore F
- _pthread_cleanup_push F
- _pthread_cleanup_push_defer F
- accept F
- close F
- connect F
- fcntl F
- flockfile F
- fork F
- fsync F
- ftrylockfile F
- funlockfile F
- longjmp F
- lseek F
- msync F
- nanosleep F
- open F
- pause F
- pthread_atfork F
- pthread_attr_destroy F
- pthread_attr_getdetachstate F
- pthread_attr_getinheritsched F
- pthread_attr_getschedparam F
- pthread_attr_getschedpolicy F
- pthread_attr_getscope F
- pthread_attr_init F
- pthread_attr_setdetachstate F
- pthread_attr_setinheritsched F
- pthread_attr_setschedparam F
- pthread_attr_setschedpolicy F
- pthread_attr_setscope F
- pthread_cancel F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- pthread_condattr_destroy F
- pthread_condattr_init F
- pthread_create F
- pthread_detach F
- pthread_equal F
- pthread_exit F
- pthread_getschedparam F
- pthread_getspecific F
- pthread_join F
- pthread_key_create F
- pthread_key_delete F
- pthread_kill F
- pthread_kill_other_threads_np F
- pthread_mutex_destroy F
- pthread_mutex_init F
- pthread_mutex_lock F
- pthread_mutex_trylock F
- pthread_mutex_unlock F
- pthread_mutexattr_destroy F
- pthread_mutexattr_getkind_np F
- pthread_mutexattr_init F
- pthread_mutexattr_setkind_np F
- pthread_once F
- pthread_self F
- pthread_setcancelstate F
- pthread_setcanceltype F
- pthread_setschedparam F
- pthread_setspecific F
- pthread_sigmask F
- pthread_testcancel F
- raise F
- read F
- recv F
- recvfrom F
- recvmsg F
- sem_destroy F
- sem_getvalue F
- sem_init F
- sem_post F
- sem_trywait F
- sem_wait F
- send F
- sendmsg F
- sendto F
- sigaction F
- siglongjmp F
- sigwait F
- system F
- tcdrain F
- vfork F
- wait F
- waitpid F
- write F
-GLIBC_2.1
- GLIBC_2.1 A
- __libc_allocate_rtsig F
- __libc_current_sigrtmax F
- __libc_current_sigrtmin F
- pthread_attr_getguardsize F
- pthread_attr_getstackaddr F
- pthread_attr_getstacksize F
- pthread_attr_init F
- pthread_attr_setguardsize F
- pthread_attr_setstackaddr F
- pthread_attr_setstacksize F
- pthread_create F
- pthread_getconcurrency F
- pthread_mutexattr_gettype F
- pthread_mutexattr_settype F
- pthread_rwlock_destroy F
- pthread_rwlock_init F
- pthread_rwlock_rdlock F
- pthread_rwlock_tryrdlock F
- pthread_rwlock_trywrlock F
- pthread_rwlock_unlock F
- pthread_rwlock_wrlock F
- pthread_rwlockattr_destroy F
- pthread_rwlockattr_getkind_np F
- pthread_rwlockattr_getpshared F
- pthread_rwlockattr_init F
- pthread_rwlockattr_setkind_np F
- pthread_rwlockattr_setpshared F
- pthread_setconcurrency F
- sem_destroy F
- sem_getvalue F
- sem_init F
- sem_post F
- sem_trywait F
- sem_wait F
-GLIBC_2.1.1
- GLIBC_2.1.1 A
- sem_close F
- sem_open F
- sem_unlink F
-GLIBC_2.1.2
- GLIBC_2.1.2 A
- __vfork F
-GLIBC_2.11
- GLIBC_2.11 A
- pthread_sigqueue F
-GLIBC_2.12
- GLIBC_2.12 A
- pthread_getname_np F
- pthread_mutex_consistent F
- pthread_mutexattr_getrobust F
- pthread_mutexattr_setrobust F
- pthread_setname_np F
-GLIBC_2.18
- GLIBC_2.18 A
- pthread_getattr_default_np F
- pthread_setattr_default_np F
-GLIBC_2.2
- GLIBC_2.2 A
- __open64 F
- __pread64 F
- __pthread_rwlock_destroy F
- __pthread_rwlock_init F
- __pthread_rwlock_rdlock F
- __pthread_rwlock_tryrdlock F
- __pthread_rwlock_trywrlock F
- __pthread_rwlock_unlock F
- __pthread_rwlock_wrlock F
- __pwrite64 F
- __res_state F
- lseek64 F
- open64 F
- pread F
- pread64 F
- pthread_attr_getstack F
- pthread_attr_setstack F
- pthread_barrier_destroy F
- pthread_barrier_init F
- pthread_barrier_wait F
- pthread_barrierattr_destroy F
- pthread_barrierattr_init F
- pthread_barrierattr_setpshared F
- pthread_condattr_getpshared F
- pthread_condattr_setpshared F
- pthread_getcpuclockid F
- pthread_mutex_timedlock F
- pthread_mutexattr_getpshared F
- pthread_mutexattr_setpshared F
- pthread_rwlock_timedrdlock F
- pthread_rwlock_timedwrlock F
- pthread_spin_destroy F
- pthread_spin_init F
- pthread_spin_lock F
- pthread_spin_trylock F
- pthread_spin_unlock F
- pthread_yield F
- pwrite F
- pwrite64 F
- sem_timedwait F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- pthread_getattr_np F
-GLIBC_2.2.6
- GLIBC_2.2.6 A
- __nanosleep F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- __pthread_cleanup_routine F
- __pthread_register_cancel F
- __pthread_register_cancel_defer F
- __pthread_unregister_cancel F
- __pthread_unregister_cancel_restore F
- __pthread_unwind_next F
- pthread_attr_getaffinity_np F
- pthread_attr_setaffinity_np F
- pthread_barrierattr_getpshared F
- pthread_condattr_getclock F
- pthread_condattr_setclock F
- pthread_getaffinity_np F
- pthread_setaffinity_np F
- pthread_timedjoin_np F
- pthread_tryjoin_np F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- longjmp F
- pthread_attr_getaffinity_np F
- pthread_attr_setaffinity_np F
- pthread_getaffinity_np F
- pthread_setaffinity_np F
- pthread_setschedprio F
- siglongjmp F
-GLIBC_2.4
- GLIBC_2.4 A
- pthread_mutex_consistent_np F
- pthread_mutex_getprioceiling F
- pthread_mutex_setprioceiling F
- pthread_mutexattr_getprioceiling F
- pthread_mutexattr_getprotocol F
- pthread_mutexattr_getrobust_np F
- pthread_mutexattr_setprioceiling F
- pthread_mutexattr_setprotocol F
- pthread_mutexattr_setrobust_np F
-GLIBC_2.6
- GLIBC_2.6 A
- pthread_attr_setstack F
- pthread_attr_setstacksize F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libresolv.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libresolv.abilist
deleted file mode 100644
index f68333d4a..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libresolv.abilist
+++ /dev/null
@@ -1,104 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __b64_ntop F
- __b64_pton F
- __dn_comp F
- __dn_count_labels F
- __dn_skipname F
- __fp_nquery F
- __fp_query F
- __fp_resstat F
- __hostalias F
- __loc_aton F
- __loc_ntoa F
- __p_cdname F
- __p_cdnname F
- __p_class F
- __p_class_syms D 0x54
- __p_fqname F
- __p_fqnname F
- __p_option F
- __p_query F
- __p_secstodate F
- __p_time F
- __p_type F
- __p_type_syms D 0x228
- __putlong F
- __putshort F
- __res_close F
- __res_dnok F
- __res_hnok F
- __res_isourserver F
- __res_mailok F
- __res_nameinquery F
- __res_ownok F
- __res_queriesmatch F
- __res_send F
- __sym_ntop F
- __sym_ntos F
- __sym_ston F
- _gethtbyaddr F
- _gethtbyname F
- _gethtbyname2 F
- _gethtent F
- _getlong F
- _getshort F
- _res_opcodes D 0x40
- _sethtent F
- dn_expand F
- inet_net_ntop F
- inet_net_pton F
- inet_neta F
- res_gethostbyaddr F
- res_gethostbyname F
- res_gethostbyname2 F
- res_mkquery F
- res_query F
- res_querydomain F
- res_search F
- res_send_setqhook F
- res_send_setrhook F
-GLIBC_2.2
- GLIBC_2.2 A
- __dn_expand F
- __res_hostalias F
- __res_mkquery F
- __res_nmkquery F
- __res_nquery F
- __res_nquerydomain F
- __res_nsearch F
- __res_nsend F
- __res_query F
- __res_querydomain F
- __res_search F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- __p_rcode F
-GLIBC_2.9
- GLIBC_2.9 A
- ns_datetosecs F
- ns_format_ttl F
- ns_get16 F
- ns_get32 F
- ns_initparse F
- ns_makecanon F
- ns_msg_getflag F
- ns_name_compress F
- ns_name_ntol F
- ns_name_ntop F
- ns_name_pack F
- ns_name_pton F
- ns_name_rollback F
- ns_name_skip F
- ns_name_uncompress F
- ns_name_unpack F
- ns_parse_ttl F
- ns_parserr F
- ns_put16 F
- ns_put32 F
- ns_samedomain F
- ns_samename F
- ns_skiprr F
- ns_sprintrr F
- ns_sprintrrf F
- ns_subdomain F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/librt.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/librt.abilist
deleted file mode 100644
index af7df27cb..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/librt.abilist
+++ /dev/null
@@ -1,52 +0,0 @@
-GLIBC_2.1
- GLIBC_2.1 A
- aio_cancel F
- aio_cancel64 F
- aio_error F
- aio_error64 F
- aio_fsync F
- aio_fsync64 F
- aio_init F
- aio_read F
- aio_read64 F
- aio_return F
- aio_return64 F
- aio_suspend F
- aio_suspend64 F
- aio_write F
- aio_write64 F
- lio_listio F
- lio_listio64 F
-GLIBC_2.2
- GLIBC_2.2 A
- clock_getcpuclockid F
- clock_getres F
- clock_gettime F
- clock_nanosleep F
- clock_settime F
- shm_open F
- shm_unlink F
- timer_create F
- timer_delete F
- timer_getoverrun F
- timer_gettime F
- timer_settime F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- mq_close F
- mq_getattr F
- mq_notify F
- mq_open F
- mq_receive F
- mq_send F
- mq_setattr F
- mq_timedreceive F
- mq_timedsend F
- mq_unlink F
-GLIBC_2.4
- GLIBC_2.4 A
- lio_listio F
- lio_listio64 F
-GLIBC_2.7
- GLIBC_2.7 A
- __mq_open_2 F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libthread_db.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libthread_db.abilist
deleted file mode 100644
index f33138067..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libthread_db.abilist
+++ /dev/null
@@ -1,48 +0,0 @@
-GLIBC_2.1.3
- GLIBC_2.1.3 A
- td_init F
- td_log F
- td_ta_clear_event F
- td_ta_delete F
- td_ta_enable_stats F
- td_ta_event_addr F
- td_ta_event_getmsg F
- td_ta_get_nthreads F
- td_ta_get_ph F
- td_ta_get_stats F
- td_ta_map_id2thr F
- td_ta_map_lwp2thr F
- td_ta_new F
- td_ta_reset_stats F
- td_ta_set_event F
- td_ta_setconcurrency F
- td_ta_thr_iter F
- td_ta_tsd_iter F
- td_thr_clear_event F
- td_thr_dbresume F
- td_thr_dbsuspend F
- td_thr_event_enable F
- td_thr_event_getmsg F
- td_thr_get_info F
- td_thr_getfpregs F
- td_thr_getgregs F
- td_thr_getxregs F
- td_thr_getxregsize F
- td_thr_set_event F
- td_thr_setfpregs F
- td_thr_setgregs F
- td_thr_setprio F
- td_thr_setsigpending F
- td_thr_setxregs F
- td_thr_sigsetmask F
- td_thr_tsd F
- td_thr_validate F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- td_symbol_list F
-GLIBC_2.3
- GLIBC_2.3 A
- td_thr_tls_get_addr F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- td_thr_tlsbase F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libutil.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libutil.abilist
deleted file mode 100644
index 7422687e3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/libutil.abilist
+++ /dev/null
@@ -1,8 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- forkpty F
- login F
- login_tty F
- logout F
- logwtmp F
- openpty F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/localplt.data b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/localplt.data
deleted file mode 100644
index d3f2efba6..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/nptl/localplt.data
+++ /dev/null
@@ -1,31 +0,0 @@
-libc.so: __adddf3 ?
-libc.so: __divdf3 ?
-libc.so: __eqdf2 ?
-libc.so: __extendsfdf2 ?
-libc.so: __fixdfsi ?
-libc.so: __fixunsdfsi ?
-libc.so: __floatsidf ?
-libc.so: __floatunsidf ?
-libc.so: __gedf2 ?
-libc.so: __gtdf2 ?
-libc.so: __ledf2 ?
-libc.so: __ltdf2 ?
-libc.so: __muldf3 ?
-libc.so: __nedf2 ?
-libc.so: __signbit
-libc.so: __signbitl
-libc.so: __subdf3 ?
-libc.so: __truncdfsf2 ?
-libc.so: __unorddf2 ?
-libc.so: abort ?
-libc.so: calloc
-libc.so: free
-libc.so: malloc
-libc.so: memalign
-libc.so: realloc
-libm.so: __signbit
-libm.so: __signbitf
-libm.so: __signbitl
-libm.so: copysignl
-libm.so: fegetround
-libm.so: matherr
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/shlib-versions b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/shlib-versions
deleted file mode 100644
index a746f46f3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/shlib-versions
+++ /dev/null
@@ -1 +0,0 @@
-powerpc.*-.*-.* ABI powerpce500v1-linux-gnu
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data
deleted file mode 100644
index fde53bf33..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data
+++ /dev/null
@@ -1,67 +0,0 @@
-blkcnt64_t:x
-blkcnt_t:l
-blksize_t:l
-caddr_t:Pc
-clockid_t:i
-clock_t:l
-daddr_t:i
-dev_t:y
-fd_mask:l
-fsblkcnt64_t:y
-fsblkcnt_t:m
-fsfilcnt64_t:y
-fsfilcnt_t:m
-fsid_t:8__fsid_t
-gid_t:j
-id_t:j
-ino64_t:y
-ino_t:m
-int16_t:s
-int32_t:i
-int64_t:x
-int8_t:a
-intptr_t:i
-key_t:i
-loff_t:x
-mode_t:j
-nlink_t:j
-off64_t:x
-off_t:l
-pid_t:i
-pthread_attr_t:14pthread_attr_t
-pthread_barrier_t:17pthread_barrier_t
-pthread_barrierattr_t:21pthread_barrierattr_t
-pthread_cond_t:14pthread_cond_t
-pthread_condattr_t:18pthread_condattr_t
-pthread_key_t:j
-pthread_mutex_t:15pthread_mutex_t
-pthread_mutexattr_t:19pthread_mutexattr_t
-pthread_once_t:i
-pthread_rwlock_t:16pthread_rwlock_t
-pthread_rwlockattr_t:20pthread_rwlockattr_t
-pthread_spinlock_t:i
-pthread_t:m
-quad_t:x
-register_t:i
-rlim64_t:y
-rlim_t:m
-sigset_t:10__sigset_t
-size_t:j
-socklen_t:j
-ssize_t:i
-suseconds_t:l
-time_t:l
-u_char:h
-uid_t:j
-uint:j
-u_int:j
-u_int16_t:t
-u_int32_t:j
-u_int64_t:y
-u_int8_t:h
-ulong:m
-u_long:m
-u_quad_t:y
-useconds_t:j
-ushort:t
-u_short:t
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist
deleted file mode 100644
index d71611f02..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist
+++ /dev/null
@@ -1,17 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __libc_memalign F
- _r_debug D 0x14
- calloc F
- free F
- malloc F
- realloc F
-GLIBC_2.1
- GLIBC_2.1 A
- __libc_stack_end D 0x4
- _dl_mcount F
-GLIBC_2.3
- GLIBC_2.3 A
- __tls_get_addr F
-GLIBC_2.4
- GLIBC_2.4 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist
deleted file mode 100644
index f4ca37f44..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist
+++ /dev/null
@@ -1,3 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __ctype_get_mb_cur_max F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist
deleted file mode 100644
index c9755d8a3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist
+++ /dev/null
@@ -1,6 +0,0 @@
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- gai_cancel F
- gai_error F
- gai_suspend F
- getaddrinfo_a F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist
deleted file mode 100644
index 1df145f26..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist
+++ /dev/null
@@ -1,9 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- crypt F
- crypt_r F
- encrypt F
- encrypt_r F
- fcrypt F
- setkey F
- setkey_r F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist
deleted file mode 100644
index 62e6b41ed..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist
+++ /dev/null
@@ -1,18 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- dladdr F
- dlclose F
- dlerror F
- dlopen F
- dlsym F
-GLIBC_2.1
- GLIBC_2.1 A
- dlopen F
- dlvsym F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- dladdr1 F
- dlinfo F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- dlmopen F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist
deleted file mode 100644
index 4241e2d88..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist
+++ /dev/null
@@ -1,127 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __yp_check F
- xdr_domainname F
- xdr_keydat F
- xdr_mapname F
- xdr_peername F
- xdr_valdat F
- xdr_yp_buf F
- xdr_ypbind_binding F
- xdr_ypbind_resp F
- xdr_ypbind_resptype F
- xdr_ypbind_setdom F
- xdr_ypdelete_args F
- xdr_ypmap_parms F
- xdr_ypmaplist F
- xdr_yppush_status F
- xdr_yppushresp_xfr F
- xdr_ypreq_key F
- xdr_ypreq_nokey F
- xdr_ypreq_xfr F
- xdr_ypresp_all F
- xdr_ypresp_key_val F
- xdr_ypresp_maplist F
- xdr_ypresp_master F
- xdr_ypresp_order F
- xdr_ypresp_val F
- xdr_ypresp_xfr F
- xdr_ypstat F
- xdr_ypupdate_args F
- xdr_ypxfrstat F
- yp_all F
- yp_bind F
- yp_first F
- yp_get_default_domain F
- yp_maplist F
- yp_master F
- yp_match F
- yp_next F
- yp_order F
- yp_unbind F
- yp_update F
- ypbinderr_string F
- yperr_string F
- ypprot_err F
-GLIBC_2.1
- GLIBC_2.1 A
- __free_fdresult F
- __nis_default_access F
- __nis_default_group F
- __nis_default_owner F
- __nis_default_ttl F
- __nis_finddirectory F
- __nis_hash F
- __nisbind_connect F
- __nisbind_create F
- __nisbind_destroy F
- __nisbind_next F
- nis_add F
- nis_add_entry F
- nis_addmember F
- nis_checkpoint F
- nis_clone_directory F
- nis_clone_object F
- nis_clone_result F
- nis_creategroup F
- nis_destroy_object F
- nis_destroygroup F
- nis_dir_cmp F
- nis_domain_of F
- nis_domain_of_r F
- nis_first_entry F
- nis_free_directory F
- nis_free_object F
- nis_free_request F
- nis_freenames F
- nis_freeresult F
- nis_freeservlist F
- nis_freetags F
- nis_getnames F
- nis_getservlist F
- nis_ismember F
- nis_leaf_of F
- nis_leaf_of_r F
- nis_lerror F
- nis_list F
- nis_local_directory F
- nis_local_group F
- nis_local_host F
- nis_local_principal F
- nis_lookup F
- nis_mkdir F
- nis_modify F
- nis_modify_entry F
- nis_name_of F
- nis_name_of_r F
- nis_next_entry F
- nis_perror F
- nis_ping F
- nis_print_directory F
- nis_print_entry F
- nis_print_group F
- nis_print_group_entry F
- nis_print_link F
- nis_print_object F
- nis_print_result F
- nis_print_rights F
- nis_print_table F
- nis_read_obj F
- nis_remove F
- nis_remove_entry F
- nis_removemember F
- nis_rmdir F
- nis_servstate F
- nis_sperrno F
- nis_sperror F
- nis_sperror_r F
- nis_stats F
- nis_verifygroup F
- nis_write_obj F
- readColdStartFile F
- writeColdStartFile F
- xdr_cback_data F
- xdr_obj_p F
-GLIBC_2.2
- GLIBC_2.2 A
- xdr_ypall F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
deleted file mode 100644
index c8a2a0471..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
+++ /dev/null
@@ -1,277 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- _IO_flockfile F
- _IO_ftrylockfile F
- _IO_funlockfile F
- __close F
- __connect F
- __errno_location F
- __fcntl F
- __fork F
- __h_errno_location F
- __lseek F
- __open F
- __pthread_getspecific F
- __pthread_key_create F
- __pthread_mutex_destroy F
- __pthread_mutex_init F
- __pthread_mutex_lock F
- __pthread_mutex_trylock F
- __pthread_mutex_unlock F
- __pthread_mutexattr_destroy F
- __pthread_mutexattr_init F
- __pthread_mutexattr_settype F
- __pthread_once F
- __pthread_setspecific F
- __read F
- __send F
- __sigaction F
- __wait F
- __write F
- _pthread_cleanup_pop F
- _pthread_cleanup_pop_restore F
- _pthread_cleanup_push F
- _pthread_cleanup_push_defer F
- accept F
- close F
- connect F
- fcntl F
- flockfile F
- fork F
- fsync F
- ftrylockfile F
- funlockfile F
- longjmp F
- lseek F
- msync F
- nanosleep F
- open F
- pause F
- pthread_atfork F
- pthread_attr_destroy F
- pthread_attr_getdetachstate F
- pthread_attr_getinheritsched F
- pthread_attr_getschedparam F
- pthread_attr_getschedpolicy F
- pthread_attr_getscope F
- pthread_attr_init F
- pthread_attr_setdetachstate F
- pthread_attr_setinheritsched F
- pthread_attr_setschedparam F
- pthread_attr_setschedpolicy F
- pthread_attr_setscope F
- pthread_cancel F
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
- pthread_condattr_destroy F
- pthread_condattr_init F
- pthread_create F
- pthread_detach F
- pthread_equal F
- pthread_exit F
- pthread_getschedparam F
- pthread_getspecific F
- pthread_join F
- pthread_key_create F
- pthread_key_delete F
- pthread_kill F
- pthread_kill_other_threads_np F
- pthread_mutex_destroy F
- pthread_mutex_init F
- pthread_mutex_lock F
- pthread_mutex_trylock F
- pthread_mutex_unlock F
- pthread_mutexattr_destroy F
- pthread_mutexattr_getkind_np F
- pthread_mutexattr_init F
- pthread_mutexattr_setkind_np F
- pthread_once F
- pthread_self F
- pthread_setcancelstate F
- pthread_setcanceltype F
- pthread_setschedparam F
- pthread_setspecific F
- pthread_sigmask F
- pthread_testcancel F
- raise F
- read F
- recv F
- recvfrom F
- recvmsg F
- sem_destroy F
- sem_getvalue F
- sem_init F
- sem_post F
- sem_trywait F
- sem_wait F
- send F
- sendmsg F
- sendto F
- sigaction F
- siglongjmp F
- sigwait F
- system F
- tcdrain F
- vfork F
- wait F
- waitpid F
- write F
-GLIBC_2.1
- GLIBC_2.1 A
- __libc_allocate_rtsig F
- __libc_current_sigrtmax F
- __libc_current_sigrtmin F
- pthread_attr_getguardsize F
- pthread_attr_getstackaddr F
- pthread_attr_getstacksize F
- pthread_attr_init F
- pthread_attr_setguardsize F
- pthread_attr_setstackaddr F
- pthread_attr_setstacksize F
- pthread_create F
- pthread_getconcurrency F
- pthread_mutexattr_gettype F
- pthread_mutexattr_settype F
- pthread_rwlock_destroy F
- pthread_rwlock_init F
- pthread_rwlock_rdlock F
- pthread_rwlock_tryrdlock F
- pthread_rwlock_trywrlock F
- pthread_rwlock_unlock F
- pthread_rwlock_wrlock F
- pthread_rwlockattr_destroy F
- pthread_rwlockattr_getkind_np F
- pthread_rwlockattr_getpshared F
- pthread_rwlockattr_init F
- pthread_rwlockattr_setkind_np F
- pthread_rwlockattr_setpshared F
- pthread_setconcurrency F
- sem_destroy F
- sem_getvalue F
- sem_init F
- sem_post F
- sem_trywait F
- sem_wait F
-GLIBC_2.1.1
- GLIBC_2.1.1 A
- sem_close F
- sem_open F
- sem_unlink F
-GLIBC_2.1.2
- GLIBC_2.1.2 A
- __vfork F
-GLIBC_2.11
- GLIBC_2.11 A
- pthread_sigqueue F
-GLIBC_2.12
- GLIBC_2.12 A
- pthread_getname_np F
- pthread_mutex_consistent F
- pthread_mutexattr_getrobust F
- pthread_mutexattr_setrobust F
- pthread_setname_np F
-GLIBC_2.18
- GLIBC_2.18 A
- pthread_getattr_default_np F
- pthread_setattr_default_np F
-GLIBC_2.2
- GLIBC_2.2 A
- __open64 F
- __pread64 F
- __pthread_rwlock_destroy F
- __pthread_rwlock_init F
- __pthread_rwlock_rdlock F
- __pthread_rwlock_tryrdlock F
- __pthread_rwlock_trywrlock F
- __pthread_rwlock_unlock F
- __pthread_rwlock_wrlock F
- __pwrite64 F
- __res_state F
- lseek64 F
- open64 F
- pread F
- pread64 F
- pthread_attr_getstack F
- pthread_attr_setstack F
- pthread_barrier_destroy F
- pthread_barrier_init F
- pthread_barrier_wait F
- pthread_barrierattr_destroy F
- pthread_barrierattr_init F
- pthread_barrierattr_setpshared F
- pthread_condattr_getpshared F
- pthread_condattr_setpshared F
- pthread_getcpuclockid F
- pthread_mutex_timedlock F
- pthread_mutexattr_getpshared F
- pthread_mutexattr_setpshared F
- pthread_rwlock_timedrdlock F
- pthread_rwlock_timedwrlock F
- pthread_spin_destroy F
- pthread_spin_init F
- pthread_spin_lock F
- pthread_spin_trylock F
- pthread_spin_unlock F
- pthread_yield F
- pwrite F
- pwrite64 F
- sem_timedwait F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- pthread_getattr_np F
-GLIBC_2.2.6
- GLIBC_2.2.6 A
- __nanosleep F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- pthread_cond_broadcast F
- pthread_cond_destroy F
- pthread_cond_init F
- pthread_cond_signal F
- pthread_cond_timedwait F
- pthread_cond_wait F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- __pthread_cleanup_routine F
- __pthread_register_cancel F
- __pthread_register_cancel_defer F
- __pthread_unregister_cancel F
- __pthread_unregister_cancel_restore F
- __pthread_unwind_next F
- pthread_attr_getaffinity_np F
- pthread_attr_setaffinity_np F
- pthread_barrierattr_getpshared F
- pthread_condattr_getclock F
- pthread_condattr_setclock F
- pthread_getaffinity_np F
- pthread_setaffinity_np F
- pthread_timedjoin_np F
- pthread_tryjoin_np F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- longjmp F
- pthread_attr_getaffinity_np F
- pthread_attr_setaffinity_np F
- pthread_getaffinity_np F
- pthread_setaffinity_np F
- pthread_setschedprio F
- siglongjmp F
-GLIBC_2.4
- GLIBC_2.4 A
- pthread_mutex_consistent_np F
- pthread_mutex_getprioceiling F
- pthread_mutex_setprioceiling F
- pthread_mutexattr_getprioceiling F
- pthread_mutexattr_getprotocol F
- pthread_mutexattr_getrobust_np F
- pthread_mutexattr_setprioceiling F
- pthread_mutexattr_setprotocol F
- pthread_mutexattr_setrobust_np F
-GLIBC_2.6
- GLIBC_2.6 A
- pthread_attr_setstack F
- pthread_attr_setstacksize F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist
deleted file mode 100644
index f68333d4a..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist
+++ /dev/null
@@ -1,104 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- __b64_ntop F
- __b64_pton F
- __dn_comp F
- __dn_count_labels F
- __dn_skipname F
- __fp_nquery F
- __fp_query F
- __fp_resstat F
- __hostalias F
- __loc_aton F
- __loc_ntoa F
- __p_cdname F
- __p_cdnname F
- __p_class F
- __p_class_syms D 0x54
- __p_fqname F
- __p_fqnname F
- __p_option F
- __p_query F
- __p_secstodate F
- __p_time F
- __p_type F
- __p_type_syms D 0x228
- __putlong F
- __putshort F
- __res_close F
- __res_dnok F
- __res_hnok F
- __res_isourserver F
- __res_mailok F
- __res_nameinquery F
- __res_ownok F
- __res_queriesmatch F
- __res_send F
- __sym_ntop F
- __sym_ntos F
- __sym_ston F
- _gethtbyaddr F
- _gethtbyname F
- _gethtbyname2 F
- _gethtent F
- _getlong F
- _getshort F
- _res_opcodes D 0x40
- _sethtent F
- dn_expand F
- inet_net_ntop F
- inet_net_pton F
- inet_neta F
- res_gethostbyaddr F
- res_gethostbyname F
- res_gethostbyname2 F
- res_mkquery F
- res_query F
- res_querydomain F
- res_search F
- res_send_setqhook F
- res_send_setrhook F
-GLIBC_2.2
- GLIBC_2.2 A
- __dn_expand F
- __res_hostalias F
- __res_mkquery F
- __res_nmkquery F
- __res_nquery F
- __res_nquerydomain F
- __res_nsearch F
- __res_nsend F
- __res_query F
- __res_querydomain F
- __res_search F
-GLIBC_2.3.2
- GLIBC_2.3.2 A
- __p_rcode F
-GLIBC_2.9
- GLIBC_2.9 A
- ns_datetosecs F
- ns_format_ttl F
- ns_get16 F
- ns_get32 F
- ns_initparse F
- ns_makecanon F
- ns_msg_getflag F
- ns_name_compress F
- ns_name_ntol F
- ns_name_ntop F
- ns_name_pack F
- ns_name_pton F
- ns_name_rollback F
- ns_name_skip F
- ns_name_uncompress F
- ns_name_unpack F
- ns_parse_ttl F
- ns_parserr F
- ns_put16 F
- ns_put32 F
- ns_samedomain F
- ns_samename F
- ns_skiprr F
- ns_sprintrr F
- ns_sprintrrf F
- ns_subdomain F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist
deleted file mode 100644
index af7df27cb..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist
+++ /dev/null
@@ -1,52 +0,0 @@
-GLIBC_2.1
- GLIBC_2.1 A
- aio_cancel F
- aio_cancel64 F
- aio_error F
- aio_error64 F
- aio_fsync F
- aio_fsync64 F
- aio_init F
- aio_read F
- aio_read64 F
- aio_return F
- aio_return64 F
- aio_suspend F
- aio_suspend64 F
- aio_write F
- aio_write64 F
- lio_listio F
- lio_listio64 F
-GLIBC_2.2
- GLIBC_2.2 A
- clock_getcpuclockid F
- clock_getres F
- clock_gettime F
- clock_nanosleep F
- clock_settime F
- shm_open F
- shm_unlink F
- timer_create F
- timer_delete F
- timer_getoverrun F
- timer_gettime F
- timer_settime F
-GLIBC_2.3.4
- GLIBC_2.3.4 A
- mq_close F
- mq_getattr F
- mq_notify F
- mq_open F
- mq_receive F
- mq_send F
- mq_setattr F
- mq_timedreceive F
- mq_timedsend F
- mq_unlink F
-GLIBC_2.4
- GLIBC_2.4 A
- lio_listio F
- lio_listio64 F
-GLIBC_2.7
- GLIBC_2.7 A
- __mq_open_2 F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist
deleted file mode 100644
index f33138067..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist
+++ /dev/null
@@ -1,48 +0,0 @@
-GLIBC_2.1.3
- GLIBC_2.1.3 A
- td_init F
- td_log F
- td_ta_clear_event F
- td_ta_delete F
- td_ta_enable_stats F
- td_ta_event_addr F
- td_ta_event_getmsg F
- td_ta_get_nthreads F
- td_ta_get_ph F
- td_ta_get_stats F
- td_ta_map_id2thr F
- td_ta_map_lwp2thr F
- td_ta_new F
- td_ta_reset_stats F
- td_ta_set_event F
- td_ta_setconcurrency F
- td_ta_thr_iter F
- td_ta_tsd_iter F
- td_thr_clear_event F
- td_thr_dbresume F
- td_thr_dbsuspend F
- td_thr_event_enable F
- td_thr_event_getmsg F
- td_thr_get_info F
- td_thr_getfpregs F
- td_thr_getgregs F
- td_thr_getxregs F
- td_thr_getxregsize F
- td_thr_set_event F
- td_thr_setfpregs F
- td_thr_setgregs F
- td_thr_setprio F
- td_thr_setsigpending F
- td_thr_setxregs F
- td_thr_sigsetmask F
- td_thr_tsd F
- td_thr_validate F
-GLIBC_2.2.3
- GLIBC_2.2.3 A
- td_symbol_list F
-GLIBC_2.3
- GLIBC_2.3 A
- td_thr_tls_get_addr F
-GLIBC_2.3.3
- GLIBC_2.3.3 A
- td_thr_tlsbase F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist
deleted file mode 100644
index 7422687e3..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist
+++ /dev/null
@@ -1,8 +0,0 @@
-GLIBC_2.0
- GLIBC_2.0 A
- forkpty F
- login F
- login_tty F
- logout F
- logwtmp F
- openpty F
diff --git a/libc/posix/glob.c b/libc/posix/glob.c
index adcbf777f..02c8477c6 100644
--- a/libc/posix/glob.c
+++ b/libc/posix/glob.c
@@ -196,7 +196,7 @@
# define GET_LOGIN_NAME_MAX() (-1)
#endif
-static const char *next_brace_sub (const char *begin, int flags) __THROW;
+static const char *next_brace_sub (const char *begin, int flags) __THROWNL;
#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
@@ -211,8 +211,8 @@ extern int __glob_pattern_type (const char *pattern, int quote)
attribute_hidden;
#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 void *, const void *) __THROW;
+static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL;
+static int collated_compare (const void *, const void *) __THROWNL;
/* Find the end of the sub-pattern in a brace expression. */
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index 5a73696e5..7f2e85f32 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -441,7 +441,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
malloc(sizeof (struct sockaddr_in6));
if (EXT(statp).nsaddrs[n] != NULL) {
memset (mempcpy(EXT(statp).nsaddrs[n],
- &statp->nsaddr_list[n],
+ &statp->nsaddr_list[ns],
sizeof (struct sockaddr_in)),
'\0',
sizeof (struct sockaddr_in6)
diff --git a/libc/scripts/bench.pl b/libc/scripts/bench.pl
index dcf135528..492ab816e 100755
--- a/libc/scripts/bench.pl
+++ b/libc/scripts/bench.pl
@@ -21,40 +21,92 @@ use strict;
use warnings;
# Generate a benchmark source file for a given input.
-if (@ARGV < 2) {
- die "Usage: bench.pl <function> [parameter types] [return type]"
+if (@ARGV < 1) {
+ die "Usage: bench.pl <function>"
}
-my $arg;
my $func = $ARGV[0];
my @args;
my $ret = "void";
my $getret = "";
-my $retval = "";
-if (@ARGV >= 2) {
- @args = split(':', $ARGV[1]);
-}
+# We create a hash of inputs for each variant of the test.
+my $variant = "";
+my @curvals;
+my %vals;
+my @include_headers;
+my @include_sources;
+my $incl;
+
+open INPUTS, "<$func-inputs" or die $!;
+
+LINE:while (<INPUTS>) {
+ chomp;
+
+ # Directives.
+ if (/^## ([\w-]+): (.*)/) {
+ # Function argument types.
+ if ($1 eq "args") {
+ @args = split(":", $2);
+ }
+
+ # Function return type.
+ elsif ($1 eq "ret") {
+ $ret = $2;
+ }
+
+ elsif ($1 eq "includes") {
+ @include_headers = split (",", $2);
+ }
+
+ elsif ($1 eq "include-sources") {
+ @include_sources = split (",", $2);
+ }
+
+ # New variant. This is the only directive allowed in the body of the
+ # inputs to separate inputs into variants. All others should be at the
+ # top or else all hell will break loose.
+ elsif ($1 eq "name") {
+
+ # Save values in the previous variant.
+ my @copy = @curvals;
+ $vals{$variant} = \@copy;
+
+ # Prepare for the next.
+ $variant=$2;
+ undef @curvals;
+ next LINE;
+ }
+
+ else {
+ die "Unknown directive: ".$1;
+ }
+ }
-if (@ARGV == 3) {
- $ret = $ARGV[2];
+ # Skip over comments.
+ if (/^#/) {
+ next LINE;
+ }
+ push (@curvals, $_);
}
-my $decl = "extern $ret $func (";
-# Function has no arguments.
-if (@args == 0 || $args[0] eq "void") {
- print "$decl void);\n";
- print "#define CALL_BENCH_FUNC(i,j) $func();\n";
- print "#define NUM_VARIANTS (1)\n";
- print "#define NUM_SAMPLES(v) (1)\n";
- print "#define VARIANT(v) FUNCNAME \"()\"\n"
+my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
+
+
+# Print the definitions and macros.
+foreach $incl (@include_headers) {
+ print "#include <" . $incl . ">\n";
}
-# The function has arguments, so parse them and populate the inputs.
-else {
- my $num = 0;
- my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
+# Print the source files.
+foreach $incl (@include_sources) {
+ print "#include \"" . $incl . "\"\n";
+}
+
+if (@args > 0) {
+ # Save values in the last variant.
+ $vals{$variant} = \@curvals;
my $struct =
"struct _variants
{
@@ -65,60 +117,21 @@ else {
my $arg_struct = "struct args {";
+ my $num = 0;
+ my $arg;
foreach $arg (@args) {
if ($num > 0) {
$bench_func = "$bench_func,";
- $decl = "$decl,";
}
$arg_struct = "$arg_struct volatile $arg arg$num;";
$bench_func = "$bench_func variants[v].in[i].arg$num";
- $decl = "$decl $arg";
$num = $num + 1;
}
$arg_struct = $arg_struct . "};\n";
- $decl = $decl . ");\n";
$bench_func = $bench_func . ");\n";
- # We create a hash of inputs for each variant of the test.
- my $variant = "";
- my @curvals;
- my %vals;
-
- open INPUTS, "<$func-inputs" or die $!;
-
- LINE:while (<INPUTS>) {
- chomp;
-
- # New variant.
- if (/^## (\w+): (\w+)/) {
- #We only identify Name for now.
- if ($1 ne "name") {
- next LINE;
- }
-
- # Save values in the last variant.
- my @copy = @curvals;
- $vals{$variant} = \@copy;
-
- # Prepare for the next.
- $variant=$2;
- undef @curvals;
- next LINE;
- }
-
- # Skip over comments.
- if (/^#/) {
- next LINE;
- }
- push (@curvals, $_);
- }
-
- $vals{$variant} = \@curvals;
-
- # Print the definitions and macros.
- print $decl;
print $bench_func;
print $arg_struct;
print $struct;
@@ -147,17 +160,24 @@ else {
$c += 1;
}
print "};\n\n";
-
# Finally, print the last set of macros.
print "#define NUM_VARIANTS $c\n";
print "#define NUM_SAMPLES(i) (variants[i].count)\n";
print "#define VARIANT(i) (variants[i].name)\n";
}
+else {
+ print $bench_func . ");\n";
+ print "#define NUM_VARIANTS (1)\n";
+ print "#define NUM_SAMPLES(v) (1)\n";
+ print "#define VARIANT(v) FUNCNAME \"()\"\n"
+}
+
+
# In some cases not storing a return value seems to result in the function call
# being optimized out.
if ($ret ne "void") {
- print "static volatile $ret ret = 0.0;\n";
+ print "static volatile $ret ret;\n";
$getret = "ret = ";
}
diff --git a/libc/shlib-versions b/libc/shlib-versions
index 934459008..51f532734 100644
--- a/libc/shlib-versions
+++ b/libc/shlib-versions
@@ -23,6 +23,7 @@
s390x-.*-linux.* DEFAULT GLIBC_2.2
powerpc64-.*-linux.* DEFAULT GLIBC_2.3
+powerpc.*le-.*-linux.* DEFAULT GLIBC_2.18
.*-.*-gnu-gnu.* DEFAULT GLIBC_2.2.6
# Configuration ABI Identifier for ABI data files
diff --git a/libc/soft-fp/adddf3.c b/libc/soft-fp/adddf3.c
index 55df554b0..5aadfa331 100644
--- a/libc/soft-fp/adddf3.c
+++ b/libc/soft-fp/adddf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __adddf3(DFtype a, DFtype b)
+DFtype
+__adddf3 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_D(A, a);
- FP_UNPACK_SEMIRAW_D(B, b);
- FP_ADD_D(R, A, B);
- FP_PACK_SEMIRAW_D(r, R);
+ FP_UNPACK_SEMIRAW_D (A, a);
+ FP_UNPACK_SEMIRAW_D (B, b);
+ FP_ADD_D (R, A, B);
+ FP_PACK_SEMIRAW_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/addsf3.c b/libc/soft-fp/addsf3.c
index 8a31449e3..ac571bad0 100644
--- a/libc/soft-fp/addsf3.c
+++ b/libc/soft-fp/addsf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __addsf3(SFtype a, SFtype b)
+SFtype
+__addsf3 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_S(A, a);
- FP_UNPACK_SEMIRAW_S(B, b);
- FP_ADD_S(R, A, B);
- FP_PACK_SEMIRAW_S(r, R);
+ FP_UNPACK_SEMIRAW_S (A, a);
+ FP_UNPACK_SEMIRAW_S (B, b);
+ FP_ADD_S (R, A, B);
+ FP_PACK_SEMIRAW_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/addtf3.c b/libc/soft-fp/addtf3.c
index 7a2732513..1c0d266c6 100644
--- a/libc/soft-fp/addtf3.c
+++ b/libc/soft-fp/addtf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __addtf3(TFtype a, TFtype b)
+TFtype
+__addtf3 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (R);
TFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_Q(A, a);
- FP_UNPACK_SEMIRAW_Q(B, b);
- FP_ADD_Q(R, A, B);
- FP_PACK_SEMIRAW_Q(r, R);
+ FP_UNPACK_SEMIRAW_Q (A, a);
+ FP_UNPACK_SEMIRAW_Q (B, b);
+ FP_ADD_Q (R, A, B);
+ FP_PACK_SEMIRAW_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/divdf3.c b/libc/soft-fp/divdf3.c
index c3dcf8085..d357bf022 100644
--- a/libc/soft-fp/divdf3.c
+++ b/libc/soft-fp/divdf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __divdf3(DFtype a, DFtype b)
+DFtype
+__divdf3 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_D(A, a);
- FP_UNPACK_D(B, b);
- FP_DIV_D(R, A, B);
- FP_PACK_D(r, R);
+ FP_UNPACK_D (A, a);
+ FP_UNPACK_D (B, b);
+ FP_DIV_D (R, A, B);
+ FP_PACK_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/divsf3.c b/libc/soft-fp/divsf3.c
index 063462f8a..b53b4031d 100644
--- a/libc/soft-fp/divsf3.c
+++ b/libc/soft-fp/divsf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __divsf3(SFtype a, SFtype b)
+SFtype
+__divsf3 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_S(A, a);
- FP_UNPACK_S(B, b);
- FP_DIV_S(R, A, B);
- FP_PACK_S(r, R);
+ FP_UNPACK_S (A, a);
+ FP_UNPACK_S (B, b);
+ FP_DIV_S (R, A, B);
+ FP_PACK_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/divtf3.c b/libc/soft-fp/divtf3.c
index 03d017ddb..5b7175da5 100644
--- a/libc/soft-fp/divtf3.c
+++ b/libc/soft-fp/divtf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __divtf3(TFtype a, TFtype b)
+TFtype
+__divtf3 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (R);
TFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_Q(A, a);
- FP_UNPACK_Q(B, b);
- FP_DIV_Q(R, A, B);
- FP_PACK_Q(r, R);
+ FP_UNPACK_Q (A, a);
+ FP_UNPACK_Q (B, b);
+ FP_DIV_Q (R, A, B);
+ FP_PACK_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/double.h b/libc/soft-fp/double.h
index 8653f6913..ef4576707 100644
--- a/libc/soft-fp/double.h
+++ b/libc/soft-fp/double.h
@@ -31,15 +31,15 @@
<http://www.gnu.org/licenses/>. */
#if _FP_W_TYPE_SIZE < 32
-#error "Here's a nickel kid. Go buy yourself a real computer."
+# error "Here's a nickel kid. Go buy yourself a real computer."
#endif
#if _FP_W_TYPE_SIZE < 64
-#define _FP_FRACTBITS_D (2 * _FP_W_TYPE_SIZE)
-#define _FP_FRACTBITS_DW_D (4 * _FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_D (2 * _FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_DW_D (4 * _FP_W_TYPE_SIZE)
#else
-#define _FP_FRACTBITS_D _FP_W_TYPE_SIZE
-#define _FP_FRACTBITS_DW_D (2 * _FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_D _FP_W_TYPE_SIZE
+# define _FP_FRACTBITS_DW_D (2 * _FP_W_TYPE_SIZE)
#endif
#define _FP_FRACBITS_D 53
@@ -51,226 +51,264 @@
#define _FP_EXPMAX_D 2047
#define _FP_QNANBIT_D \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE)
#define _FP_QNANBIT_SH_D \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_D-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_D \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_SH_D \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_D-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_OVERFLOW_D \
- ((_FP_W_TYPE)1 << _FP_WFRACBITS_D % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << _FP_WFRACBITS_D % _FP_W_TYPE_SIZE)
#define _FP_WFRACBITS_DW_D (2 * _FP_WFRACBITS_D)
#define _FP_WFRACXBITS_DW_D (_FP_FRACTBITS_DW_D - _FP_WFRACBITS_DW_D)
#define _FP_HIGHBIT_DW_D \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_DW_D - 1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_D - 1) % _FP_W_TYPE_SIZE)
-typedef float DFtype __attribute__((mode(DF)));
+typedef float DFtype __attribute__ ((mode (DF)));
#if _FP_W_TYPE_SIZE < 64
union _FP_UNION_D
{
DFtype flt;
- struct _FP_STRUCT_LAYOUT {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_D;
unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
unsigned frac0 : _FP_W_TYPE_SIZE;
-#else
+# else
unsigned frac0 : _FP_W_TYPE_SIZE;
unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
unsigned exp : _FP_EXPBITS_D;
unsigned sign : 1;
-#endif
- } bits __attribute__((packed));
+# endif
+ } bits __attribute__ ((packed));
};
-#define FP_DECL_D(X) _FP_DECL(2,X)
-#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_2(D,X,val)
-#define FP_UNPACK_RAW_DP(X,val) _FP_UNPACK_RAW_2_P(D,X,val)
-#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_2(D,val,X)
-#define FP_PACK_RAW_DP(val,X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(D,val,X); \
- } while (0)
-
-#define FP_UNPACK_D(X,val) \
- do { \
- _FP_UNPACK_RAW_2(D,X,val); \
- _FP_UNPACK_CANONICAL(D,2,X); \
- } while (0)
-
-#define FP_UNPACK_DP(X,val) \
- do { \
- _FP_UNPACK_RAW_2_P(D,X,val); \
- _FP_UNPACK_CANONICAL(D,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_D(X,val) \
- do { \
- _FP_UNPACK_RAW_2(D,X,val); \
- _FP_UNPACK_SEMIRAW(D,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_DP(X,val) \
- do { \
- _FP_UNPACK_RAW_2_P(D,X,val); \
- _FP_UNPACK_SEMIRAW(D,2,X); \
- } while (0)
-
-#define FP_PACK_D(val,X) \
- do { \
- _FP_PACK_CANONICAL(D,2,X); \
- _FP_PACK_RAW_2(D,val,X); \
- } while (0)
-
-#define FP_PACK_DP(val,X) \
- do { \
- _FP_PACK_CANONICAL(D,2,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(D,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_D(val,X) \
- do { \
- _FP_PACK_SEMIRAW(D,2,X); \
- _FP_PACK_RAW_2(D,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_DP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(D,2,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(D,val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_D(X) _FP_ISSIGNAN(D,2,X)
-#define FP_NEG_D(R,X) _FP_NEG(D,2,R,X)
-#define FP_ADD_D(R,X,Y) _FP_ADD(D,2,R,X,Y)
-#define FP_SUB_D(R,X,Y) _FP_SUB(D,2,R,X,Y)
-#define FP_MUL_D(R,X,Y) _FP_MUL(D,2,R,X,Y)
-#define FP_DIV_D(R,X,Y) _FP_DIV(D,2,R,X,Y)
-#define FP_SQRT_D(R,X) _FP_SQRT(D,2,R,X)
-#define _FP_SQRT_MEAT_D(R,S,T,X,Q) _FP_SQRT_MEAT_2(R,S,T,X,Q)
-#define FP_FMA_D(R,X,Y,Z) _FP_FMA(D,2,4,R,X,Y,Z)
-
-#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,2,r,X,Y,un)
-#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y)
-#define FP_CMP_UNORD_D(r,X,Y) _FP_CMP_UNORD(D,2,r,X,Y)
-
-#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
-#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)
-
-#define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_2(X)
-#define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_2(X)
-
-#define _FP_FRAC_HIGH_DW_D(X) _FP_FRAC_HIGH_4(X)
+# define FP_DECL_D(X) _FP_DECL (2, X)
+# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_2 (D, X, val)
+# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_2_P (D, X, val)
+# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_2 (D, val, X)
+# define FP_PACK_RAW_DP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_D(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2 (D, X, val); \
+ _FP_UNPACK_CANONICAL (D, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_DP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2_P (D, X, val); \
+ _FP_UNPACK_CANONICAL (D, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_D(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2 (D, X, val); \
+ _FP_UNPACK_SEMIRAW (D, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_DP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2_P (D, X, val); \
+ _FP_UNPACK_SEMIRAW (D, 2, X); \
+ } \
+ while (0)
+
+# define FP_PACK_D(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (D, 2, X); \
+ _FP_PACK_RAW_2 (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_DP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (D, 2, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_D(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (D, 2, X); \
+ _FP_PACK_RAW_2 (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_DP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (D, 2, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_D(X) _FP_ISSIGNAN (D, 2, X)
+# define FP_NEG_D(R, X) _FP_NEG (D, 2, R, X)
+# define FP_ADD_D(R, X, Y) _FP_ADD (D, 2, R, X, Y)
+# define FP_SUB_D(R, X, Y) _FP_SUB (D, 2, R, X, Y)
+# define FP_MUL_D(R, X, Y) _FP_MUL (D, 2, R, X, Y)
+# define FP_DIV_D(R, X, Y) _FP_DIV (D, 2, R, X, Y)
+# define FP_SQRT_D(R, X) _FP_SQRT (D, 2, R, X)
+# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, Q)
+# define FP_FMA_D(R, X, Y, Z) _FP_FMA (D, 2, 4, R, X, Y, Z)
+
+# define FP_CMP_D(r, X, Y, un) _FP_CMP (D, 2, r, X, Y, un)
+# define FP_CMP_EQ_D(r, X, Y) _FP_CMP_EQ (D, 2, r, X, Y)
+# define FP_CMP_UNORD_D(r, X, Y) _FP_CMP_UNORD (D, 2, r, X, Y)
+
+# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 2, r, X, rsz, rsg)
+# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 2, X, r, rs, rt)
+
+# define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_2 (X)
+# define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_2 (X)
+
+# define _FP_FRAC_HIGH_DW_D(X) _FP_FRAC_HIGH_4 (X)
#else
union _FP_UNION_D
{
DFtype flt;
- struct _FP_STRUCT_LAYOUT {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_D;
_FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
-#else
+# else
_FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
unsigned exp : _FP_EXPBITS_D;
unsigned sign : 1;
-#endif
- } bits __attribute__((packed));
+# endif
+ } bits __attribute__ ((packed));
};
-#define FP_DECL_D(X) _FP_DECL(1,X)
-#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_1(D,X,val)
-#define FP_UNPACK_RAW_DP(X,val) _FP_UNPACK_RAW_1_P(D,X,val)
-#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_1(D,val,X)
-#define FP_PACK_RAW_DP(val,X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(D,val,X); \
- } while (0)
-
-#define FP_UNPACK_D(X,val) \
- do { \
- _FP_UNPACK_RAW_1(D,X,val); \
- _FP_UNPACK_CANONICAL(D,1,X); \
- } while (0)
-
-#define FP_UNPACK_DP(X,val) \
- do { \
- _FP_UNPACK_RAW_1_P(D,X,val); \
- _FP_UNPACK_CANONICAL(D,1,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_D(X,val) \
- do { \
- _FP_UNPACK_RAW_1(D,X,val); \
- _FP_UNPACK_SEMIRAW(D,1,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_DP(X,val) \
- do { \
- _FP_UNPACK_RAW_1_P(D,X,val); \
- _FP_UNPACK_SEMIRAW(D,1,X); \
- } while (0)
-
-#define FP_PACK_D(val,X) \
- do { \
- _FP_PACK_CANONICAL(D,1,X); \
- _FP_PACK_RAW_1(D,val,X); \
- } while (0)
-
-#define FP_PACK_DP(val,X) \
- do { \
- _FP_PACK_CANONICAL(D,1,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(D,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_D(val,X) \
- do { \
- _FP_PACK_SEMIRAW(D,1,X); \
- _FP_PACK_RAW_1(D,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_DP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(D,1,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(D,val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_D(X) _FP_ISSIGNAN(D,1,X)
-#define FP_NEG_D(R,X) _FP_NEG(D,1,R,X)
-#define FP_ADD_D(R,X,Y) _FP_ADD(D,1,R,X,Y)
-#define FP_SUB_D(R,X,Y) _FP_SUB(D,1,R,X,Y)
-#define FP_MUL_D(R,X,Y) _FP_MUL(D,1,R,X,Y)
-#define FP_DIV_D(R,X,Y) _FP_DIV(D,1,R,X,Y)
-#define FP_SQRT_D(R,X) _FP_SQRT(D,1,R,X)
-#define _FP_SQRT_MEAT_D(R,S,T,X,Q) _FP_SQRT_MEAT_1(R,S,T,X,Q)
-#define FP_FMA_D(R,X,Y,Z) _FP_FMA(D,1,2,R,X,Y,Z)
+# define FP_DECL_D(X) _FP_DECL (1, X)
+# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_1 (D, X, val)
+# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_1_P (D, X, val)
+# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_1 (D, val, X)
+# define FP_PACK_RAW_DP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_D(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1 (D, X, val); \
+ _FP_UNPACK_CANONICAL (D, 1, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_DP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1_P (D, X, val); \
+ _FP_UNPACK_CANONICAL (D, 1, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_D(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1 (D, X, val); \
+ _FP_UNPACK_SEMIRAW (D, 1, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_DP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1_P (D, X, val); \
+ _FP_UNPACK_SEMIRAW (D, 1, X); \
+ } \
+ while (0)
+
+# define FP_PACK_D(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (D, 1, X); \
+ _FP_PACK_RAW_1 (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_DP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (D, 1, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_D(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (D, 1, X); \
+ _FP_PACK_RAW_1 (D, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_DP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (D, 1, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (D, val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_D(X) _FP_ISSIGNAN (D, 1, X)
+# define FP_NEG_D(R, X) _FP_NEG (D, 1, R, X)
+# define FP_ADD_D(R, X, Y) _FP_ADD (D, 1, R, X, Y)
+# define FP_SUB_D(R, X, Y) _FP_SUB (D, 1, R, X, Y)
+# define FP_MUL_D(R, X, Y) _FP_MUL (D, 1, R, X, Y)
+# define FP_DIV_D(R, X, Y) _FP_DIV (D, 1, R, X, Y)
+# define FP_SQRT_D(R, X) _FP_SQRT (D, 1, R, X)
+# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, Q)
+# define FP_FMA_D(R, X, Y, Z) _FP_FMA (D, 1, 2, R, X, Y, Z)
/* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by
the target machine. */
-#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,1,r,X,Y,un)
-#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,1,r,X,Y)
-#define FP_CMP_UNORD_D(r,X,Y) _FP_CMP_UNORD(D,1,r,X,Y)
+# define FP_CMP_D(r, X, Y, un) _FP_CMP (D, 1, r, X, Y, un)
+# define FP_CMP_EQ_D(r, X, Y) _FP_CMP_EQ (D, 1, r, X, Y)
+# define FP_CMP_UNORD_D(r, X, Y) _FP_CMP_UNORD (D, 1, r, X, Y)
-#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg)
-#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt)
+# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 1, r, X, rsz, rsg)
+# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 1, X, r, rs, rt)
-#define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_1(X)
-#define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_1(X)
+# define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_1 (X)
+# define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_1 (X)
-#define _FP_FRAC_HIGH_DW_D(X) _FP_FRAC_HIGH_2(X)
+# define _FP_FRAC_HIGH_DW_D(X) _FP_FRAC_HIGH_2 (X)
#endif /* W_TYPE_SIZE < 64 */
diff --git a/libc/soft-fp/eqdf2.c b/libc/soft-fp/eqdf2.c
index c93c118f4..e8cfd7666 100644
--- a/libc/soft-fp/eqdf2.c
+++ b/libc/soft-fp/eqdf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "double.h"
-CMPtype __eqdf2(DFtype a, DFtype b)
+CMPtype
+__eqdf2 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
CMPtype r;
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_EQ_D(r, A, B);
- if (r && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_UNPACK_RAW_D (B, b);
+ FP_CMP_EQ_D (r, A, B);
+ if (r && (FP_ISSIGNAN_D (A) || FP_ISSIGNAN_D (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__eqdf2, __nedf2);
+strong_alias (__eqdf2, __nedf2);
diff --git a/libc/soft-fp/eqsf2.c b/libc/soft-fp/eqsf2.c
index e5b2a5f36..0bdb7fb22 100644
--- a/libc/soft-fp/eqsf2.c
+++ b/libc/soft-fp/eqsf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "single.h"
-CMPtype __eqsf2(SFtype a, SFtype b)
+CMPtype
+__eqsf2 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
CMPtype r;
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_EQ_S(r, A, B);
- if (r && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_UNPACK_RAW_S (B, b);
+ FP_CMP_EQ_S (r, A, B);
+ if (r && (FP_ISSIGNAN_S (A) || FP_ISSIGNAN_S (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__eqsf2, __nesf2);
+strong_alias (__eqsf2, __nesf2);
diff --git a/libc/soft-fp/eqtf2.c b/libc/soft-fp/eqtf2.c
index 47b5d5cb6..edbc6f683 100644
--- a/libc/soft-fp/eqtf2.c
+++ b/libc/soft-fp/eqtf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "quad.h"
-CMPtype __eqtf2(TFtype a, TFtype b)
+CMPtype
+__eqtf2 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
CMPtype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_UNPACK_RAW_Q(B, b);
- FP_CMP_EQ_Q(r, A, B);
- if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_UNPACK_RAW_Q (B, b);
+ FP_CMP_EQ_Q (r, A, B);
+ if (r && (FP_ISSIGNAN_Q (A) || FP_ISSIGNAN_Q (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__eqtf2, __netf2);
+strong_alias (__eqtf2, __netf2);
diff --git a/libc/soft-fp/extenddftf2.c b/libc/soft-fp/extenddftf2.c
index ff76a8cc2..2471fda95 100644
--- a/libc/soft-fp/extenddftf2.c
+++ b/libc/soft-fp/extenddftf2.c
@@ -32,21 +32,22 @@
#include "double.h"
#include "quad.h"
-TFtype __extenddftf2(DFtype a)
+TFtype
+__extenddftf2 (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
- FP_DECL_Q(R);
+ FP_DECL_D (A);
+ FP_DECL_Q (R);
TFtype r;
- FP_INIT_ROUNDMODE;
- FP_UNPACK_RAW_D(A, a);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
- FP_EXTEND(Q,D,4,2,R,A);
+ FP_EXTEND (Q, D, 4, 2, R, A);
#else
- FP_EXTEND(Q,D,2,1,R,A);
+ FP_EXTEND (Q, D, 2, 1, R, A);
#endif
- FP_PACK_RAW_Q(r, R);
+ FP_PACK_RAW_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/extended.h b/libc/soft-fp/extended.h
index c8b158308..1189f7c7d 100644
--- a/libc/soft-fp/extended.h
+++ b/libc/soft-fp/extended.h
@@ -28,15 +28,15 @@
<http://www.gnu.org/licenses/>. */
#if _FP_W_TYPE_SIZE < 32
-#error "Here's a nickel, kid. Go buy yourself a real computer."
+# error "Here's a nickel, kid. Go buy yourself a real computer."
#endif
#if _FP_W_TYPE_SIZE < 64
-#define _FP_FRACTBITS_E (4*_FP_W_TYPE_SIZE)
-#define _FP_FRACTBITS_DW_E (8*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_E (4*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_DW_E (8*_FP_W_TYPE_SIZE)
#else
-#define _FP_FRACTBITS_E (2*_FP_W_TYPE_SIZE)
-#define _FP_FRACTBITS_DW_E (4*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_E (2*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_DW_E (4*_FP_W_TYPE_SIZE)
#endif
#define _FP_FRACBITS_E 64
@@ -48,158 +48,187 @@
#define _FP_EXPMAX_E 32767
#define _FP_QNANBIT_E \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-2) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_E-2) % _FP_W_TYPE_SIZE)
#define _FP_QNANBIT_SH_E \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_E-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_E \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_E-1) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_SH_E \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_E-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_OVERFLOW_E \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_E % _FP_W_TYPE_SIZE))
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_E % _FP_W_TYPE_SIZE))
#define _FP_WFRACBITS_DW_E (2 * _FP_WFRACBITS_E)
#define _FP_WFRACXBITS_DW_E (_FP_FRACTBITS_DW_E - _FP_WFRACBITS_DW_E)
#define _FP_HIGHBIT_DW_E \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_DW_E - 1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_E - 1) % _FP_W_TYPE_SIZE)
-typedef float XFtype __attribute__((mode(XF)));
+typedef float XFtype __attribute__ ((mode (XF)));
#if _FP_W_TYPE_SIZE < 64
union _FP_UNION_E
{
- XFtype flt;
- struct _FP_STRUCT_LAYOUT
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned long pad1 : _FP_W_TYPE_SIZE;
- unsigned long pad2 : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
- unsigned long sign : 1;
- unsigned long exp : _FP_EXPBITS_E;
- unsigned long frac1 : _FP_W_TYPE_SIZE;
- unsigned long frac0 : _FP_W_TYPE_SIZE;
-#else
- unsigned long frac0 : _FP_W_TYPE_SIZE;
- unsigned long frac1 : _FP_W_TYPE_SIZE;
- unsigned exp : _FP_EXPBITS_E;
- unsigned sign : 1;
-#endif /* not bigendian */
- } bits __attribute__((packed));
+ XFtype flt;
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned long pad1 : _FP_W_TYPE_SIZE;
+ unsigned long pad2 : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
+ unsigned long sign : 1;
+ unsigned long exp : _FP_EXPBITS_E;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+# else
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned exp : _FP_EXPBITS_E;
+ unsigned sign : 1;
+# endif /* not bigendian */
+ } bits __attribute__ ((packed));
};
-#define FP_DECL_E(X) _FP_DECL(4,X)
-
-#define FP_UNPACK_RAW_E(X, val) \
- do { \
- union _FP_UNION_E _flo; _flo.flt = (val); \
- \
- X##_f[2] = 0; X##_f[3] = 0; \
- X##_f[0] = _flo.bits.frac0; \
- X##_f[1] = _flo.bits.frac1; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } while (0)
-
-#define FP_UNPACK_RAW_EP(X, val) \
- do { \
- union _FP_UNION_E *_flo = \
- (union _FP_UNION_E *)(val); \
- \
- X##_f[2] = 0; X##_f[3] = 0; \
- X##_f[0] = _flo->bits.frac0; \
- X##_f[1] = _flo->bits.frac1; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } while (0)
-
-#define FP_PACK_RAW_E(val, X) \
- do { \
- union _FP_UNION_E _flo; \
- \
- if (X##_e) X##_f[1] |= _FP_IMPLBIT_E; \
- else X##_f[1] &= ~(_FP_IMPLBIT_E); \
- _flo.bits.frac0 = X##_f[0]; \
- _flo.bits.frac1 = X##_f[1]; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
- \
- (val) = _flo.flt; \
- } while (0)
-
-#define FP_PACK_RAW_EP(val, X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- { \
- union _FP_UNION_E *_flo = \
- (union _FP_UNION_E *)(val); \
- \
- if (X##_e) X##_f[1] |= _FP_IMPLBIT_E; \
- else X##_f[1] &= ~(_FP_IMPLBIT_E); \
- _flo->bits.frac0 = X##_f[0]; \
- _flo->bits.frac1 = X##_f[1]; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } \
- } while (0)
-
-#define FP_UNPACK_E(X,val) \
- do { \
- FP_UNPACK_RAW_E(X,val); \
- _FP_UNPACK_CANONICAL(E,4,X); \
- } while (0)
-
-#define FP_UNPACK_EP(X,val) \
- do { \
- FP_UNPACK_RAW_EP(X,val); \
- _FP_UNPACK_CANONICAL(E,4,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_E(X,val) \
- do { \
- FP_UNPACK_RAW_E(X,val); \
- _FP_UNPACK_SEMIRAW(E,4,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_EP(X,val) \
- do { \
- FP_UNPACK_RAW_EP(X,val); \
- _FP_UNPACK_SEMIRAW(E,4,X); \
- } while (0)
-
-#define FP_PACK_E(val,X) \
- do { \
- _FP_PACK_CANONICAL(E,4,X); \
- FP_PACK_RAW_E(val,X); \
- } while (0)
-
-#define FP_PACK_EP(val,X) \
- do { \
- _FP_PACK_CANONICAL(E,4,X); \
- FP_PACK_RAW_EP(val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_E(val,X) \
- do { \
- _FP_PACK_SEMIRAW(E,4,X); \
- FP_PACK_RAW_E(val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_EP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(E,4,X); \
- FP_PACK_RAW_EP(val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,4,X)
-#define FP_NEG_E(R,X) _FP_NEG(E,4,R,X)
-#define FP_ADD_E(R,X,Y) _FP_ADD(E,4,R,X,Y)
-#define FP_SUB_E(R,X,Y) _FP_SUB(E,4,R,X,Y)
-#define FP_MUL_E(R,X,Y) _FP_MUL(E,4,R,X,Y)
-#define FP_DIV_E(R,X,Y) _FP_DIV(E,4,R,X,Y)
-#define FP_SQRT_E(R,X) _FP_SQRT(E,4,R,X)
-#define FP_FMA_E(R,X,Y,Z) _FP_FMA(E,4,8,R,X,Y,Z)
+# define FP_DECL_E(X) _FP_DECL (4, X)
+
+# define FP_UNPACK_RAW_E(X, val) \
+ do \
+ { \
+ union _FP_UNION_E _flo; \
+ _flo.flt = (val); \
+ \
+ X##_f[2] = 0; \
+ X##_f[3] = 0; \
+ X##_f[0] = _flo.bits.frac0; \
+ X##_f[1] = _flo.bits.frac1; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } \
+ while (0)
+
+# define FP_UNPACK_RAW_EP(X, val) \
+ do \
+ { \
+ union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
+ \
+ X##_f[2] = 0; \
+ X##_f[3] = 0; \
+ X##_f[0] = _flo->bits.frac0; \
+ X##_f[1] = _flo->bits.frac1; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } \
+ while (0)
+
+# define FP_PACK_RAW_E(val, X) \
+ do \
+ { \
+ union _FP_UNION_E _flo; \
+ \
+ if (X##_e) \
+ X##_f[1] |= _FP_IMPLBIT_E; \
+ else \
+ X##_f[1] &= ~(_FP_IMPLBIT_E); \
+ _flo.bits.frac0 = X##_f[0]; \
+ _flo.bits.frac1 = X##_f[1]; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } \
+ while (0)
+
+# define FP_PACK_RAW_EP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
+ \
+ if (X##_e) \
+ X##_f[1] |= _FP_IMPLBIT_E; \
+ else \
+ X##_f[1] &= ~(_FP_IMPLBIT_E); \
+ _flo->bits.frac0 = X##_f[0]; \
+ _flo->bits.frac1 = X##_f[1]; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ } \
+ while (0)
+
+# define FP_UNPACK_E(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_E (X, val); \
+ _FP_UNPACK_CANONICAL (E, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_EP(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_EP (X, val); \
+ _FP_UNPACK_CANONICAL (E, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_E(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_E (X, val); \
+ _FP_UNPACK_SEMIRAW (E, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_EP(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_EP (X, val); \
+ _FP_UNPACK_SEMIRAW (E, 4, X); \
+ } \
+ while (0)
+
+# define FP_PACK_E(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (E, 4, X); \
+ FP_PACK_RAW_E (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_EP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (E, 4, X); \
+ FP_PACK_RAW_EP (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_E(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (E, 4, X); \
+ FP_PACK_RAW_E (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_EP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (E, 4, X); \
+ FP_PACK_RAW_EP (val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_E(X) _FP_ISSIGNAN (E, 4, X)
+# define FP_NEG_E(R, X) _FP_NEG (E, 4, R, X)
+# define FP_ADD_E(R, X, Y) _FP_ADD (E, 4, R, X, Y)
+# define FP_SUB_E(R, X, Y) _FP_SUB (E, 4, R, X, Y)
+# define FP_MUL_E(R, X, Y) _FP_MUL (E, 4, R, X, Y)
+# define FP_DIV_E(R, X, Y) _FP_DIV (E, 4, R, X, Y)
+# define FP_SQRT_E(R, X) _FP_SQRT (E, 4, R, X)
+# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 4, 8, R, X, Y, Z)
/*
* Square root algorithms:
@@ -212,188 +241,218 @@ union _FP_UNION_E
* in two UWtype registers instead of four.
*/
-#define _FP_SQRT_MEAT_E(R, S, T, X, q) \
- do { \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- _FP_FRAC_SRL_4(X, (_FP_WORKBITS)); \
- while (q) \
- { \
- T##_f[1] = S##_f[1] + q; \
- if (T##_f[1] <= X##_f[1]) \
- { \
- S##_f[1] = T##_f[1] + q; \
- X##_f[1] -= T##_f[1]; \
- R##_f[1] += q; \
- } \
- _FP_FRAC_SLL_2(X, 1); \
- q >>= 1; \
- } \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- while (q) \
- { \
- T##_f[0] = S##_f[0] + q; \
- T##_f[1] = S##_f[1]; \
- if (T##_f[1] < X##_f[1] || \
- (T##_f[1] == X##_f[1] && \
- T##_f[0] <= X##_f[0])) \
- { \
- S##_f[0] = T##_f[0] + q; \
- S##_f[1] += (T##_f[0] > S##_f[0]); \
- _FP_FRAC_DEC_2(X, T); \
- R##_f[0] += q; \
- } \
- _FP_FRAC_SLL_2(X, 1); \
- q >>= 1; \
- } \
- _FP_FRAC_SLL_4(R, (_FP_WORKBITS)); \
- if (X##_f[0] | X##_f[1]) \
- { \
- if (S##_f[1] < X##_f[1] || \
- (S##_f[1] == X##_f[1] && \
- S##_f[0] < X##_f[0])) \
- R##_f[0] |= _FP_WORK_ROUND; \
- R##_f[0] |= _FP_WORK_STICKY; \
- } \
- } while (0)
-
-#define FP_CMP_E(r,X,Y,un) _FP_CMP(E,4,r,X,Y,un)
-#define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,4,r,X,Y)
-#define FP_CMP_UNORD_E(r,X,Y) _FP_CMP_UNORD(E,4,r,X,Y)
-
-#define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,4,r,X,rsz,rsg)
-#define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,4,X,r,rs,rt)
-
-#define _FP_FRAC_HIGH_E(X) (X##_f[2])
-#define _FP_FRAC_HIGH_RAW_E(X) (X##_f[1])
-
-#define _FP_FRAC_HIGH_DW_E(X) (X##_f[4])
+# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
+ do \
+ { \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_4 (X, (_FP_WORKBITS)); \
+ while (q) \
+ { \
+ T##_f[1] = S##_f[1] + q; \
+ if (T##_f[1] <= X##_f[1]) \
+ { \
+ S##_f[1] = T##_f[1] + q; \
+ X##_f[1] -= T##_f[1]; \
+ R##_f[1] += q; \
+ } \
+ _FP_FRAC_SLL_2 (X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[0] = S##_f[0] + q; \
+ T##_f[1] = S##_f[1]; \
+ if (T##_f[1] < X##_f[1] \
+ || (T##_f[1] == X##_f[1] \
+ && T##_f[0] <= X##_f[0])) \
+ { \
+ S##_f[0] = T##_f[0] + q; \
+ S##_f[1] += (T##_f[0] > S##_f[0]); \
+ _FP_FRAC_DEC_2 (X, T); \
+ R##_f[0] += q; \
+ } \
+ _FP_FRAC_SLL_2 (X, 1); \
+ q >>= 1; \
+ } \
+ _FP_FRAC_SLL_4 (R, (_FP_WORKBITS)); \
+ if (X##_f[0] | X##_f[1]) \
+ { \
+ if (S##_f[1] < X##_f[1] \
+ || (S##_f[1] == X##_f[1] \
+ && S##_f[0] < X##_f[0])) \
+ R##_f[0] |= _FP_WORK_ROUND; \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
+
+# define FP_CMP_E(r, X, Y, un) _FP_CMP (E, 4, r, X, Y, un)
+# define FP_CMP_EQ_E(r, X, Y) _FP_CMP_EQ (E, 4, r, X, Y)
+# define FP_CMP_UNORD_E(r, X, Y) _FP_CMP_UNORD (E, 4, r, X, Y)
+
+# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 4, r, X, rsz, rsg)
+# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 4, X, r, rs, rt)
+
+# define _FP_FRAC_HIGH_E(X) (X##_f[2])
+# define _FP_FRAC_HIGH_RAW_E(X) (X##_f[1])
+
+# define _FP_FRAC_HIGH_DW_E(X) (X##_f[4])
#else /* not _FP_W_TYPE_SIZE < 64 */
union _FP_UNION_E
{
XFtype flt;
- struct _FP_STRUCT_LAYOUT {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
_FP_W_TYPE pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_E;
_FP_W_TYPE frac : _FP_W_TYPE_SIZE;
-#else
+# else
_FP_W_TYPE frac : _FP_W_TYPE_SIZE;
unsigned exp : _FP_EXPBITS_E;
unsigned sign : 1;
-#endif
+# endif
} bits;
};
-#define FP_DECL_E(X) _FP_DECL(2,X)
-
-#define FP_UNPACK_RAW_E(X, val) \
- do { \
- union _FP_UNION_E _flo; _flo.flt = (val); \
- \
- X##_f0 = _flo.bits.frac; \
- X##_f1 = 0; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } while (0)
-
-#define FP_UNPACK_RAW_EP(X, val) \
- do { \
- union _FP_UNION_E *_flo = \
- (union _FP_UNION_E *)(val); \
- \
- X##_f0 = _flo->bits.frac; \
- X##_f1 = 0; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } while (0)
-
-#define FP_PACK_RAW_E(val, X) \
- do { \
- union _FP_UNION_E _flo; \
- \
- if (X##_e) X##_f0 |= _FP_IMPLBIT_E; \
- else X##_f0 &= ~(_FP_IMPLBIT_E); \
- _flo.bits.frac = X##_f0; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
- \
- (val) = _flo.flt; \
- } while (0)
-
-#define FP_PACK_RAW_EP(fs, val, X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- { \
- union _FP_UNION_E *_flo = \
- (union _FP_UNION_E *)(val); \
+# define FP_DECL_E(X) _FP_DECL (2, X)
+
+# define FP_UNPACK_RAW_E(X, val) \
+ do \
+ { \
+ union _FP_UNION_E _flo; \
+ _flo.flt = (val); \
+ \
+ X##_f0 = _flo.bits.frac; \
+ X##_f1 = 0; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } \
+ while (0)
+
+# define FP_UNPACK_RAW_EP(X, val) \
+ do \
+ { \
+ union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
\
- if (X##_e) X##_f0 |= _FP_IMPLBIT_E; \
- else X##_f0 &= ~(_FP_IMPLBIT_E); \
- _flo->bits.frac = X##_f0; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } \
- } while (0)
-
-
-#define FP_UNPACK_E(X,val) \
- do { \
- FP_UNPACK_RAW_E(X,val); \
- _FP_UNPACK_CANONICAL(E,2,X); \
- } while (0)
-
-#define FP_UNPACK_EP(X,val) \
- do { \
- FP_UNPACK_RAW_EP(X,val); \
- _FP_UNPACK_CANONICAL(E,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_E(X,val) \
- do { \
- FP_UNPACK_RAW_E(X,val); \
- _FP_UNPACK_SEMIRAW(E,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_EP(X,val) \
- do { \
- FP_UNPACK_RAW_EP(X,val); \
- _FP_UNPACK_SEMIRAW(E,2,X); \
- } while (0)
-
-#define FP_PACK_E(val,X) \
- do { \
- _FP_PACK_CANONICAL(E,2,X); \
- FP_PACK_RAW_E(val,X); \
- } while (0)
-
-#define FP_PACK_EP(val,X) \
- do { \
- _FP_PACK_CANONICAL(E,2,X); \
- FP_PACK_RAW_EP(val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_E(val,X) \
- do { \
- _FP_PACK_SEMIRAW(E,2,X); \
- FP_PACK_RAW_E(val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_EP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(E,2,X); \
- FP_PACK_RAW_EP(val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,2,X)
-#define FP_NEG_E(R,X) _FP_NEG(E,2,R,X)
-#define FP_ADD_E(R,X,Y) _FP_ADD(E,2,R,X,Y)
-#define FP_SUB_E(R,X,Y) _FP_SUB(E,2,R,X,Y)
-#define FP_MUL_E(R,X,Y) _FP_MUL(E,2,R,X,Y)
-#define FP_DIV_E(R,X,Y) _FP_DIV(E,2,R,X,Y)
-#define FP_SQRT_E(R,X) _FP_SQRT(E,2,R,X)
-#define FP_FMA_E(R,X,Y,Z) _FP_FMA(E,2,4,R,X,Y,Z)
+ X##_f0 = _flo->bits.frac; \
+ X##_f1 = 0; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } \
+ while (0)
+
+# define FP_PACK_RAW_E(val, X) \
+ do \
+ { \
+ union _FP_UNION_E _flo; \
+ \
+ if (X##_e) \
+ X##_f0 |= _FP_IMPLBIT_E; \
+ else \
+ X##_f0 &= ~(_FP_IMPLBIT_E); \
+ _flo.bits.frac = X##_f0; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } \
+ while (0)
+
+# define FP_PACK_RAW_EP(fs, val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
+ \
+ if (X##_e) \
+ X##_f0 |= _FP_IMPLBIT_E; \
+ else \
+ X##_f0 &= ~(_FP_IMPLBIT_E); \
+ _flo->bits.frac = X##_f0; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ } \
+ while (0)
+
+
+# define FP_UNPACK_E(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_E (X, val); \
+ _FP_UNPACK_CANONICAL (E, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_EP(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_EP (X, val); \
+ _FP_UNPACK_CANONICAL (E, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_E(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_E (X, val); \
+ _FP_UNPACK_SEMIRAW (E, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_EP(X, val) \
+ do \
+ { \
+ FP_UNPACK_RAW_EP (X, val); \
+ _FP_UNPACK_SEMIRAW (E, 2, X); \
+ } \
+ while (0)
+
+# define FP_PACK_E(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (E, 2, X); \
+ FP_PACK_RAW_E (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_EP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (E, 2, X); \
+ FP_PACK_RAW_EP (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_E(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (E, 2, X); \
+ FP_PACK_RAW_E (val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_EP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (E, 2, X); \
+ FP_PACK_RAW_EP (val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_E(X) _FP_ISSIGNAN (E, 2, X)
+# define FP_NEG_E(R, X) _FP_NEG (E, 2, R, X)
+# define FP_ADD_E(R, X, Y) _FP_ADD (E, 2, R, X, Y)
+# define FP_SUB_E(R, X, Y) _FP_SUB (E, 2, R, X, Y)
+# define FP_MUL_E(R, X, Y) _FP_MUL (E, 2, R, X, Y)
+# define FP_DIV_E(R, X, Y) _FP_DIV (E, 2, R, X, Y)
+# define FP_SQRT_E(R, X) _FP_SQRT (E, 2, R, X)
+# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 2, 4, R, X, Y, Z)
/*
* Square root algorithms:
@@ -403,41 +462,43 @@ union _FP_UNION_E
* in one UWtype registers instead of two, although we don't
* have to.
*/
-#define _FP_SQRT_MEAT_E(R, S, T, X, q) \
- do { \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- _FP_FRAC_SRL_2(X, (_FP_WORKBITS)); \
- while (q) \
- { \
- T##_f0 = S##_f0 + q; \
- if (T##_f0 <= X##_f0) \
- { \
- S##_f0 = T##_f0 + q; \
- X##_f0 -= T##_f0; \
- R##_f0 += q; \
- } \
- _FP_FRAC_SLL_1(X, 1); \
- q >>= 1; \
- } \
- _FP_FRAC_SLL_2(R, (_FP_WORKBITS)); \
- if (X##_f0) \
- { \
- if (S##_f0 < X##_f0) \
- R##_f0 |= _FP_WORK_ROUND; \
- R##_f0 |= _FP_WORK_STICKY; \
- } \
- } while (0)
-
-#define FP_CMP_E(r,X,Y,un) _FP_CMP(E,2,r,X,Y,un)
-#define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,2,r,X,Y)
-#define FP_CMP_UNORD_E(r,X,Y) _FP_CMP_UNORD(E,2,r,X,Y)
-
-#define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,2,r,X,rsz,rsg)
-#define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,2,X,r,rs,rt)
-
-#define _FP_FRAC_HIGH_E(X) (X##_f1)
-#define _FP_FRAC_HIGH_RAW_E(X) (X##_f0)
-
-#define _FP_FRAC_HIGH_DW_E(X) (X##_f[2])
+# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
+ do \
+ { \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_2 (X, (_FP_WORKBITS)); \
+ while (q) \
+ { \
+ T##_f0 = S##_f0 + q; \
+ if (T##_f0 <= X##_f0) \
+ { \
+ S##_f0 = T##_f0 + q; \
+ X##_f0 -= T##_f0; \
+ R##_f0 += q; \
+ } \
+ _FP_FRAC_SLL_1 (X, 1); \
+ q >>= 1; \
+ } \
+ _FP_FRAC_SLL_2 (R, (_FP_WORKBITS)); \
+ if (X##_f0) \
+ { \
+ if (S##_f0 < X##_f0) \
+ R##_f0 |= _FP_WORK_ROUND; \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
+
+# define FP_CMP_E(r, X, Y, un) _FP_CMP (E, 2, r, X, Y, un)
+# define FP_CMP_EQ_E(r, X, Y) _FP_CMP_EQ (E, 2, r, X, Y)
+# define FP_CMP_UNORD_E(r, X, Y) _FP_CMP_UNORD (E, 2, r, X, Y)
+
+# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 2, r, X, rsz, rsg)
+# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 2, X, r, rs, rt)
+
+# define _FP_FRAC_HIGH_E(X) (X##_f1)
+# define _FP_FRAC_HIGH_RAW_E(X) (X##_f0)
+
+# define _FP_FRAC_HIGH_DW_E(X) (X##_f[2])
#endif /* not _FP_W_TYPE_SIZE < 64 */
diff --git a/libc/soft-fp/extendsfdf2.c b/libc/soft-fp/extendsfdf2.c
index 7fc4046f8..2276de527 100644
--- a/libc/soft-fp/extendsfdf2.c
+++ b/libc/soft-fp/extendsfdf2.c
@@ -32,21 +32,22 @@
#include "single.h"
#include "double.h"
-DFtype __extendsfdf2(SFtype a)
+DFtype
+__extendsfdf2 (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
- FP_DECL_D(R);
+ FP_DECL_S (A);
+ FP_DECL_D (R);
DFtype r;
- FP_INIT_ROUNDMODE;
- FP_UNPACK_RAW_S(A, a);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
- FP_EXTEND(D,S,2,1,R,A);
+ FP_EXTEND (D, S, 2, 1, R, A);
#else
- FP_EXTEND(D,S,1,1,R,A);
+ FP_EXTEND (D, S, 1, 1, R, A);
#endif
- FP_PACK_RAW_D(r, R);
+ FP_PACK_RAW_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/extendsftf2.c b/libc/soft-fp/extendsftf2.c
index 8271a8846..51f60c456 100644
--- a/libc/soft-fp/extendsftf2.c
+++ b/libc/soft-fp/extendsftf2.c
@@ -32,21 +32,22 @@
#include "single.h"
#include "quad.h"
-TFtype __extendsftf2(SFtype a)
+TFtype
+__extendsftf2 (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
- FP_DECL_Q(R);
+ FP_DECL_S (A);
+ FP_DECL_Q (R);
TFtype r;
- FP_INIT_ROUNDMODE;
- FP_UNPACK_RAW_S(A, a);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
- FP_EXTEND(Q,S,4,1,R,A);
+ FP_EXTEND (Q, S, 4, 1, R, A);
#else
- FP_EXTEND(Q,S,2,1,R,A);
+ FP_EXTEND (Q, S, 2, 1, R, A);
#endif
- FP_PACK_RAW_Q(r, R);
+ FP_PACK_RAW_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/extendxftf2.c b/libc/soft-fp/extendxftf2.c
new file mode 100644
index 000000000..684052d87
--- /dev/null
+++ b/libc/soft-fp/extendxftf2.c
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+ Return a converted to IEEE quad
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "extended.h"
+#include "quad.h"
+
+TFtype
+__extendxftf2 (XFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_E (A);
+ FP_DECL_Q (R);
+ TFtype r;
+
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_RAW_E (A, a);
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+ FP_EXTEND (Q, E, 4, 4, R, A);
+#else
+ FP_EXTEND (Q, E, 2, 2, R, A);
+#endif
+ FP_PACK_RAW_Q (r, R);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixdfdi.c b/libc/soft-fp/fixdfdi.c
index 71ce1d4d7..7b926b3d6 100644
--- a/libc/soft-fp/fixdfdi.c
+++ b/libc/soft-fp/fixdfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-DItype __fixdfdi(DFtype a)
+DItype
+__fixdfdi (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
UDItype r;
- FP_UNPACK_RAW_D(A, a);
- FP_TO_INT_D(r, A, DI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, DI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixdfsi.c b/libc/soft-fp/fixdfsi.c
index f0c996064..79b2d2150 100644
--- a/libc/soft-fp/fixdfsi.c
+++ b/libc/soft-fp/fixdfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-SItype __fixdfsi(DFtype a)
+SItype
+__fixdfsi (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
USItype r;
- FP_UNPACK_RAW_D(A, a);
- FP_TO_INT_D(r, A, SI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, SI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixdfti.c b/libc/soft-fp/fixdfti.c
new file mode 100644
index 000000000..b5fe4f99f
--- /dev/null
+++ b/libc/soft-fp/fixdfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE double to 128bit signed integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "double.h"
+
+TItype
+__fixdfti (DFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, TI_BITS, 1);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixsfdi.c b/libc/soft-fp/fixsfdi.c
index 5f69d6a28..df6b9c728 100644
--- a/libc/soft-fp/fixsfdi.c
+++ b/libc/soft-fp/fixsfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-DItype __fixsfdi(SFtype a)
+DItype
+__fixsfdi (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
UDItype r;
- FP_UNPACK_RAW_S(A, a);
- FP_TO_INT_S(r, A, DI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, DI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixsfsi.c b/libc/soft-fp/fixsfsi.c
index 6fffdd737..4c0bfd39d 100644
--- a/libc/soft-fp/fixsfsi.c
+++ b/libc/soft-fp/fixsfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SItype __fixsfsi(SFtype a)
+SItype
+__fixsfsi (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
USItype r;
- FP_UNPACK_RAW_S(A, a);
- FP_TO_INT_S(r, A, SI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, SI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixsfti.c b/libc/soft-fp/fixsfti.c
new file mode 100644
index 000000000..6b5229fe9
--- /dev/null
+++ b/libc/soft-fp/fixsfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE single to 128bit signed integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "single.h"
+
+TItype
+__fixsfti (SFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_S (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, TI_BITS, 1);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixtfdi.c b/libc/soft-fp/fixtfdi.c
index ac67bfbd3..a65173aa7 100644
--- a/libc/soft-fp/fixtfdi.c
+++ b/libc/soft-fp/fixtfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "quad.h"
-DItype __fixtfdi(TFtype a)
+DItype
+__fixtfdi (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
UDItype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_TO_INT_Q(r, A, DI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, DI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixtfsi.c b/libc/soft-fp/fixtfsi.c
index 8f27ff66f..bc0ea0b87 100644
--- a/libc/soft-fp/fixtfsi.c
+++ b/libc/soft-fp/fixtfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "quad.h"
-SItype __fixtfsi(TFtype a)
+SItype
+__fixtfsi (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
USItype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_TO_INT_Q(r, A, SI_BITS, 1);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, SI_BITS, 1);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixtfti.c b/libc/soft-fp/fixtfti.c
new file mode 100644
index 000000000..573ca0ed1
--- /dev/null
+++ b/libc/soft-fp/fixtfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE quad to 128bit signed integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TItype
+__fixtfti (TFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, TI_BITS, 1);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixunsdfdi.c b/libc/soft-fp/fixunsdfdi.c
index 82fe1c753..8831cc3d1 100644
--- a/libc/soft-fp/fixunsdfdi.c
+++ b/libc/soft-fp/fixunsdfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-UDItype __fixunsdfdi(DFtype a)
+UDItype
+__fixunsdfdi (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
UDItype r;
- FP_UNPACK_RAW_D(A, a);
- FP_TO_INT_D(r, A, DI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, DI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunsdfsi.c b/libc/soft-fp/fixunsdfsi.c
index 43287b007..ff3744467 100644
--- a/libc/soft-fp/fixunsdfsi.c
+++ b/libc/soft-fp/fixunsdfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-USItype __fixunsdfsi(DFtype a)
+USItype
+__fixunsdfsi (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
USItype r;
- FP_UNPACK_RAW_D(A, a);
- FP_TO_INT_D(r, A, SI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, SI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunsdfti.c b/libc/soft-fp/fixunsdfti.c
new file mode 100644
index 000000000..f124a7c6a
--- /dev/null
+++ b/libc/soft-fp/fixunsdfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE double to 128bit unsigned integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "double.h"
+
+UTItype
+__fixunsdfti (DFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_TO_INT_D (r, A, TI_BITS, 0);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixunssfdi.c b/libc/soft-fp/fixunssfdi.c
index c0691c663..4261c5e6a 100644
--- a/libc/soft-fp/fixunssfdi.c
+++ b/libc/soft-fp/fixunssfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-UDItype __fixunssfdi(SFtype a)
+UDItype
+__fixunssfdi (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
UDItype r;
- FP_UNPACK_RAW_S(A, a);
- FP_TO_INT_S(r, A, DI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, DI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunssfsi.c b/libc/soft-fp/fixunssfsi.c
index 3d00ce8d5..b4bb89029 100644
--- a/libc/soft-fp/fixunssfsi.c
+++ b/libc/soft-fp/fixunssfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-USItype __fixunssfsi(SFtype a)
+USItype
+__fixunssfsi (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
USItype r;
- FP_UNPACK_RAW_S(A, a);
- FP_TO_INT_S(r, A, SI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, SI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunssfti.c b/libc/soft-fp/fixunssfti.c
new file mode 100644
index 000000000..36d01b0cf
--- /dev/null
+++ b/libc/soft-fp/fixunssfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE single to 128bit unsigned integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "single.h"
+
+UTItype
+__fixunssfti (SFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_S (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_TO_INT_S (r, A, TI_BITS, 0);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/fixunstfdi.c b/libc/soft-fp/fixunstfdi.c
index d6038fa89..b2355a2ae 100644
--- a/libc/soft-fp/fixunstfdi.c
+++ b/libc/soft-fp/fixunstfdi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "quad.h"
-UDItype __fixunstfdi(TFtype a)
+UDItype
+__fixunstfdi (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
UDItype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_TO_INT_Q(r, A, DI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, DI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunstfsi.c b/libc/soft-fp/fixunstfsi.c
index c8481f1ca..efa1418da 100644
--- a/libc/soft-fp/fixunstfsi.c
+++ b/libc/soft-fp/fixunstfsi.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "quad.h"
-USItype __fixunstfsi(TFtype a)
+USItype
+__fixunstfsi (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
USItype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_TO_INT_Q(r, A, SI_BITS, 0);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, SI_BITS, 0);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fixunstfti.c b/libc/soft-fp/fixunstfti.c
new file mode 100644
index 000000000..efe0cf5c5
--- /dev/null
+++ b/libc/soft-fp/fixunstfti.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert IEEE quad to 128bit unsigned integer
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+UTItype
+__fixunstfti (TFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ UTItype r;
+
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_TO_INT_Q (r, A, TI_BITS, 0);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/floatdidf.c b/libc/soft-fp/floatdidf.c
index f6f594a84..fc8719abd 100644
--- a/libc/soft-fp/floatdidf.c
+++ b/libc/soft-fp/floatdidf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __floatdidf(DItype i)
+DFtype
+__floatdidf (DItype i)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
DFtype a;
- FP_FROM_INT_D(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_D(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_D (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_D (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatdisf.c b/libc/soft-fp/floatdisf.c
index 72252e4a9..b6b6b4252 100644
--- a/libc/soft-fp/floatdisf.c
+++ b/libc/soft-fp/floatdisf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __floatdisf(DItype i)
+SFtype
+__floatdisf (DItype i)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
SFtype a;
- FP_FROM_INT_S(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_S(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_S (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatditf.c b/libc/soft-fp/floatditf.c
index 68da6c60b..fc3fba361 100644
--- a/libc/soft-fp/floatditf.c
+++ b/libc/soft-fp/floatditf.c
@@ -28,18 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
-TFtype __floatditf(DItype i)
+TFtype
+__floatditf (DItype i)
{
- FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
TFtype a;
- FP_FROM_INT_Q(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_Q (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_Q (a, A);
return a;
}
diff --git a/libc/soft-fp/floatsidf.c b/libc/soft-fp/floatsidf.c
index ec578fba7..7df5265ff 100644
--- a/libc/soft-fp/floatsidf.c
+++ b/libc/soft-fp/floatsidf.c
@@ -28,18 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "double.h"
-DFtype __floatsidf(SItype i)
+DFtype
+__floatsidf (SItype i)
{
- FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
DFtype a;
- FP_FROM_INT_D(A, i, SI_BITS, USItype);
- FP_PACK_RAW_D(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_D (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_D (a, A);
return a;
}
diff --git a/libc/soft-fp/floatsisf.c b/libc/soft-fp/floatsisf.c
index c9ff205d7..b55fd3329 100644
--- a/libc/soft-fp/floatsisf.c
+++ b/libc/soft-fp/floatsisf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __floatsisf(SItype i)
+SFtype
+__floatsisf (SItype i)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
SFtype a;
- FP_FROM_INT_S(A, i, SI_BITS, USItype);
- FP_PACK_RAW_S(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_S (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatsitf.c b/libc/soft-fp/floatsitf.c
index 6e24b9ea6..d7c3078e4 100644
--- a/libc/soft-fp/floatsitf.c
+++ b/libc/soft-fp/floatsitf.c
@@ -28,18 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
-TFtype __floatsitf(SItype i)
+TFtype
+__floatsitf (SItype i)
{
- FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
TFtype a;
- FP_FROM_INT_Q(A, i, SI_BITS, USItype);
- FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_Q (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_Q (a, A);
return a;
}
diff --git a/libc/soft-fp/floattidf.c b/libc/soft-fp/floattidf.c
new file mode 100644
index 000000000..a28181b23
--- /dev/null
+++ b/libc/soft-fp/floattidf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit signed integer to IEEE double
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "double.h"
+
+DFtype
+__floattidf (TItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ DFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_D (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_D (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/floattisf.c b/libc/soft-fp/floattisf.c
new file mode 100644
index 000000000..da8104794
--- /dev/null
+++ b/libc/soft-fp/floattisf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit signed integer to IEEE single
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "single.h"
+
+SFtype
+__floattisf (TItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_S (A);
+ SFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_S (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/floattitf.c b/libc/soft-fp/floattitf.c
new file mode 100644
index 000000000..ffe217a62
--- /dev/null
+++ b/libc/soft-fp/floattitf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit signed integer to IEEE quad
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TFtype
+__floattitf (TItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ TFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_Q (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_Q (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/floatundidf.c b/libc/soft-fp/floatundidf.c
index 1babcec8e..8a041f827 100644
--- a/libc/soft-fp/floatundidf.c
+++ b/libc/soft-fp/floatundidf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __floatundidf(UDItype i)
+DFtype
+__floatundidf (UDItype i)
{
FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
DFtype a;
- FP_FROM_INT_D(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_D(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_D (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_D (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatundisf.c b/libc/soft-fp/floatundisf.c
index 1c645c023..8dc750851 100644
--- a/libc/soft-fp/floatundisf.c
+++ b/libc/soft-fp/floatundisf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __floatundisf(UDItype i)
+SFtype
+__floatundisf (UDItype i)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
SFtype a;
- FP_FROM_INT_S(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_S(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_S (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatunditf.c b/libc/soft-fp/floatunditf.c
index fff73fdb6..cc8a3fe06 100644
--- a/libc/soft-fp/floatunditf.c
+++ b/libc/soft-fp/floatunditf.c
@@ -28,19 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype
-__floatunditf(UDItype i)
+__floatunditf (UDItype i)
{
- FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
TFtype a;
- FP_FROM_INT_Q(A, i, DI_BITS, UDItype);
- FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_Q (A, i, DI_BITS, UDItype);
+ FP_PACK_RAW_Q (a, A);
return a;
}
diff --git a/libc/soft-fp/floatunsidf.c b/libc/soft-fp/floatunsidf.c
index 548dc7c0c..059029640 100644
--- a/libc/soft-fp/floatunsidf.c
+++ b/libc/soft-fp/floatunsidf.c
@@ -28,18 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "double.h"
-DFtype __floatunsidf(USItype i)
+DFtype
+__floatunsidf (USItype i)
{
- FP_DECL_EX;
- FP_DECL_D(A);
+ FP_DECL_D (A);
DFtype a;
- FP_FROM_INT_D(A, i, SI_BITS, USItype);
- FP_PACK_RAW_D(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_D (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_D (a, A);
return a;
}
diff --git a/libc/soft-fp/floatunsisf.c b/libc/soft-fp/floatunsisf.c
index 2c0cc8976..91c1e4d1a 100644
--- a/libc/soft-fp/floatunsisf.c
+++ b/libc/soft-fp/floatunsisf.c
@@ -31,14 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __floatunsisf(USItype i)
+SFtype
+__floatunsisf (USItype i)
{
FP_DECL_EX;
- FP_DECL_S(A);
+ FP_DECL_S (A);
SFtype a;
- FP_FROM_INT_S(A, i, SI_BITS, USItype);
- FP_PACK_RAW_S(a, A);
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_S (a, A);
FP_HANDLE_EXCEPTIONS;
return a;
diff --git a/libc/soft-fp/floatunsitf.c b/libc/soft-fp/floatunsitf.c
index 1099c2ee8..b1eecfd7c 100644
--- a/libc/soft-fp/floatunsitf.c
+++ b/libc/soft-fp/floatunsitf.c
@@ -28,19 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype
-__floatunsitf(USItype i)
+__floatunsitf (USItype i)
{
- FP_DECL_EX;
- FP_DECL_Q(A);
+ FP_DECL_Q (A);
TFtype a;
- FP_FROM_INT_Q(A, i, SI_BITS, USItype);
- FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
+ FP_FROM_INT_Q (A, i, SI_BITS, USItype);
+ FP_PACK_RAW_Q (a, A);
return a;
}
diff --git a/libc/soft-fp/floatuntidf.c b/libc/soft-fp/floatuntidf.c
new file mode 100644
index 000000000..6a8981dae
--- /dev/null
+++ b/libc/soft-fp/floatuntidf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit unsigned integer to IEEE double
+ Copyright (C) 1997-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "double.h"
+
+DFtype
+__floatuntidf (UTItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ DFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_D (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_D (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/floatuntisf.c b/libc/soft-fp/floatuntisf.c
new file mode 100644
index 000000000..94d0593f2
--- /dev/null
+++ b/libc/soft-fp/floatuntisf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit unsigned integer to IEEE single
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "single.h"
+
+SFtype
+__floatuntisf (UTItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_S (A);
+ SFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_S (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_S (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/floatuntitf.c b/libc/soft-fp/floatuntitf.c
new file mode 100644
index 000000000..424bfef8f
--- /dev/null
+++ b/libc/soft-fp/floatuntitf.c
@@ -0,0 +1,46 @@
+/* Software floating-point emulation.
+ Convert a 128bit unsigned integer to IEEE quad
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TFtype
+__floatuntitf (UTItype i)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ TFtype a;
+
+ FP_INIT_ROUNDMODE;
+ FP_FROM_INT_Q (A, i, TI_BITS, UTItype);
+ FP_PACK_RAW_Q (a, A);
+ FP_HANDLE_EXCEPTIONS;
+
+ return a;
+}
diff --git a/libc/soft-fp/fmadf4.c b/libc/soft-fp/fmadf4.c
index ebdc2b1d2..709c47bb4 100644
--- a/libc/soft-fp/fmadf4.c
+++ b/libc/soft-fp/fmadf4.c
@@ -33,15 +33,18 @@ double
__fma (double a, double b, double c)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(C); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
+ FP_DECL_D (C);
+ FP_DECL_D (R);
double r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_D(A, a);
- FP_UNPACK_D(B, b);
- FP_UNPACK_D(C, c);
- FP_FMA_D(R, A, B, C);
- FP_PACK_D(r, R);
+ FP_UNPACK_D (A, a);
+ FP_UNPACK_D (B, b);
+ FP_UNPACK_D (C, c);
+ FP_FMA_D (R, A, B, C);
+ FP_PACK_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fmasf4.c b/libc/soft-fp/fmasf4.c
index e8d60fb19..6af370142 100644
--- a/libc/soft-fp/fmasf4.c
+++ b/libc/soft-fp/fmasf4.c
@@ -33,15 +33,18 @@ float
__fmaf (float a, float b, float c)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(C); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
+ FP_DECL_S (C);
+ FP_DECL_S (R);
float r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_S(A, a);
- FP_UNPACK_S(B, b);
- FP_UNPACK_S(C, c);
- FP_FMA_S(R, A, B, C);
- FP_PACK_S(r, R);
+ FP_UNPACK_S (A, a);
+ FP_UNPACK_S (B, b);
+ FP_UNPACK_S (C, c);
+ FP_FMA_S (R, A, B, C);
+ FP_PACK_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/fmatf4.c b/libc/soft-fp/fmatf4.c
index cf489881d..1427b2542 100644
--- a/libc/soft-fp/fmatf4.c
+++ b/libc/soft-fp/fmatf4.c
@@ -33,15 +33,18 @@ long double
__fmal (long double a, long double b, long double c)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (C);
+ FP_DECL_Q (R);
long double r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_Q(A, a);
- FP_UNPACK_Q(B, b);
- FP_UNPACK_Q(C, c);
- FP_FMA_Q(R, A, B, C);
- FP_PACK_Q(r, R);
+ FP_UNPACK_Q (A, a);
+ FP_UNPACK_Q (B, b);
+ FP_UNPACK_Q (C, c);
+ FP_FMA_Q (R, A, B, C);
+ FP_PACK_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/gedf2.c b/libc/soft-fp/gedf2.c
index 0ef9f5de2..5b6fad284 100644
--- a/libc/soft-fp/gedf2.c
+++ b/libc/soft-fp/gedf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "double.h"
-CMPtype __gedf2(DFtype a, DFtype b)
+CMPtype
+__gedf2 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
CMPtype r;
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_UNPACK_RAW_D (B, b);
+ FP_CMP_D (r, A, B, -2);
+ if (r == -2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__gedf2, __gtdf2);
+strong_alias (__gedf2, __gtdf2);
diff --git a/libc/soft-fp/gesf2.c b/libc/soft-fp/gesf2.c
index f0a837731..4e5d9393f 100644
--- a/libc/soft-fp/gesf2.c
+++ b/libc/soft-fp/gesf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "single.h"
-CMPtype __gesf2(SFtype a, SFtype b)
+CMPtype
+__gesf2 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
CMPtype r;
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_UNPACK_RAW_S (B, b);
+ FP_CMP_S (r, A, B, -2);
+ if (r == -2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__gesf2, __gtsf2);
+strong_alias (__gesf2, __gtsf2);
diff --git a/libc/soft-fp/getf2.c b/libc/soft-fp/getf2.c
index 705d48b90..ed02f459e 100644
--- a/libc/soft-fp/getf2.c
+++ b/libc/soft-fp/getf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "quad.h"
-CMPtype __getf2(TFtype a, TFtype b)
+CMPtype
+__getf2 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
CMPtype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_UNPACK_RAW_Q(B, b);
- FP_CMP_Q(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_UNPACK_RAW_Q (B, b);
+ FP_CMP_Q (r, A, B, -2);
+ if (r == -2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__getf2, __gttf2);
+strong_alias (__getf2, __gttf2);
diff --git a/libc/soft-fp/ledf2.c b/libc/soft-fp/ledf2.c
index 7b8f403bb..476f1c470 100644
--- a/libc/soft-fp/ledf2.c
+++ b/libc/soft-fp/ledf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "double.h"
-CMPtype __ledf2(DFtype a, DFtype b)
+CMPtype
+__ledf2 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
CMPtype r;
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_UNPACK_RAW_D (B, b);
+ FP_CMP_D (r, A, B, 2);
+ if (r == 2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__ledf2, __ltdf2);
+strong_alias (__ledf2, __ltdf2);
diff --git a/libc/soft-fp/lesf2.c b/libc/soft-fp/lesf2.c
index 41f823b5f..ac2f748a3 100644
--- a/libc/soft-fp/lesf2.c
+++ b/libc/soft-fp/lesf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "single.h"
-CMPtype __lesf2(SFtype a, SFtype b)
+CMPtype
+__lesf2 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
CMPtype r;
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_UNPACK_RAW_S (B, b);
+ FP_CMP_S (r, A, B, 2);
+ if (r == 2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__lesf2, __ltsf2);
+strong_alias (__lesf2, __ltsf2);
diff --git a/libc/soft-fp/letf2.c b/libc/soft-fp/letf2.c
index 59342ca4c..a41055b94 100644
--- a/libc/soft-fp/letf2.c
+++ b/libc/soft-fp/letf2.c
@@ -31,20 +31,23 @@
#include "soft-fp.h"
#include "quad.h"
-CMPtype __letf2(TFtype a, TFtype b)
+CMPtype
+__letf2 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
CMPtype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_UNPACK_RAW_Q(B, b);
- FP_CMP_Q(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_UNPACK_RAW_Q (B, b);
+ FP_CMP_Q (r, A, B, 2);
+ if (r == 2)
+ FP_SET_EXCEPTION (FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
-strong_alias(__letf2, __lttf2);
+strong_alias (__letf2, __lttf2);
diff --git a/libc/soft-fp/muldf3.c b/libc/soft-fp/muldf3.c
index 8c08281b4..dee3f76e5 100644
--- a/libc/soft-fp/muldf3.c
+++ b/libc/soft-fp/muldf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __muldf3(DFtype a, DFtype b)
+DFtype
+__muldf3 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_D(A, a);
- FP_UNPACK_D(B, b);
- FP_MUL_D(R, A, B);
- FP_PACK_D(r, R);
+ FP_UNPACK_D (A, a);
+ FP_UNPACK_D (B, b);
+ FP_MUL_D (R, A, B);
+ FP_PACK_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/mulsf3.c b/libc/soft-fp/mulsf3.c
index f0341a56c..f983b3034 100644
--- a/libc/soft-fp/mulsf3.c
+++ b/libc/soft-fp/mulsf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __mulsf3(SFtype a, SFtype b)
+SFtype
+__mulsf3 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_S(A, a);
- FP_UNPACK_S(B, b);
- FP_MUL_S(R, A, B);
- FP_PACK_S(r, R);
+ FP_UNPACK_S (A, a);
+ FP_UNPACK_S (B, b);
+ FP_MUL_S (R, A, B);
+ FP_PACK_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/multf3.c b/libc/soft-fp/multf3.c
index 35badf2fc..1306c63f8 100644
--- a/libc/soft-fp/multf3.c
+++ b/libc/soft-fp/multf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __multf3(TFtype a, TFtype b)
+TFtype
+__multf3 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (R);
TFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_Q(A, a);
- FP_UNPACK_Q(B, b);
- FP_MUL_Q(R, A, B);
- FP_PACK_Q(r, R);
+ FP_UNPACK_Q (A, a);
+ FP_UNPACK_Q (B, b);
+ FP_MUL_Q (R, A, B);
+ FP_PACK_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/negdf2.c b/libc/soft-fp/negdf2.c
index 3cc6f5f40..d74c16c1e 100644
--- a/libc/soft-fp/negdf2.c
+++ b/libc/soft-fp/negdf2.c
@@ -31,17 +31,16 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __negdf2(DFtype a)
+DFtype
+__negdf2 (DFtype a)
{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (R);
DFtype r;
- FP_UNPACK_D(A, a);
- FP_NEG_D(R, A);
- FP_PACK_D(r, R);
- FP_CLEAR_EXCEPTIONS;
- FP_HANDLE_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_NEG_D (R, A);
+ FP_PACK_RAW_D (r, R);
return r;
}
diff --git a/libc/soft-fp/negsf2.c b/libc/soft-fp/negsf2.c
index d8d591060..0316105a5 100644
--- a/libc/soft-fp/negsf2.c
+++ b/libc/soft-fp/negsf2.c
@@ -31,17 +31,16 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __negsf2(SFtype a)
+SFtype
+__negsf2 (SFtype a)
{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (R);
SFtype r;
- FP_UNPACK_S(A, a);
- FP_NEG_S(R, A);
- FP_PACK_S(r, R);
- FP_CLEAR_EXCEPTIONS;
- FP_HANDLE_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_NEG_S (R, A);
+ FP_PACK_RAW_S (r, R);
return r;
}
diff --git a/libc/soft-fp/negtf2.c b/libc/soft-fp/negtf2.c
index 1c0844148..8540af24d 100644
--- a/libc/soft-fp/negtf2.c
+++ b/libc/soft-fp/negtf2.c
@@ -31,17 +31,16 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __negtf2(TFtype a)
+TFtype
+__negtf2 (TFtype a)
{
- FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (R);
TFtype r;
- FP_UNPACK_Q(A, a);
- FP_NEG_Q(R, A);
- FP_PACK_Q(r, R);
- FP_CLEAR_EXCEPTIONS;
- FP_HANDLE_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_NEG_Q (R, A);
+ FP_PACK_RAW_Q (r, R);
return r;
}
diff --git a/libc/soft-fp/op-1.h b/libc/soft-fp/op-1.h
index a9ad0d62c..8ccb46a79 100644
--- a/libc/soft-fp/op-1.h
+++ b/libc/soft-fp/op-1.h
@@ -31,104 +31,117 @@
<http://www.gnu.org/licenses/>. */
#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f
-#define _FP_FRAC_COPY_1(D,S) (D##_f = S##_f)
-#define _FP_FRAC_SET_1(X,I) (X##_f = I)
+#define _FP_FRAC_COPY_1(D, S) (D##_f = S##_f)
+#define _FP_FRAC_SET_1(X, I) (X##_f = I)
#define _FP_FRAC_HIGH_1(X) (X##_f)
#define _FP_FRAC_LOW_1(X) (X##_f)
-#define _FP_FRAC_WORD_1(X,w) (X##_f)
-
-#define _FP_FRAC_ADDI_1(X,I) (X##_f += I)
-#define _FP_FRAC_SLL_1(X,N) \
- do { \
- if (__builtin_constant_p(N) && (N) == 1) \
- X##_f += X##_f; \
- else \
- X##_f <<= (N); \
- } while (0)
-#define _FP_FRAC_SRL_1(X,N) (X##_f >>= N)
+#define _FP_FRAC_WORD_1(X, w) (X##_f)
+
+#define _FP_FRAC_ADDI_1(X, I) (X##_f += I)
+#define _FP_FRAC_SLL_1(X, N) \
+ do \
+ { \
+ if (__builtin_constant_p (N) && (N) == 1) \
+ X##_f += X##_f; \
+ else \
+ X##_f <<= (N); \
+ } \
+ while (0)
+#define _FP_FRAC_SRL_1(X, N) (X##_f >>= N)
/* Right shift with sticky-lsb. */
-#define _FP_FRAC_SRST_1(X,S,N,sz) __FP_FRAC_SRST_1(X##_f, S, N, sz)
-#define _FP_FRAC_SRS_1(X,N,sz) __FP_FRAC_SRS_1(X##_f, N, sz)
-
-#define __FP_FRAC_SRST_1(X,S,N,sz) \
-do { \
- S = (__builtin_constant_p(N) && (N) == 1 \
- ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0); \
- X = X >> (N); \
-} while (0)
-
-#define __FP_FRAC_SRS_1(X,N,sz) \
- (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1 \
- ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
-
-#define _FP_FRAC_ADD_1(R,X,Y) (R##_f = X##_f + Y##_f)
-#define _FP_FRAC_SUB_1(R,X,Y) (R##_f = X##_f - Y##_f)
-#define _FP_FRAC_DEC_1(X,Y) (X##_f -= Y##_f)
-#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ(z, X##_f)
+#define _FP_FRAC_SRST_1(X, S, N, sz) __FP_FRAC_SRST_1 (X##_f, S, N, sz)
+#define _FP_FRAC_SRS_1(X, N, sz) __FP_FRAC_SRS_1 (X##_f, N, sz)
+
+#define __FP_FRAC_SRST_1(X, S, N, sz) \
+ do \
+ { \
+ S = (__builtin_constant_p (N) && (N) == 1 \
+ ? X & 1 \
+ : (X << (_FP_W_TYPE_SIZE - (N))) != 0); \
+ X = X >> (N); \
+ } \
+ while (0)
+
+#define __FP_FRAC_SRS_1(X, N, sz) \
+ (X = (X >> (N) | (__builtin_constant_p (N) && (N) == 1 \
+ ? X & 1 \
+ : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
+
+#define _FP_FRAC_ADD_1(R, X, Y) (R##_f = X##_f + Y##_f)
+#define _FP_FRAC_SUB_1(R, X, Y) (R##_f = X##_f - Y##_f)
+#define _FP_FRAC_DEC_1(X, Y) (X##_f -= Y##_f)
+#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ (z, X##_f)
/* Predicates */
-#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0)
+#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE) X##_f < 0)
#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
-#define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs)
-#define _FP_FRAC_CLEAR_OVERP_1(fs,X) (X##_f &= ~_FP_OVERFLOW_##fs)
-#define _FP_FRAC_HIGHBIT_DW_1(fs,X) (X##_f & _FP_HIGHBIT_DW_##fs)
+#define _FP_FRAC_OVERP_1(fs, X) (X##_f & _FP_OVERFLOW_##fs)
+#define _FP_FRAC_CLEAR_OVERP_1(fs, X) (X##_f &= ~_FP_OVERFLOW_##fs)
+#define _FP_FRAC_HIGHBIT_DW_1(fs, X) (X##_f & _FP_HIGHBIT_DW_##fs)
#define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f)
#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
#define _FP_ZEROFRAC_1 0
#define _FP_MINFRAC_1 1
-#define _FP_MAXFRAC_1 (~(_FP_WS_TYPE)0)
+#define _FP_MAXFRAC_1 (~(_FP_WS_TYPE) 0)
/*
* Unpack the raw bits of a native fp value. Do not classify or
* normalize the data.
*/
-#define _FP_UNPACK_RAW_1(fs, X, val) \
- do { \
- union _FP_UNION_##fs _flo; _flo.flt = (val); \
- \
- X##_f = _flo.bits.frac; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } while (0)
-
-#define _FP_UNPACK_RAW_1_P(fs, X, val) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- X##_f = _flo->bits.frac; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } while (0)
+#define _FP_UNPACK_RAW_1(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ _flo.flt = (val); \
+ \
+ X##_f = _flo.bits.frac; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } \
+ while (0)
+
+#define _FP_UNPACK_RAW_1_P(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ X##_f = _flo->bits.frac; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } \
+ while (0)
/*
* Repack the raw bits of a native fp value.
*/
-#define _FP_PACK_RAW_1(fs, val, X) \
- do { \
- union _FP_UNION_##fs _flo; \
- \
- _flo.bits.frac = X##_f; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
- \
- (val) = _flo.flt; \
- } while (0)
-
-#define _FP_PACK_RAW_1_P(fs, val, X) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- _flo->bits.frac = X##_f; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } while (0)
+#define _FP_PACK_RAW_1(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ \
+ _flo.bits.frac = X##_f; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } \
+ while (0)
+
+#define _FP_PACK_RAW_1_P(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ _flo->bits.frac = X##_f; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ while (0)
/*
@@ -138,74 +151,86 @@ do { \
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
multiplication immediately. */
-#define _FP_MUL_MEAT_DW_1_imm(wfracbits, R, X, Y) \
- do { \
- R##_f = X##_f * Y##_f; \
- } while (0)
+#define _FP_MUL_MEAT_DW_1_imm(wfracbits, R, X, Y) \
+ do \
+ { \
+ R##_f = X##_f * Y##_f; \
+ } \
+ while (0)
#define _FP_MUL_MEAT_1_imm(wfracbits, R, X, Y) \
- do { \
- _FP_MUL_MEAT_DW_1_imm(wfracbits, R, X, Y); \
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_1(R, wfracbits-1, 2*wfracbits); \
- } while (0)
+ do \
+ { \
+ _FP_MUL_MEAT_DW_1_imm (wfracbits, R, X, Y); \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_1 (R, wfracbits-1, 2*wfracbits); \
+ } \
+ while (0)
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
-#define _FP_MUL_MEAT_DW_1_wide(wfracbits, R, X, Y, doit) \
- do { \
- doit(R##_f1, R##_f0, X##_f, Y##_f); \
- } while (0)
+#define _FP_MUL_MEAT_DW_1_wide(wfracbits, R, X, Y, doit) \
+ do \
+ { \
+ doit (R##_f1, R##_f0, X##_f, Y##_f); \
+ } \
+ while (0)
#define _FP_MUL_MEAT_1_wide(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_2(_Z); \
- _FP_MUL_MEAT_DW_1_wide(wfracbits, _Z, X, Y, doit); \
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_2(_Z, wfracbits-1, 2*wfracbits); \
- R##_f = _Z_f0; \
- } while (0)
+ do \
+ { \
+ _FP_FRAC_DECL_2 (_Z); \
+ _FP_MUL_MEAT_DW_1_wide (wfracbits, _Z, X, Y, doit); \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_2 (_Z, wfracbits-1, 2*wfracbits); \
+ R##_f = _Z_f0; \
+ } \
+ while (0)
/* Finally, a simple widening multiply algorithm. What fun! */
#define _FP_MUL_MEAT_DW_1_hard(wfracbits, R, X, Y) \
- do { \
- _FP_W_TYPE _xh, _xl, _yh, _yl; \
- _FP_FRAC_DECL_2(_a); \
- \
- /* split the words in half */ \
- _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
- _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
- _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
- _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
+ do \
+ { \
+ _FP_W_TYPE _xh, _xl, _yh, _yl; \
+ _FP_FRAC_DECL_2 (_a); \
\
- /* multiply the pieces */ \
- R##_f0 = _xl * _yl; \
- _a_f0 = _xh * _yl; \
- _a_f1 = _xl * _yh; \
- R##_f1 = _xh * _yh; \
+ /* split the words in half */ \
+ _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
+ _xl = X##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
+ _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
+ _yl = Y##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
\
- /* reassemble into two full words */ \
- if ((_a_f0 += _a_f1) < _a_f1) \
- R##_f1 += (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2); \
- _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2); \
- _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2); \
- _FP_FRAC_ADD_2(R, R, _a); \
- } while (0)
-
-#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \
- do { \
- _FP_FRAC_DECL_2(_z); \
- _FP_MUL_MEAT_DW_1_hard(wfracbits, _z, X, Y); \
+ /* multiply the pieces */ \
+ R##_f0 = _xl * _yl; \
+ _a_f0 = _xh * _yl; \
+ _a_f1 = _xl * _yh; \
+ R##_f1 = _xh * _yh; \
\
- /* normalize */ \
- _FP_FRAC_SRS_2(_z, wfracbits - 1, 2*wfracbits); \
- R##_f = _z_f0; \
- } while (0)
+ /* reassemble into two full words */ \
+ if ((_a_f0 += _a_f1) < _a_f1) \
+ R##_f1 += (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2); \
+ _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2); \
+ _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2); \
+ _FP_FRAC_ADD_2 (R, R, _a); \
+ } \
+ while (0)
+
+#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \
+ do \
+ { \
+ _FP_FRAC_DECL_2 (_z); \
+ _FP_MUL_MEAT_DW_1_hard (wfracbits, _z, X, Y); \
+ \
+ /* normalize */ \
+ _FP_FRAC_SRS_2 (_z, wfracbits - 1, 2*wfracbits); \
+ R##_f = _z_f0; \
+ } \
+ while (0)
/*
@@ -217,15 +242,17 @@ do { \
C primitives or _FP_DIV_HELP_ldiv for the ISO function. Which you
choose will depend on what the compiler does with divrem4. */
-#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \
- do { \
- _FP_W_TYPE _q, _r; \
- X##_f <<= (X##_f < Y##_f \
- ? R##_e--, _FP_WFRACBITS_##fs \
- : _FP_WFRACBITS_##fs - 1); \
- doit(_q, _r, X##_f, Y##_f); \
- R##_f = _q | (_r != 0); \
- } while (0)
+#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \
+ do \
+ { \
+ _FP_W_TYPE _q, _r; \
+ X##_f <<= (X##_f < Y##_f \
+ ? R##_e--, _FP_WFRACBITS_##fs \
+ : _FP_WFRACBITS_##fs - 1); \
+ doit (_q, _r, X##_f, Y##_f); \
+ R##_f = _q | (_r != 0); \
+ } \
+ while (0)
/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd
that may be useful in this situation. This first is for a primitive
@@ -233,46 +260,50 @@ do { \
for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */
#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \
- do { \
- _FP_W_TYPE _nh, _nl, _q, _r, _y; \
+ do \
+ { \
+ _FP_W_TYPE _nh, _nl, _q, _r, _y; \
\
- /* Normalize Y -- i.e. make the most significant bit set. */ \
- _y = Y##_f << _FP_WFRACXBITS_##fs; \
+ /* Normalize Y -- i.e. make the most significant bit set. */ \
+ _y = Y##_f << _FP_WFRACXBITS_##fs; \
\
- /* Shift X op correspondingly high, that is, up one full word. */ \
- if (X##_f < Y##_f) \
- { \
- R##_e--; \
- _nl = 0; \
- _nh = X##_f; \
- } \
- else \
- { \
- _nl = X##_f << (_FP_W_TYPE_SIZE - 1); \
- _nh = X##_f >> 1; \
- } \
+ /* Shift X op correspondingly high, that is, up one full word. */ \
+ if (X##_f < Y##_f) \
+ { \
+ R##_e--; \
+ _nl = 0; \
+ _nh = X##_f; \
+ } \
+ else \
+ { \
+ _nl = X##_f << (_FP_W_TYPE_SIZE - 1); \
+ _nh = X##_f >> 1; \
+ } \
\
- udiv_qrnnd(_q, _r, _nh, _nl, _y); \
- R##_f = _q | (_r != 0); \
- } while (0)
+ udiv_qrnnd (_q, _r, _nh, _nl, _y); \
+ R##_f = _q | (_r != 0); \
+ } \
+ while (0)
#define _FP_DIV_MEAT_1_udiv(fs, R, X, Y) \
- do { \
- _FP_W_TYPE _nh, _nl, _q, _r; \
- if (X##_f < Y##_f) \
- { \
- R##_e--; \
- _nl = X##_f << _FP_WFRACBITS_##fs; \
- _nh = X##_f >> _FP_WFRACXBITS_##fs; \
- } \
- else \
- { \
- _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
- _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
- } \
- udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
- R##_f = _q | (_r != 0); \
- } while (0)
+ do \
+ { \
+ _FP_W_TYPE _nh, _nl, _q, _r; \
+ if (X##_f < Y##_f) \
+ { \
+ R##_e--; \
+ _nl = X##_f << _FP_WFRACBITS_##fs; \
+ _nh = X##_f >> _FP_WFRACXBITS_##fs; \
+ } \
+ else \
+ { \
+ _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
+ _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
+ } \
+ udiv_qrnnd (_q, _r, _nh, _nl, Y##_f); \
+ R##_f = _q | (_r != 0); \
+ } \
+ while (0)
/*
@@ -281,27 +312,29 @@ do { \
* should be added for those machines where division is fast.
*/
-#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
- do { \
- while (q != _FP_WORK_ROUND) \
- { \
- T##_f = S##_f + q; \
- if (T##_f <= X##_f) \
- { \
- S##_f = T##_f + q; \
- X##_f -= T##_f; \
- R##_f += q; \
- } \
- _FP_FRAC_SLL_1(X, 1); \
- q >>= 1; \
- } \
- if (X##_f) \
- { \
- if (S##_f < X##_f) \
- R##_f |= _FP_WORK_ROUND; \
- R##_f |= _FP_WORK_STICKY; \
- } \
- } while (0)
+#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
+ do \
+ { \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f = S##_f + q; \
+ if (T##_f <= X##_f) \
+ { \
+ S##_f = T##_f + q; \
+ X##_f -= T##_f; \
+ R##_f += q; \
+ } \
+ _FP_FRAC_SLL_1 (X, 1); \
+ q >>= 1; \
+ } \
+ if (X##_f) \
+ { \
+ if (S##_f < X##_f) \
+ R##_f |= _FP_WORK_ROUND; \
+ R##_f |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
/*
* Assembly/disassembly for converting to/from integral types.
diff --git a/libc/soft-fp/op-2.h b/libc/soft-fp/op-2.h
index 20088227e..5ef4217de 100644
--- a/libc/soft-fp/op-2.h
+++ b/libc/soft-fp/op-2.h
@@ -31,111 +31,113 @@
<http://www.gnu.org/licenses/>. */
#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
-#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
-#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
+#define _FP_FRAC_COPY_2(D, S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
+#define _FP_FRAC_SET_2(X, I) __FP_FRAC_SET_2 (X, I)
#define _FP_FRAC_HIGH_2(X) (X##_f1)
#define _FP_FRAC_LOW_2(X) (X##_f0)
-#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
-
-#define _FP_FRAC_SLL_2(X,N) \
-(void)(((N) < _FP_W_TYPE_SIZE) \
- ? ({ \
- if (__builtin_constant_p(N) && (N) == 1) \
- { \
- X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE)(X##_f0)) < 0); \
- X##_f0 += X##_f0; \
- } \
- else \
- { \
- X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N)); \
- X##_f0 <<= (N); \
- } \
- 0; \
- }) \
- : ({ \
- X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE); \
- X##_f0 = 0; \
- }))
-
-
-#define _FP_FRAC_SRL_2(X,N) \
-(void)(((N) < _FP_W_TYPE_SIZE) \
- ? ({ \
- X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N)); \
- X##_f1 >>= (N); \
- }) \
- : ({ \
- X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE); \
- X##_f1 = 0; \
- }))
+#define _FP_FRAC_WORD_2(X, w) (X##_f##w)
+
+#define _FP_FRAC_SLL_2(X, N) \
+ (void) (((N) < _FP_W_TYPE_SIZE) \
+ ? ({ \
+ if (__builtin_constant_p (N) && (N) == 1) \
+ { \
+ X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE) (X##_f0)) < 0); \
+ X##_f0 += X##_f0; \
+ } \
+ else \
+ { \
+ X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N)); \
+ X##_f0 <<= (N); \
+ } \
+ 0; \
+ }) \
+ : ({ \
+ X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE); \
+ X##_f0 = 0; \
+ }))
+
+
+#define _FP_FRAC_SRL_2(X, N) \
+ (void) (((N) < _FP_W_TYPE_SIZE) \
+ ? ({ \
+ X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N)); \
+ X##_f1 >>= (N); \
+ }) \
+ : ({ \
+ X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE); \
+ X##_f1 = 0; \
+ }))
/* Right shift with sticky-lsb. */
-#define _FP_FRAC_SRST_2(X,S, N,sz) \
-(void)(((N) < _FP_W_TYPE_SIZE) \
- ? ({ \
- S = (__builtin_constant_p(N) && (N) == 1 \
- ? X##_f0 & 1 \
- : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0); \
- X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N)); \
- X##_f1 >>= (N); \
- }) \
- : ({ \
- S = ((((N) == _FP_W_TYPE_SIZE \
- ? 0 \
- : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \
- | X##_f0) != 0); \
- X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE)); \
- X##_f1 = 0; \
- }))
-
-#define _FP_FRAC_SRS_2(X,N,sz) \
-(void)(((N) < _FP_W_TYPE_SIZE) \
- ? ({ \
- X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) | \
- (__builtin_constant_p(N) && (N) == 1 \
- ? X##_f0 & 1 \
- : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
- X##_f1 >>= (N); \
- }) \
- : ({ \
- X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
- ((((N) == _FP_W_TYPE_SIZE \
- ? 0 \
- : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \
- | X##_f0) != 0)); \
- X##_f1 = 0; \
- }))
-
-#define _FP_FRAC_ADDI_2(X,I) \
- __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)
-
-#define _FP_FRAC_ADD_2(R,X,Y) \
- __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
-
-#define _FP_FRAC_SUB_2(R,X,Y) \
- __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
-
-#define _FP_FRAC_DEC_2(X,Y) \
- __FP_FRAC_DEC_2(X##_f1, X##_f0, Y##_f1, Y##_f0)
-
-#define _FP_FRAC_CLZ_2(R,X) \
- do { \
- if (X##_f1) \
- __FP_CLZ(R,X##_f1); \
- else \
- { \
- __FP_CLZ(R,X##_f0); \
- R += _FP_W_TYPE_SIZE; \
- } \
- } while(0)
+#define _FP_FRAC_SRST_2(X, S, N, sz) \
+ (void) (((N) < _FP_W_TYPE_SIZE) \
+ ? ({ \
+ S = (__builtin_constant_p (N) && (N) == 1 \
+ ? X##_f0 & 1 \
+ : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0); \
+ X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N)); \
+ X##_f1 >>= (N); \
+ }) \
+ : ({ \
+ S = ((((N) == _FP_W_TYPE_SIZE \
+ ? 0 \
+ : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \
+ | X##_f0) != 0); \
+ X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE)); \
+ X##_f1 = 0; \
+ }))
+
+#define _FP_FRAC_SRS_2(X, N, sz) \
+ (void) (((N) < _FP_W_TYPE_SIZE) \
+ ? ({ \
+ X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \
+ | (__builtin_constant_p (N) && (N) == 1 \
+ ? X##_f0 & 1 \
+ : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
+ X##_f1 >>= (N); \
+ }) \
+ : ({ \
+ X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) \
+ | ((((N) == _FP_W_TYPE_SIZE \
+ ? 0 \
+ : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \
+ | X##_f0) != 0)); \
+ X##_f1 = 0; \
+ }))
+
+#define _FP_FRAC_ADDI_2(X, I) \
+ __FP_FRAC_ADDI_2 (X##_f1, X##_f0, I)
+
+#define _FP_FRAC_ADD_2(R, X, Y) \
+ __FP_FRAC_ADD_2 (R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_SUB_2(R, X, Y) \
+ __FP_FRAC_SUB_2 (R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_DEC_2(X, Y) \
+ __FP_FRAC_DEC_2 (X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_CLZ_2(R, X) \
+ do \
+ { \
+ if (X##_f1) \
+ __FP_CLZ (R, X##_f1); \
+ else \
+ { \
+ __FP_CLZ (R, X##_f0); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ } \
+ while (0)
/* Predicates */
-#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE)X##_f1 < 0)
+#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE) X##_f1 < 0)
#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
-#define _FP_FRAC_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs)
-#define _FP_FRAC_CLEAR_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) &= ~_FP_OVERFLOW_##fs)
-#define _FP_FRAC_HIGHBIT_DW_2(fs,X) \
- (_FP_FRAC_HIGH_DW_##fs(X) & _FP_HIGHBIT_DW_##fs)
+#define _FP_FRAC_OVERP_2(fs, X) (_FP_FRAC_HIGH_##fs (X) & _FP_OVERFLOW_##fs)
+#define _FP_FRAC_CLEAR_OVERP_2(fs, X) (_FP_FRAC_HIGH_##fs (X) &= ~_FP_OVERFLOW_##fs)
+#define _FP_FRAC_HIGHBIT_DW_2(fs, X) \
+ (_FP_FRAC_HIGH_DW_##fs (X) & _FP_HIGHBIT_DW_##fs)
#define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0)
#define _FP_FRAC_GT_2(X, Y) \
(X##_f1 > Y##_f1 || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0))
@@ -144,57 +146,62 @@
#define _FP_ZEROFRAC_2 0, 0
#define _FP_MINFRAC_2 0, 1
-#define _FP_MAXFRAC_2 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
+#define _FP_MAXFRAC_2 (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0)
/*
* Internals
*/
-#define __FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
-
-#define __FP_CLZ_2(R, xh, xl) \
- do { \
- if (xh) \
- __FP_CLZ(R,xh); \
- else \
- { \
- __FP_CLZ(R,xl); \
- R += _FP_W_TYPE_SIZE; \
- } \
- } while(0)
+#define __FP_FRAC_SET_2(X, I1, I0) (X##_f0 = I0, X##_f1 = I1)
+
+#define __FP_CLZ_2(R, xh, xl) \
+ do \
+ { \
+ if (xh) \
+ __FP_CLZ (R, xh); \
+ else \
+ { \
+ __FP_CLZ (R, xl); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ } \
+ while (0)
#if 0
-#ifndef __FP_FRAC_ADDI_2
-#define __FP_FRAC_ADDI_2(xh, xl, i) \
+# ifndef __FP_FRAC_ADDI_2
+# define __FP_FRAC_ADDI_2(xh, xl, i) \
(xh += ((xl += i) < i))
-#endif
-#ifndef __FP_FRAC_ADD_2
-#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \
+# endif
+# ifndef __FP_FRAC_ADD_2
+# define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \
(rh = xh + yh + ((rl = xl + yl) < xl))
-#endif
-#ifndef __FP_FRAC_SUB_2
-#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \
+# endif
+# ifndef __FP_FRAC_SUB_2
+# define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \
(rh = xh - yh - ((rl = xl - yl) > xl))
-#endif
-#ifndef __FP_FRAC_DEC_2
-#define __FP_FRAC_DEC_2(xh, xl, yh, yl) \
- do { \
- UWtype _t = xl; \
- xh -= yh + ((xl -= yl) > _t); \
- } while (0)
-#endif
+# endif
+# ifndef __FP_FRAC_DEC_2
+# define __FP_FRAC_DEC_2(xh, xl, yh, yl) \
+ do \
+ { \
+ UWtype _t = xl; \
+ xh -= yh + ((xl -= yl) > _t); \
+ } \
+ while (0)
+# endif
#else
-#undef __FP_FRAC_ADDI_2
-#define __FP_FRAC_ADDI_2(xh, xl, i) add_ssaaaa(xh, xl, xh, xl, 0, i)
-#undef __FP_FRAC_ADD_2
-#define __FP_FRAC_ADD_2 add_ssaaaa
-#undef __FP_FRAC_SUB_2
-#define __FP_FRAC_SUB_2 sub_ddmmss
-#undef __FP_FRAC_DEC_2
-#define __FP_FRAC_DEC_2(xh, xl, yh, yl) sub_ddmmss(xh, xl, xh, xl, yh, yl)
+# undef __FP_FRAC_ADDI_2
+# define __FP_FRAC_ADDI_2(xh, xl, i) add_ssaaaa (xh, xl, xh, xl, 0, i)
+# undef __FP_FRAC_ADD_2
+# define __FP_FRAC_ADD_2 add_ssaaaa
+# undef __FP_FRAC_SUB_2
+# define __FP_FRAC_SUB_2 sub_ddmmss
+# undef __FP_FRAC_DEC_2
+# define __FP_FRAC_DEC_2(xh, xl, yh, yl) \
+ sub_ddmmss (xh, xl, xh, xl, yh, yl)
#endif
@@ -203,54 +210,61 @@
* normalize the data.
*/
-#define _FP_UNPACK_RAW_2(fs, X, val) \
- do { \
- union _FP_UNION_##fs _flo; _flo.flt = (val); \
- \
- X##_f0 = _flo.bits.frac0; \
- X##_f1 = _flo.bits.frac1; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } while (0)
-
-#define _FP_UNPACK_RAW_2_P(fs, X, val) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- X##_f0 = _flo->bits.frac0; \
- X##_f1 = _flo->bits.frac1; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } while (0)
+#define _FP_UNPACK_RAW_2(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ _flo.flt = (val); \
+ \
+ X##_f0 = _flo.bits.frac0; \
+ X##_f1 = _flo.bits.frac1; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } \
+ while (0)
+
+#define _FP_UNPACK_RAW_2_P(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ X##_f0 = _flo->bits.frac0; \
+ X##_f1 = _flo->bits.frac1; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } \
+ while (0)
/*
* Repack the raw bits of a native fp value.
*/
-#define _FP_PACK_RAW_2(fs, val, X) \
- do { \
- union _FP_UNION_##fs _flo; \
- \
- _flo.bits.frac0 = X##_f0; \
- _flo.bits.frac1 = X##_f1; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
- \
- (val) = _flo.flt; \
- } while (0)
-
-#define _FP_PACK_RAW_2_P(fs, val, X) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- _flo->bits.frac0 = X##_f0; \
- _flo->bits.frac1 = X##_f1; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } while (0)
+#define _FP_PACK_RAW_2(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ \
+ _flo.bits.frac0 = X##_f0; \
+ _flo.bits.frac1 = X##_f1; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } \
+ while (0)
+
+#define _FP_PACK_RAW_2_P(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ _flo->bits.frac0 = X##_f0; \
+ _flo->bits.frac1 = X##_f1; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ while (0)
/*
@@ -260,111 +274,127 @@
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
#define _FP_MUL_MEAT_DW_2_wide(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
+ do \
+ { \
+ _FP_FRAC_DECL_2 (_b); \
+ _FP_FRAC_DECL_2 (_c); \
\
- doit(_FP_FRAC_WORD_4(R,1), _FP_FRAC_WORD_4(R,0), X##_f0, Y##_f0); \
- doit(_b_f1, _b_f0, X##_f0, Y##_f1); \
- doit(_c_f1, _c_f0, X##_f1, Y##_f0); \
- doit(_FP_FRAC_WORD_4(R,3), _FP_FRAC_WORD_4(R,2), X##_f1, Y##_f1); \
+ doit (_FP_FRAC_WORD_4 (R, 1), _FP_FRAC_WORD_4 (R, 0), X##_f0, Y##_f0); \
+ doit (_b_f1, _b_f0, X##_f0, Y##_f1); \
+ doit (_c_f1, _c_f0, X##_f1, Y##_f0); \
+ doit (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), X##_f1, Y##_f1); \
\
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1), 0, _b_f1, _b_f0, \
- _FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1), 0, _c_f1, _c_f0, \
- _FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1)); \
- } while (0)
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1), 0, _b_f1, _b_f0, \
+ _FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1), 0, _c_f1, _c_f0, \
+ _FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1)); \
+ } \
+ while (0)
#define _FP_MUL_MEAT_2_wide(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_4(_z); \
+ do \
+ { \
+ _FP_FRAC_DECL_4 (_z); \
\
- _FP_MUL_MEAT_DW_2_wide(wfracbits, _z, X, Y, doit); \
+ _FP_MUL_MEAT_DW_2_wide (wfracbits, _z, X, Y, doit); \
\
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
- R##_f0 = _FP_FRAC_WORD_4(_z,0); \
- R##_f1 = _FP_FRAC_WORD_4(_z,1); \
- } while (0)
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4 (_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _FP_FRAC_WORD_4 (_z, 0); \
+ R##_f1 = _FP_FRAC_WORD_4 (_z, 1); \
+ } \
+ while (0)
/* Given a 1W * 1W => 2W primitive, do the extended multiplication.
Do only 3 multiplications instead of four. This one is for machines
where multiplication is much more expensive than subtraction. */
#define _FP_MUL_MEAT_DW_2_wide_3mul(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
- _FP_W_TYPE _d; \
- int _c1, _c2; \
+ do \
+ { \
+ _FP_FRAC_DECL_2 (_b); \
+ _FP_FRAC_DECL_2 (_c); \
+ _FP_W_TYPE _d; \
+ int _c1, _c2; \
\
- _b_f0 = X##_f0 + X##_f1; \
- _c1 = _b_f0 < X##_f0; \
- _b_f1 = Y##_f0 + Y##_f1; \
- _c2 = _b_f1 < Y##_f0; \
- doit(_d, _FP_FRAC_WORD_4(R,0), X##_f0, Y##_f0); \
- doit(_FP_FRAC_WORD_4(R,2), _FP_FRAC_WORD_4(R,1), _b_f0, _b_f1); \
- doit(_c_f1, _c_f0, X##_f1, Y##_f1); \
+ _b_f0 = X##_f0 + X##_f1; \
+ _c1 = _b_f0 < X##_f0; \
+ _b_f1 = Y##_f0 + Y##_f1; \
+ _c2 = _b_f1 < Y##_f0; \
+ doit (_d, _FP_FRAC_WORD_4 (R, 0), X##_f0, Y##_f0); \
+ doit (_FP_FRAC_WORD_4 (R, 2), _FP_FRAC_WORD_4 (R, 1), _b_f0, _b_f1); \
+ doit (_c_f1, _c_f0, X##_f1, Y##_f1); \
\
- _b_f0 &= -_c2; \
- _b_f1 &= -_c1; \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1), (_c1 & _c2), 0, _d, \
- 0, _FP_FRAC_WORD_4(R,2), _FP_FRAC_WORD_4(R,1)); \
- __FP_FRAC_ADDI_2(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _b_f0); \
- __FP_FRAC_ADDI_2(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _b_f1); \
- __FP_FRAC_DEC_3(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1), \
- 0, _d, _FP_FRAC_WORD_4(R,0)); \
- __FP_FRAC_DEC_3(_FP_FRAC_WORD_4(R,3),_FP_FRAC_WORD_4(R,2), \
- _FP_FRAC_WORD_4(R,1), 0, _c_f1, _c_f0); \
- __FP_FRAC_ADD_2(_FP_FRAC_WORD_4(R,3), _FP_FRAC_WORD_4(R,2), \
- _c_f1, _c_f0, \
- _FP_FRAC_WORD_4(R,3), _FP_FRAC_WORD_4(R,2)); \
- } while (0)
+ _b_f0 &= -_c2; \
+ _b_f1 &= -_c1; \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1), (_c1 & _c2), 0, _d, \
+ 0, _FP_FRAC_WORD_4 (R, 2), _FP_FRAC_WORD_4 (R, 1)); \
+ __FP_FRAC_ADDI_2 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _b_f0); \
+ __FP_FRAC_ADDI_2 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _b_f1); \
+ __FP_FRAC_DEC_3 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1), \
+ 0, _d, _FP_FRAC_WORD_4 (R, 0)); \
+ __FP_FRAC_DEC_3 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _FP_FRAC_WORD_4 (R, 1), 0, _c_f1, _c_f0); \
+ __FP_FRAC_ADD_2 (_FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2), \
+ _c_f1, _c_f0, \
+ _FP_FRAC_WORD_4 (R, 3), _FP_FRAC_WORD_4 (R, 2)); \
+ } \
+ while (0)
#define _FP_MUL_MEAT_2_wide_3mul(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_4(_z); \
+ do \
+ { \
+ _FP_FRAC_DECL_4 (_z); \
\
- _FP_MUL_MEAT_DW_2_wide_3mul(wfracbits, _z, X, Y, doit); \
+ _FP_MUL_MEAT_DW_2_wide_3mul (wfracbits, _z, X, Y, doit); \
\
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
- R##_f0 = _FP_FRAC_WORD_4(_z,0); \
- R##_f1 = _FP_FRAC_WORD_4(_z,1); \
- } while (0)
-
-#define _FP_MUL_MEAT_DW_2_gmp(wfracbits, R, X, Y) \
- do { \
- _FP_W_TYPE _x[2], _y[2]; \
- _x[0] = X##_f0; _x[1] = X##_f1; \
- _y[0] = Y##_f0; _y[1] = Y##_f1; \
- \
- mpn_mul_n(R##_f, _x, _y, 2); \
- } while (0)
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4 (_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _FP_FRAC_WORD_4 (_z, 0); \
+ R##_f1 = _FP_FRAC_WORD_4 (_z, 1); \
+ } \
+ while (0)
+
+#define _FP_MUL_MEAT_DW_2_gmp(wfracbits, R, X, Y) \
+ do \
+ { \
+ _FP_W_TYPE _x[2], _y[2]; \
+ _x[0] = X##_f0; \
+ _x[1] = X##_f1; \
+ _y[0] = Y##_f0; \
+ _y[1] = Y##_f1; \
+ \
+ mpn_mul_n (R##_f, _x, _y, 2); \
+ } \
+ while (0)
#define _FP_MUL_MEAT_2_gmp(wfracbits, R, X, Y) \
- do { \
- _FP_FRAC_DECL_4(_z); \
+ do \
+ { \
+ _FP_FRAC_DECL_4 (_z); \
\
- _FP_MUL_MEAT_DW_2_gmp(wfracbits, _z, X, Y); \
+ _FP_MUL_MEAT_DW_2_gmp (wfracbits, _z, X, Y); \
\
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
- R##_f0 = _z_f[0]; \
- R##_f1 = _z_f[1]; \
- } while (0)
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4 (_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _z_f[0]; \
+ R##_f1 = _z_f[1]; \
+ } \
+ while (0)
/* Do at most 120x120=240 bits multiplication using double floating
point multiplication. This is useful if floating point
@@ -375,190 +405,173 @@
SETFETZ is a macro which will disable all FPU exceptions and set rounding
towards zero, RESETFE should optionally reset it back. */
-#define _FP_MUL_MEAT_2_120_240_double(wfracbits, R, X, Y, setfetz, resetfe) \
- do { \
- static const double _const[] = { \
- /* 2^-24 */ 5.9604644775390625e-08, \
- /* 2^-48 */ 3.5527136788005009e-15, \
- /* 2^-72 */ 2.1175823681357508e-22, \
- /* 2^-96 */ 1.2621774483536189e-29, \
- /* 2^28 */ 2.68435456e+08, \
- /* 2^4 */ 1.600000e+01, \
- /* 2^-20 */ 9.5367431640625e-07, \
- /* 2^-44 */ 5.6843418860808015e-14, \
- /* 2^-68 */ 3.3881317890172014e-21, \
- /* 2^-92 */ 2.0194839173657902e-28, \
- /* 2^-116 */ 1.2037062152420224e-35}; \
- double _a240, _b240, _c240, _d240, _e240, _f240, \
- _g240, _h240, _i240, _j240, _k240; \
- union { double d; UDItype i; } _l240, _m240, _n240, _o240, \
- _p240, _q240, _r240, _s240; \
- UDItype _t240, _u240, _v240, _w240, _x240, _y240 = 0; \
- \
- if (wfracbits < 106 || wfracbits > 120) \
- abort(); \
- \
- setfetz; \
- \
- _e240 = (double)(long)(X##_f0 & 0xffffff); \
- _j240 = (double)(long)(Y##_f0 & 0xffffff); \
- _d240 = (double)(long)((X##_f0 >> 24) & 0xffffff); \
- _i240 = (double)(long)((Y##_f0 >> 24) & 0xffffff); \
- _c240 = (double)(long)(((X##_f1 << 16) & 0xffffff) | (X##_f0 >> 48)); \
- _h240 = (double)(long)(((Y##_f1 << 16) & 0xffffff) | (Y##_f0 >> 48)); \
- _b240 = (double)(long)((X##_f1 >> 8) & 0xffffff); \
- _g240 = (double)(long)((Y##_f1 >> 8) & 0xffffff); \
- _a240 = (double)(long)(X##_f1 >> 32); \
- _f240 = (double)(long)(Y##_f1 >> 32); \
- _e240 *= _const[3]; \
- _j240 *= _const[3]; \
- _d240 *= _const[2]; \
- _i240 *= _const[2]; \
- _c240 *= _const[1]; \
- _h240 *= _const[1]; \
- _b240 *= _const[0]; \
- _g240 *= _const[0]; \
- _s240.d = _e240*_j240;\
- _r240.d = _d240*_j240 + _e240*_i240;\
- _q240.d = _c240*_j240 + _d240*_i240 + _e240*_h240;\
- _p240.d = _b240*_j240 + _c240*_i240 + _d240*_h240 + _e240*_g240;\
- _o240.d = _a240*_j240 + _b240*_i240 + _c240*_h240 + _d240*_g240 + _e240*_f240;\
- _n240.d = _a240*_i240 + _b240*_h240 + _c240*_g240 + _d240*_f240; \
- _m240.d = _a240*_h240 + _b240*_g240 + _c240*_f240; \
- _l240.d = _a240*_g240 + _b240*_f240; \
- _k240 = _a240*_f240; \
- _r240.d += _s240.d; \
- _q240.d += _r240.d; \
- _p240.d += _q240.d; \
- _o240.d += _p240.d; \
- _n240.d += _o240.d; \
- _m240.d += _n240.d; \
- _l240.d += _m240.d; \
- _k240 += _l240.d; \
- _s240.d -= ((_const[10]+_s240.d)-_const[10]); \
- _r240.d -= ((_const[9]+_r240.d)-_const[9]); \
- _q240.d -= ((_const[8]+_q240.d)-_const[8]); \
- _p240.d -= ((_const[7]+_p240.d)-_const[7]); \
- _o240.d += _const[7]; \
- _n240.d += _const[6]; \
- _m240.d += _const[5]; \
- _l240.d += _const[4]; \
- if (_s240.d != 0.0) _y240 = 1; \
- if (_r240.d != 0.0) _y240 = 1; \
- if (_q240.d != 0.0) _y240 = 1; \
- if (_p240.d != 0.0) _y240 = 1; \
- _t240 = (DItype)_k240; \
- _u240 = _l240.i; \
- _v240 = _m240.i; \
- _w240 = _n240.i; \
- _x240 = _o240.i; \
- R##_f1 = (_t240 << (128 - (wfracbits - 1))) \
- | ((_u240 & 0xffffff) >> ((wfracbits - 1) - 104)); \
- R##_f0 = ((_u240 & 0xffffff) << (168 - (wfracbits - 1))) \
- | ((_v240 & 0xffffff) << (144 - (wfracbits - 1))) \
- | ((_w240 & 0xffffff) << (120 - (wfracbits - 1))) \
- | ((_x240 & 0xffffff) >> ((wfracbits - 1) - 96)) \
- | _y240; \
- resetfe; \
- } while (0)
+#define _FP_MUL_MEAT_2_120_240_double(wfracbits, R, X, Y, setfetz, resetfe) \
+ do \
+ { \
+ static const double _const[] = \
+ { \
+ /* 2^-24 */ 5.9604644775390625e-08, \
+ /* 2^-48 */ 3.5527136788005009e-15, \
+ /* 2^-72 */ 2.1175823681357508e-22, \
+ /* 2^-96 */ 1.2621774483536189e-29, \
+ /* 2^28 */ 2.68435456e+08, \
+ /* 2^4 */ 1.600000e+01, \
+ /* 2^-20 */ 9.5367431640625e-07, \
+ /* 2^-44 */ 5.6843418860808015e-14, \
+ /* 2^-68 */ 3.3881317890172014e-21, \
+ /* 2^-92 */ 2.0194839173657902e-28, \
+ /* 2^-116 */ 1.2037062152420224e-35 \
+ }; \
+ double _a240, _b240, _c240, _d240, _e240, _f240, \
+ _g240, _h240, _i240, _j240, _k240; \
+ union { double d; UDItype i; } _l240, _m240, _n240, _o240, \
+ _p240, _q240, _r240, _s240; \
+ UDItype _t240, _u240, _v240, _w240, _x240, _y240 = 0; \
+ \
+ if (wfracbits < 106 || wfracbits > 120) \
+ abort (); \
+ \
+ setfetz; \
+ \
+ _e240 = (double) (long) (X##_f0 & 0xffffff); \
+ _j240 = (double) (long) (Y##_f0 & 0xffffff); \
+ _d240 = (double) (long) ((X##_f0 >> 24) & 0xffffff); \
+ _i240 = (double) (long) ((Y##_f0 >> 24) & 0xffffff); \
+ _c240 = (double) (long) (((X##_f1 << 16) & 0xffffff) | (X##_f0 >> 48)); \
+ _h240 = (double) (long) (((Y##_f1 << 16) & 0xffffff) | (Y##_f0 >> 48)); \
+ _b240 = (double) (long) ((X##_f1 >> 8) & 0xffffff); \
+ _g240 = (double) (long) ((Y##_f1 >> 8) & 0xffffff); \
+ _a240 = (double) (long) (X##_f1 >> 32); \
+ _f240 = (double) (long) (Y##_f1 >> 32); \
+ _e240 *= _const[3]; \
+ _j240 *= _const[3]; \
+ _d240 *= _const[2]; \
+ _i240 *= _const[2]; \
+ _c240 *= _const[1]; \
+ _h240 *= _const[1]; \
+ _b240 *= _const[0]; \
+ _g240 *= _const[0]; \
+ _s240.d = _e240*_j240; \
+ _r240.d = _d240*_j240 + _e240*_i240; \
+ _q240.d = _c240*_j240 + _d240*_i240 + _e240*_h240; \
+ _p240.d = _b240*_j240 + _c240*_i240 + _d240*_h240 + _e240*_g240; \
+ _o240.d = _a240*_j240 + _b240*_i240 + _c240*_h240 + _d240*_g240 + _e240*_f240; \
+ _n240.d = _a240*_i240 + _b240*_h240 + _c240*_g240 + _d240*_f240; \
+ _m240.d = _a240*_h240 + _b240*_g240 + _c240*_f240; \
+ _l240.d = _a240*_g240 + _b240*_f240; \
+ _k240 = _a240*_f240; \
+ _r240.d += _s240.d; \
+ _q240.d += _r240.d; \
+ _p240.d += _q240.d; \
+ _o240.d += _p240.d; \
+ _n240.d += _o240.d; \
+ _m240.d += _n240.d; \
+ _l240.d += _m240.d; \
+ _k240 += _l240.d; \
+ _s240.d -= ((_const[10]+_s240.d)-_const[10]); \
+ _r240.d -= ((_const[9]+_r240.d)-_const[9]); \
+ _q240.d -= ((_const[8]+_q240.d)-_const[8]); \
+ _p240.d -= ((_const[7]+_p240.d)-_const[7]); \
+ _o240.d += _const[7]; \
+ _n240.d += _const[6]; \
+ _m240.d += _const[5]; \
+ _l240.d += _const[4]; \
+ if (_s240.d != 0.0) \
+ _y240 = 1; \
+ if (_r240.d != 0.0) \
+ _y240 = 1; \
+ if (_q240.d != 0.0) \
+ _y240 = 1; \
+ if (_p240.d != 0.0) \
+ _y240 = 1; \
+ _t240 = (DItype) _k240; \
+ _u240 = _l240.i; \
+ _v240 = _m240.i; \
+ _w240 = _n240.i; \
+ _x240 = _o240.i; \
+ R##_f1 = ((_t240 << (128 - (wfracbits - 1))) \
+ | ((_u240 & 0xffffff) >> ((wfracbits - 1) - 104))); \
+ R##_f0 = (((_u240 & 0xffffff) << (168 - (wfracbits - 1))) \
+ | ((_v240 & 0xffffff) << (144 - (wfracbits - 1))) \
+ | ((_w240 & 0xffffff) << (120 - (wfracbits - 1))) \
+ | ((_x240 & 0xffffff) >> ((wfracbits - 1) - 96)) \
+ | _y240); \
+ resetfe; \
+ } \
+ while (0)
/*
* Division algorithms:
*/
#define _FP_DIV_MEAT_2_udiv(fs, R, X, Y) \
- do { \
- _FP_W_TYPE _n_f2, _n_f1, _n_f0, _r_f1, _r_f0, _m_f1, _m_f0; \
- if (_FP_FRAC_GT_2(X, Y)) \
- { \
- _n_f2 = X##_f1 >> 1; \
- _n_f1 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
- _n_f0 = X##_f0 << (_FP_W_TYPE_SIZE - 1); \
- } \
- else \
- { \
- R##_e--; \
- _n_f2 = X##_f1; \
- _n_f1 = X##_f0; \
- _n_f0 = 0; \
- } \
- \
- /* Normalize, i.e. make the most significant bit of the \
- denominator set. */ \
- _FP_FRAC_SLL_2(Y, _FP_WFRACXBITS_##fs); \
+ do \
+ { \
+ _FP_W_TYPE _n_f2, _n_f1, _n_f0, _r_f1, _r_f0, _m_f1, _m_f0; \
+ if (_FP_FRAC_GE_2 (X, Y)) \
+ { \
+ _n_f2 = X##_f1 >> 1; \
+ _n_f1 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
+ _n_f0 = X##_f0 << (_FP_W_TYPE_SIZE - 1); \
+ } \
+ else \
+ { \
+ R##_e--; \
+ _n_f2 = X##_f1; \
+ _n_f1 = X##_f0; \
+ _n_f0 = 0; \
+ } \
\
- udiv_qrnnd(R##_f1, _r_f1, _n_f2, _n_f1, Y##_f1); \
- umul_ppmm(_m_f1, _m_f0, R##_f1, Y##_f0); \
- _r_f0 = _n_f0; \
- if (_FP_FRAC_GT_2(_m, _r)) \
- { \
- R##_f1--; \
- _FP_FRAC_ADD_2(_r, Y, _r); \
- if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
- { \
- R##_f1--; \
- _FP_FRAC_ADD_2(_r, Y, _r); \
- } \
- } \
- _FP_FRAC_DEC_2(_r, _m); \
+ /* Normalize, i.e. make the most significant bit of the \
+ denominator set. */ \
+ _FP_FRAC_SLL_2 (Y, _FP_WFRACXBITS_##fs); \
\
- if (_r_f1 == Y##_f1) \
- { \
- /* This is a special case, not an optimization \
- (_r/Y##_f1 would not fit into UWtype). \
- As _r is guaranteed to be < Y, R##_f0 can be either \
- (UWtype)-1 or (UWtype)-2. But as we know what kind \
- of bits it is (sticky, guard, round), we don't care. \
- We also don't care what the reminder is, because the \
- guard bit will be set anyway. -jj */ \
- R##_f0 = -1; \
- } \
- else \
- { \
- udiv_qrnnd(R##_f0, _r_f1, _r_f1, _r_f0, Y##_f1); \
- umul_ppmm(_m_f1, _m_f0, R##_f0, Y##_f0); \
- _r_f0 = 0; \
- if (_FP_FRAC_GT_2(_m, _r)) \
- { \
- R##_f0--; \
- _FP_FRAC_ADD_2(_r, Y, _r); \
- if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
- { \
- R##_f0--; \
- _FP_FRAC_ADD_2(_r, Y, _r); \
- } \
- } \
- if (!_FP_FRAC_EQ_2(_r, _m)) \
- R##_f0 |= _FP_WORK_STICKY; \
- } \
- } while (0)
-
-
-#define _FP_DIV_MEAT_2_gmp(fs, R, X, Y) \
- do { \
- _FP_W_TYPE _x[4], _y[2], _z[4]; \
- _y[0] = Y##_f0; _y[1] = Y##_f1; \
- _x[0] = _x[3] = 0; \
- if (_FP_FRAC_GT_2(X, Y)) \
- { \
- R##_e++; \
- _x[1] = (X##_f0 << (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE) | \
- X##_f1 >> (_FP_W_TYPE_SIZE - \
- (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE))); \
- _x[2] = X##_f1 << (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE); \
- } \
- else \
- { \
- _x[1] = (X##_f0 << (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE) | \
- X##_f1 >> (_FP_W_TYPE_SIZE - \
- (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE))); \
- _x[2] = X##_f1 << (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE); \
- } \
+ udiv_qrnnd (R##_f1, _r_f1, _n_f2, _n_f1, Y##_f1); \
+ umul_ppmm (_m_f1, _m_f0, R##_f1, Y##_f0); \
+ _r_f0 = _n_f0; \
+ if (_FP_FRAC_GT_2 (_m, _r)) \
+ { \
+ R##_f1--; \
+ _FP_FRAC_ADD_2 (_r, Y, _r); \
+ if (_FP_FRAC_GE_2 (_r, Y) && _FP_FRAC_GT_2 (_m, _r)) \
+ { \
+ R##_f1--; \
+ _FP_FRAC_ADD_2 (_r, Y, _r); \
+ } \
+ } \
+ _FP_FRAC_DEC_2 (_r, _m); \
\
- (void) mpn_divrem (_z, 0, _x, 4, _y, 2); \
- R##_f1 = _z[1]; \
- R##_f0 = _z[0] | ((_x[0] | _x[1]) != 0); \
- } while (0)
+ if (_r_f1 == Y##_f1) \
+ { \
+ /* This is a special case, not an optimization \
+ (_r/Y##_f1 would not fit into UWtype). \
+ As _r is guaranteed to be < Y, R##_f0 can be either \
+ (UWtype)-1 or (UWtype)-2. But as we know what kind \
+ of bits it is (sticky, guard, round), we don't care. \
+ We also don't care what the reminder is, because the \
+ guard bit will be set anyway. -jj */ \
+ R##_f0 = -1; \
+ } \
+ else \
+ { \
+ udiv_qrnnd (R##_f0, _r_f1, _r_f1, _r_f0, Y##_f1); \
+ umul_ppmm (_m_f1, _m_f0, R##_f0, Y##_f0); \
+ _r_f0 = 0; \
+ if (_FP_FRAC_GT_2 (_m, _r)) \
+ { \
+ R##_f0--; \
+ _FP_FRAC_ADD_2 (_r, Y, _r); \
+ if (_FP_FRAC_GE_2 (_r, Y) && _FP_FRAC_GT_2 (_m, _r)) \
+ { \
+ R##_f0--; \
+ _FP_FRAC_ADD_2 (_r, Y, _r); \
+ } \
+ } \
+ if (!_FP_FRAC_EQ_2 (_r, _m)) \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
/*
@@ -567,44 +580,46 @@
* should be added for those machines where division is fast.
*/
-#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
- do { \
- while (q) \
- { \
- T##_f1 = S##_f1 + q; \
- if (T##_f1 <= X##_f1) \
- { \
- S##_f1 = T##_f1 + q; \
- X##_f1 -= T##_f1; \
- R##_f1 += q; \
- } \
- _FP_FRAC_SLL_2(X, 1); \
- q >>= 1; \
- } \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- while (q != _FP_WORK_ROUND) \
- { \
- T##_f0 = S##_f0 + q; \
- T##_f1 = S##_f1; \
- if (T##_f1 < X##_f1 || \
- (T##_f1 == X##_f1 && T##_f0 <= X##_f0)) \
- { \
- S##_f0 = T##_f0 + q; \
- S##_f1 += (T##_f0 > S##_f0); \
- _FP_FRAC_DEC_2(X, T); \
- R##_f0 += q; \
- } \
- _FP_FRAC_SLL_2(X, 1); \
- q >>= 1; \
- } \
- if (X##_f0 | X##_f1) \
- { \
- if (S##_f1 < X##_f1 || \
- (S##_f1 == X##_f1 && S##_f0 < X##_f0)) \
- R##_f0 |= _FP_WORK_ROUND; \
- R##_f0 |= _FP_WORK_STICKY; \
- } \
- } while (0)
+#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
+ do \
+ { \
+ while (q) \
+ { \
+ T##_f1 = S##_f1 + q; \
+ if (T##_f1 <= X##_f1) \
+ { \
+ S##_f1 = T##_f1 + q; \
+ X##_f1 -= T##_f1; \
+ R##_f1 += q; \
+ } \
+ _FP_FRAC_SLL_2 (X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f0 = S##_f0 + q; \
+ T##_f1 = S##_f1; \
+ if (T##_f1 < X##_f1 \
+ || (T##_f1 == X##_f1 && T##_f0 <= X##_f0)) \
+ { \
+ S##_f0 = T##_f0 + q; \
+ S##_f1 += (T##_f0 > S##_f0); \
+ _FP_FRAC_DEC_2 (X, T); \
+ R##_f0 += q; \
+ } \
+ _FP_FRAC_SLL_2 (X, 1); \
+ q >>= 1; \
+ } \
+ if (X##_f0 | X##_f1) \
+ { \
+ if (S##_f1 < X##_f1 \
+ || (S##_f1 == X##_f1 && S##_f0 < X##_f0)) \
+ R##_f0 |= _FP_WORK_ROUND; \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
/*
@@ -613,19 +628,21 @@
*/
#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
-(void)((rsize <= _FP_W_TYPE_SIZE) \
- ? ({ r = X##_f0; }) \
- : ({ \
- r = X##_f1; \
- r <<= _FP_W_TYPE_SIZE; \
- r += X##_f0; \
- }))
+ (void) ((rsize <= _FP_W_TYPE_SIZE) \
+ ? ({ r = X##_f0; }) \
+ : ({ \
+ r = X##_f1; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f0; \
+ }))
#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \
- do { \
- X##_f0 = r; \
- X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
- } while (0)
+ do \
+ { \
+ X##_f0 = r; \
+ X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
+ } \
+ while (0)
/*
* Convert FP values between word sizes
@@ -635,4 +652,4 @@
#define _FP_FRAC_COPY_2_1(D, S) ((D##_f0 = S##_f), (D##_f1 = 0))
-#define _FP_FRAC_COPY_2_2(D,S) _FP_FRAC_COPY_2(D,S)
+#define _FP_FRAC_COPY_2_2(D, S) _FP_FRAC_COPY_2 (D, S)
diff --git a/libc/soft-fp/op-4.h b/libc/soft-fp/op-4.h
index f16870d0f..3515bdc49 100644
--- a/libc/soft-fp/op-4.h
+++ b/libc/soft-fp/op-4.h
@@ -31,54 +31,58 @@
<http://www.gnu.org/licenses/>. */
#define _FP_FRAC_DECL_4(X) _FP_W_TYPE X##_f[4]
-#define _FP_FRAC_COPY_4(D,S) \
+#define _FP_FRAC_COPY_4(D, S) \
(D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
-#define _FP_FRAC_SET_4(X,I) __FP_FRAC_SET_4(X, I)
+#define _FP_FRAC_SET_4(X, I) __FP_FRAC_SET_4 (X, I)
#define _FP_FRAC_HIGH_4(X) (X##_f[3])
#define _FP_FRAC_LOW_4(X) (X##_f[0])
-#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
-
-#define _FP_FRAC_SLL_4(X,N) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _up = (N) % _FP_W_TYPE_SIZE; \
- _down = _FP_W_TYPE_SIZE - _up; \
- if (!_up) \
- for (_i = 3; _i >= _skip; --_i) \
- X##_f[_i] = X##_f[_i-_skip]; \
- else \
- { \
- for (_i = 3; _i > _skip; --_i) \
- X##_f[_i] = X##_f[_i-_skip] << _up \
- | X##_f[_i-_skip-1] >> _down; \
- X##_f[_i--] = X##_f[0] << _up; \
- } \
- for (; _i >= 0; --_i) \
- X##_f[_i] = 0; \
- } while (0)
+#define _FP_FRAC_WORD_4(X, w) (X##_f[w])
+
+#define _FP_FRAC_SLL_4(X, N) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _up = (N) % _FP_W_TYPE_SIZE; \
+ _down = _FP_W_TYPE_SIZE - _up; \
+ if (!_up) \
+ for (_i = 3; _i >= _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip]; \
+ else \
+ { \
+ for (_i = 3; _i > _skip; --_i) \
+ X##_f[_i] = (X##_f[_i-_skip] << _up \
+ | X##_f[_i-_skip-1] >> _down); \
+ X##_f[_i--] = X##_f[0] << _up; \
+ } \
+ for (; _i >= 0; --_i) \
+ X##_f[_i] = 0; \
+ } \
+ while (0)
/* This one was broken too */
-#define _FP_FRAC_SRL_4(X,N) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _down = (N) % _FP_W_TYPE_SIZE; \
- _up = _FP_W_TYPE_SIZE - _down; \
- if (!_down) \
- for (_i = 0; _i <= 3-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip]; \
- else \
- { \
- for (_i = 0; _i < 3-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip] >> _down \
- | X##_f[_i+_skip+1] << _up; \
- X##_f[_i++] = X##_f[3] >> _down; \
- } \
- for (; _i < 4; ++_i) \
- X##_f[_i] = 0; \
- } while (0)
+#define _FP_FRAC_SRL_4(X, N) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ if (!_down) \
+ for (_i = 0; _i <= 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 3-_skip; ++_i) \
+ X##_f[_i] = (X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up); \
+ X##_f[_i++] = X##_f[3] >> _down; \
+ } \
+ for (; _i < 4; ++_i) \
+ X##_f[_i] = 0; \
+ } \
+ while (0)
/* Right shift with sticky-lsb.
@@ -86,161 +90,172 @@
* but that if any of the bits that fall off the right hand side
* were one then we always set the LSbit.
*/
-#define _FP_FRAC_SRST_4(X,S,N,size) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _FP_W_TYPE _s; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _down = (N) % _FP_W_TYPE_SIZE; \
- _up = _FP_W_TYPE_SIZE - _down; \
- for (_s = _i = 0; _i < _skip; ++_i) \
- _s |= X##_f[_i]; \
- if (!_down) \
- for (_i = 0; _i <= 3-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip]; \
- else \
- { \
- _s |= X##_f[_i] << _up; \
- for (_i = 0; _i < 3-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip] >> _down \
- | X##_f[_i+_skip+1] << _up; \
- X##_f[_i++] = X##_f[3] >> _down; \
- } \
- for (; _i < 4; ++_i) \
- X##_f[_i] = 0; \
- S = (_s != 0); \
- } while (0)
-
-#define _FP_FRAC_SRS_4(X,N,size) \
- do { \
- int _sticky; \
- _FP_FRAC_SRST_4(X, _sticky, N, size); \
- X##_f[0] |= _sticky; \
- } while (0)
-
-#define _FP_FRAC_ADD_4(R,X,Y) \
- __FP_FRAC_ADD_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
- X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
- Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
-
-#define _FP_FRAC_SUB_4(R,X,Y) \
- __FP_FRAC_SUB_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
- X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
- Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
-
-#define _FP_FRAC_DEC_4(X,Y) \
- __FP_FRAC_DEC_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
- Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
-
-#define _FP_FRAC_ADDI_4(X,I) \
- __FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
-
-#define _FP_ZEROFRAC_4 0,0,0,0
-#define _FP_MINFRAC_4 0,0,0,1
-#define _FP_MAXFRAC_4 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
+#define _FP_FRAC_SRST_4(X, S, N, size) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _FP_W_TYPE _s; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ for (_s = _i = 0; _i < _skip; ++_i) \
+ _s |= X##_f[_i]; \
+ if (!_down) \
+ for (_i = 0; _i <= 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ _s |= X##_f[_i] << _up; \
+ for (_i = 0; _i < 3-_skip; ++_i) \
+ X##_f[_i] = (X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up); \
+ X##_f[_i++] = X##_f[3] >> _down; \
+ } \
+ for (; _i < 4; ++_i) \
+ X##_f[_i] = 0; \
+ S = (_s != 0); \
+ } \
+ while (0)
+
+#define _FP_FRAC_SRS_4(X, N, size) \
+ do \
+ { \
+ int _sticky; \
+ _FP_FRAC_SRST_4 (X, _sticky, N, size); \
+ X##_f[0] |= _sticky; \
+ } \
+ while (0)
+
+#define _FP_FRAC_ADD_4(R, X, Y) \
+ __FP_FRAC_ADD_4 (R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
+ X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_SUB_4(R, X, Y) \
+ __FP_FRAC_SUB_4 (R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
+ X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_DEC_4(X, Y) \
+ __FP_FRAC_DEC_4 (X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_ADDI_4(X, I) \
+ __FP_FRAC_ADDI_4 (X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
+
+#define _FP_ZEROFRAC_4 0, 0, 0, 0
+#define _FP_MINFRAC_4 0, 0, 0, 1
+#define _FP_MAXFRAC_4 (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0)
#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
-#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
-#define _FP_FRAC_OVERP_4(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs)
-#define _FP_FRAC_HIGHBIT_DW_4(fs,X) \
- (_FP_FRAC_HIGH_DW_##fs(X) & _FP_HIGHBIT_DW_##fs)
-#define _FP_FRAC_CLEAR_OVERP_4(fs,X) (_FP_FRAC_HIGH_##fs(X) &= ~_FP_OVERFLOW_##fs)
-
-#define _FP_FRAC_EQ_4(X,Y) \
- (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \
- && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])
-
-#define _FP_FRAC_GT_4(X,Y) \
- (X##_f[3] > Y##_f[3] || \
- (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
- (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
- (X##_f[1] == Y##_f[1] && X##_f[0] > Y##_f[0]) \
- )) \
- )) \
- )
-
-#define _FP_FRAC_GE_4(X,Y) \
- (X##_f[3] > Y##_f[3] || \
- (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
- (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
- (X##_f[1] == Y##_f[1] && X##_f[0] >= Y##_f[0]) \
- )) \
- )) \
- )
-
-
-#define _FP_FRAC_CLZ_4(R,X) \
- do { \
- if (X##_f[3]) \
- { \
- __FP_CLZ(R,X##_f[3]); \
- } \
- else if (X##_f[2]) \
- { \
- __FP_CLZ(R,X##_f[2]); \
- R += _FP_W_TYPE_SIZE; \
- } \
- else if (X##_f[1]) \
- { \
- __FP_CLZ(R,X##_f[1]); \
- R += _FP_W_TYPE_SIZE*2; \
- } \
- else \
- { \
- __FP_CLZ(R,X##_f[0]); \
- R += _FP_W_TYPE_SIZE*3; \
- } \
- } while(0)
-
-
-#define _FP_UNPACK_RAW_4(fs, X, val) \
- do { \
- union _FP_UNION_##fs _flo; _flo.flt = (val); \
- X##_f[0] = _flo.bits.frac0; \
- X##_f[1] = _flo.bits.frac1; \
- X##_f[2] = _flo.bits.frac2; \
- X##_f[3] = _flo.bits.frac3; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } while (0)
-
-#define _FP_UNPACK_RAW_4_P(fs, X, val) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- X##_f[0] = _flo->bits.frac0; \
- X##_f[1] = _flo->bits.frac1; \
- X##_f[2] = _flo->bits.frac2; \
- X##_f[3] = _flo->bits.frac3; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } while (0)
-
-#define _FP_PACK_RAW_4(fs, val, X) \
- do { \
- union _FP_UNION_##fs _flo; \
- _flo.bits.frac0 = X##_f[0]; \
- _flo.bits.frac1 = X##_f[1]; \
- _flo.bits.frac2 = X##_f[2]; \
- _flo.bits.frac3 = X##_f[3]; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
- (val) = _flo.flt; \
- } while (0)
-
-#define _FP_PACK_RAW_4_P(fs, val, X) \
- do { \
- union _FP_UNION_##fs *_flo = \
- (union _FP_UNION_##fs *)(val); \
- \
- _flo->bits.frac0 = X##_f[0]; \
- _flo->bits.frac1 = X##_f[1]; \
- _flo->bits.frac2 = X##_f[2]; \
- _flo->bits.frac3 = X##_f[3]; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } while (0)
+#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE) X##_f[3] < 0)
+#define _FP_FRAC_OVERP_4(fs, X) (_FP_FRAC_HIGH_##fs (X) & _FP_OVERFLOW_##fs)
+#define _FP_FRAC_HIGHBIT_DW_4(fs, X) \
+ (_FP_FRAC_HIGH_DW_##fs (X) & _FP_HIGHBIT_DW_##fs)
+#define _FP_FRAC_CLEAR_OVERP_4(fs, X) (_FP_FRAC_HIGH_##fs (X) &= ~_FP_OVERFLOW_##fs)
+
+#define _FP_FRAC_EQ_4(X, Y) \
+ (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \
+ && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])
+
+#define _FP_FRAC_GT_4(X, Y) \
+ (X##_f[3] > Y##_f[3] \
+ || (X##_f[3] == Y##_f[3] \
+ && (X##_f[2] > Y##_f[2] \
+ || (X##_f[2] == Y##_f[2] \
+ && (X##_f[1] > Y##_f[1] \
+ || (X##_f[1] == Y##_f[1] \
+ && X##_f[0] > Y##_f[0]))))))
+
+#define _FP_FRAC_GE_4(X, Y) \
+ (X##_f[3] > Y##_f[3] \
+ || (X##_f[3] == Y##_f[3] \
+ && (X##_f[2] > Y##_f[2] \
+ || (X##_f[2] == Y##_f[2] \
+ && (X##_f[1] > Y##_f[1] \
+ || (X##_f[1] == Y##_f[1] \
+ && X##_f[0] >= Y##_f[0]))))))
+
+
+#define _FP_FRAC_CLZ_4(R, X) \
+ do \
+ { \
+ if (X##_f[3]) \
+ __FP_CLZ (R, X##_f[3]); \
+ else if (X##_f[2]) \
+ { \
+ __FP_CLZ (R, X##_f[2]); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ else if (X##_f[1]) \
+ { \
+ __FP_CLZ (R, X##_f[1]); \
+ R += _FP_W_TYPE_SIZE*2; \
+ } \
+ else \
+ { \
+ __FP_CLZ (R, X##_f[0]); \
+ R += _FP_W_TYPE_SIZE*3; \
+ } \
+ } \
+ while (0)
+
+
+#define _FP_UNPACK_RAW_4(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ _flo.flt = (val); \
+ X##_f[0] = _flo.bits.frac0; \
+ X##_f[1] = _flo.bits.frac1; \
+ X##_f[2] = _flo.bits.frac2; \
+ X##_f[3] = _flo.bits.frac3; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } \
+ while (0)
+
+#define _FP_UNPACK_RAW_4_P(fs, X, val) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ X##_f[0] = _flo->bits.frac0; \
+ X##_f[1] = _flo->bits.frac1; \
+ X##_f[2] = _flo->bits.frac2; \
+ X##_f[3] = _flo->bits.frac3; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } \
+ while (0)
+
+#define _FP_PACK_RAW_4(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs _flo; \
+ _flo.bits.frac0 = X##_f[0]; \
+ _flo.bits.frac1 = X##_f[1]; \
+ _flo.bits.frac2 = X##_f[2]; \
+ _flo.bits.frac3 = X##_f[3]; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ (val) = _flo.flt; \
+ } \
+ while (0)
+
+#define _FP_PACK_RAW_4_P(fs, val, X) \
+ do \
+ { \
+ union _FP_UNION_##fs *_flo = (union _FP_UNION_##fs *) (val); \
+ \
+ _flo->bits.frac0 = X##_f[0]; \
+ _flo->bits.frac1 = X##_f[1]; \
+ _flo->bits.frac2 = X##_f[2]; \
+ _flo->bits.frac3 = X##_f[3]; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ while (0)
/*
* Multiplication algorithms:
@@ -248,200 +263,216 @@
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
-#define _FP_MUL_MEAT_DW_4_wide(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
- _FP_FRAC_DECL_2(_d); _FP_FRAC_DECL_2(_e); _FP_FRAC_DECL_2(_f); \
- \
- doit(_FP_FRAC_WORD_8(R,1), _FP_FRAC_WORD_8(R,0), X##_f[0], Y##_f[0]); \
- doit(_b_f1, _b_f0, X##_f[0], Y##_f[1]); \
- doit(_c_f1, _c_f0, X##_f[1], Y##_f[0]); \
- doit(_d_f1, _d_f0, X##_f[1], Y##_f[1]); \
- doit(_e_f1, _e_f0, X##_f[0], Y##_f[2]); \
- doit(_f_f1, _f_f0, X##_f[2], Y##_f[0]); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,3),_FP_FRAC_WORD_8(R,2), \
- _FP_FRAC_WORD_8(R,1), 0,_b_f1,_b_f0, \
- 0,0,_FP_FRAC_WORD_8(R,1)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,3),_FP_FRAC_WORD_8(R,2), \
- _FP_FRAC_WORD_8(R,1), 0,_c_f1,_c_f0, \
- _FP_FRAC_WORD_8(R,3),_FP_FRAC_WORD_8(R,2), \
- _FP_FRAC_WORD_8(R,1)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3), \
- _FP_FRAC_WORD_8(R,2), 0,_d_f1,_d_f0, \
- 0,_FP_FRAC_WORD_8(R,3),_FP_FRAC_WORD_8(R,2)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3), \
- _FP_FRAC_WORD_8(R,2), 0,_e_f1,_e_f0, \
- _FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3), \
- _FP_FRAC_WORD_8(R,2)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3), \
- _FP_FRAC_WORD_8(R,2), 0,_f_f1,_f_f0, \
- _FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3), \
- _FP_FRAC_WORD_8(R,2)); \
- doit(_b_f1, _b_f0, X##_f[0], Y##_f[3]); \
- doit(_c_f1, _c_f0, X##_f[3], Y##_f[0]); \
- doit(_d_f1, _d_f0, X##_f[1], Y##_f[2]); \
- doit(_e_f1, _e_f0, X##_f[2], Y##_f[1]); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3), 0,_b_f1,_b_f0, \
- 0,_FP_FRAC_WORD_8(R,4),_FP_FRAC_WORD_8(R,3)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3), 0,_c_f1,_c_f0, \
- _FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3), 0,_d_f1,_d_f0, \
- _FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3), 0,_e_f1,_e_f0, \
- _FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4), \
- _FP_FRAC_WORD_8(R,3)); \
- doit(_b_f1, _b_f0, X##_f[2], Y##_f[2]); \
- doit(_c_f1, _c_f0, X##_f[1], Y##_f[3]); \
- doit(_d_f1, _d_f0, X##_f[3], Y##_f[1]); \
- doit(_e_f1, _e_f0, X##_f[2], Y##_f[3]); \
- doit(_f_f1, _f_f0, X##_f[3], Y##_f[2]); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5), \
- _FP_FRAC_WORD_8(R,4), 0,_b_f1,_b_f0, \
- 0,_FP_FRAC_WORD_8(R,5),_FP_FRAC_WORD_8(R,4)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5), \
- _FP_FRAC_WORD_8(R,4), 0,_c_f1,_c_f0, \
- _FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5), \
- _FP_FRAC_WORD_8(R,4)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5), \
- _FP_FRAC_WORD_8(R,4), 0,_d_f1,_d_f0, \
- _FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5), \
- _FP_FRAC_WORD_8(R,4)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,7),_FP_FRAC_WORD_8(R,6), \
- _FP_FRAC_WORD_8(R,5), 0,_e_f1,_e_f0, \
- 0,_FP_FRAC_WORD_8(R,6),_FP_FRAC_WORD_8(R,5)); \
- __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(R,7),_FP_FRAC_WORD_8(R,6), \
- _FP_FRAC_WORD_8(R,5), 0,_f_f1,_f_f0, \
- _FP_FRAC_WORD_8(R,7),_FP_FRAC_WORD_8(R,6), \
- _FP_FRAC_WORD_8(R,5)); \
- doit(_b_f1, _b_f0, X##_f[3], Y##_f[3]); \
- __FP_FRAC_ADD_2(_FP_FRAC_WORD_8(R,7),_FP_FRAC_WORD_8(R,6), \
- _b_f1,_b_f0, \
- _FP_FRAC_WORD_8(R,7),_FP_FRAC_WORD_8(R,6)); \
- } while (0)
-
-#define _FP_MUL_MEAT_4_wide(wfracbits, R, X, Y, doit) \
- do { \
- _FP_FRAC_DECL_8(_z); \
- \
- _FP_MUL_MEAT_DW_4_wide(wfracbits, _z, X, Y, doit); \
- \
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
- __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
- _FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
- } while (0)
-
-#define _FP_MUL_MEAT_DW_4_gmp(wfracbits, R, X, Y) \
- do { \
- mpn_mul_n(R##_f, _x_f, _y_f, 4); \
- } while (0)
-
-#define _FP_MUL_MEAT_4_gmp(wfracbits, R, X, Y) \
- do { \
- _FP_FRAC_DECL_8(_z); \
- \
- _FP_MUL_MEAT_DW_4_gmp(wfracbits, _z, X, Y); \
- \
- /* Normalize since we know where the msb of the multiplicands \
- were (bit B), we know that the msb of the of the product is \
- at either 2B or 2B-1. */ \
- _FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
- __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
- _FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
- } while (0)
+#define _FP_MUL_MEAT_DW_4_wide(wfracbits, R, X, Y, doit) \
+ do \
+ { \
+ _FP_FRAC_DECL_2 (_b); \
+ _FP_FRAC_DECL_2 (_c); \
+ _FP_FRAC_DECL_2 (_d); \
+ _FP_FRAC_DECL_2 (_e); \
+ _FP_FRAC_DECL_2 (_f); \
+ \
+ doit (_FP_FRAC_WORD_8 (R, 1), _FP_FRAC_WORD_8 (R, 0), X##_f[0], Y##_f[0]); \
+ doit (_b_f1, _b_f0, X##_f[0], Y##_f[1]); \
+ doit (_c_f1, _c_f0, X##_f[1], Y##_f[0]); \
+ doit (_d_f1, _d_f0, X##_f[1], Y##_f[1]); \
+ doit (_e_f1, _e_f0, X##_f[0], Y##_f[2]); \
+ doit (_f_f1, _f_f0, X##_f[2], Y##_f[0]); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 3), _FP_FRAC_WORD_8 (R, 2), \
+ _FP_FRAC_WORD_8 (R, 1), 0, _b_f1, _b_f0, \
+ 0, 0, _FP_FRAC_WORD_8 (R, 1)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 3), _FP_FRAC_WORD_8 (R, 2), \
+ _FP_FRAC_WORD_8 (R, 1), 0, _c_f1, _c_f0, \
+ _FP_FRAC_WORD_8 (R, 3), _FP_FRAC_WORD_8 (R, 2), \
+ _FP_FRAC_WORD_8 (R, 1)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3), \
+ _FP_FRAC_WORD_8 (R, 2), 0, _d_f1, _d_f0, \
+ 0, _FP_FRAC_WORD_8 (R, 3), _FP_FRAC_WORD_8 (R, 2)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3), \
+ _FP_FRAC_WORD_8 (R, 2), 0, _e_f1, _e_f0, \
+ _FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3), \
+ _FP_FRAC_WORD_8 (R, 2)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3), \
+ _FP_FRAC_WORD_8 (R, 2), 0, _f_f1, _f_f0, \
+ _FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3), \
+ _FP_FRAC_WORD_8 (R, 2)); \
+ doit (_b_f1, _b_f0, X##_f[0], Y##_f[3]); \
+ doit (_c_f1, _c_f0, X##_f[3], Y##_f[0]); \
+ doit (_d_f1, _d_f0, X##_f[1], Y##_f[2]); \
+ doit (_e_f1, _e_f0, X##_f[2], Y##_f[1]); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3), 0, _b_f1, _b_f0, \
+ 0, _FP_FRAC_WORD_8 (R, 4), _FP_FRAC_WORD_8 (R, 3)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3), 0, _c_f1, _c_f0, \
+ _FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3), 0, _d_f1, _d_f0, \
+ _FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3), 0, _e_f1, _e_f0, \
+ _FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4), \
+ _FP_FRAC_WORD_8 (R, 3)); \
+ doit (_b_f1, _b_f0, X##_f[2], Y##_f[2]); \
+ doit (_c_f1, _c_f0, X##_f[1], Y##_f[3]); \
+ doit (_d_f1, _d_f0, X##_f[3], Y##_f[1]); \
+ doit (_e_f1, _e_f0, X##_f[2], Y##_f[3]); \
+ doit (_f_f1, _f_f0, X##_f[3], Y##_f[2]); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5), \
+ _FP_FRAC_WORD_8 (R, 4), 0, _b_f1, _b_f0, \
+ 0, _FP_FRAC_WORD_8 (R, 5), _FP_FRAC_WORD_8 (R, 4)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5), \
+ _FP_FRAC_WORD_8 (R, 4), 0, _c_f1, _c_f0, \
+ _FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5), \
+ _FP_FRAC_WORD_8 (R, 4)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5), \
+ _FP_FRAC_WORD_8 (R, 4), 0, _d_f1, _d_f0, \
+ _FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5), \
+ _FP_FRAC_WORD_8 (R, 4)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 7), _FP_FRAC_WORD_8 (R, 6), \
+ _FP_FRAC_WORD_8 (R, 5), 0, _e_f1, _e_f0, \
+ 0, _FP_FRAC_WORD_8 (R, 6), _FP_FRAC_WORD_8 (R, 5)); \
+ __FP_FRAC_ADD_3 (_FP_FRAC_WORD_8 (R, 7), _FP_FRAC_WORD_8 (R, 6), \
+ _FP_FRAC_WORD_8 (R, 5), 0, _f_f1, _f_f0, \
+ _FP_FRAC_WORD_8 (R, 7), _FP_FRAC_WORD_8 (R, 6), \
+ _FP_FRAC_WORD_8 (R, 5)); \
+ doit (_b_f1, _b_f0, X##_f[3], Y##_f[3]); \
+ __FP_FRAC_ADD_2 (_FP_FRAC_WORD_8 (R, 7), _FP_FRAC_WORD_8 (R, 6), \
+ _b_f1, _b_f0, \
+ _FP_FRAC_WORD_8 (R, 7), _FP_FRAC_WORD_8 (R, 6)); \
+ } \
+ while (0)
+
+#define _FP_MUL_MEAT_4_wide(wfracbits, R, X, Y, doit) \
+ do \
+ { \
+ _FP_FRAC_DECL_8 (_z); \
+ \
+ _FP_MUL_MEAT_DW_4_wide (wfracbits, _z, X, Y, doit); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_8 (_z, wfracbits-1, 2*wfracbits); \
+ __FP_FRAC_SET_4 (R, _FP_FRAC_WORD_8 (_z, 3), _FP_FRAC_WORD_8 (_z, 2), \
+ _FP_FRAC_WORD_8 (_z, 1), _FP_FRAC_WORD_8 (_z, 0)); \
+ } \
+ while (0)
+
+#define _FP_MUL_MEAT_DW_4_gmp(wfracbits, R, X, Y) \
+ do \
+ { \
+ mpn_mul_n (R##_f, _x_f, _y_f, 4); \
+ } \
+ while (0)
+
+#define _FP_MUL_MEAT_4_gmp(wfracbits, R, X, Y) \
+ do \
+ { \
+ _FP_FRAC_DECL_8 (_z); \
+ \
+ _FP_MUL_MEAT_DW_4_gmp (wfracbits, _z, X, Y); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_8 (_z, wfracbits-1, 2*wfracbits); \
+ __FP_FRAC_SET_4 (R, _FP_FRAC_WORD_8 (_z, 3), _FP_FRAC_WORD_8 (_z, 2), \
+ _FP_FRAC_WORD_8 (_z, 1), _FP_FRAC_WORD_8 (_z, 0)); \
+ } \
+ while (0)
/*
* Helper utility for _FP_DIV_MEAT_4_udiv:
* pppp = m * nnn
*/
-#define umul_ppppmnnn(p3,p2,p1,p0,m,n2,n1,n0) \
- do { \
- UWtype _t; \
- umul_ppmm(p1,p0,m,n0); \
- umul_ppmm(p2,_t,m,n1); \
- __FP_FRAC_ADDI_2(p2,p1,_t); \
- umul_ppmm(p3,_t,m,n2); \
- __FP_FRAC_ADDI_2(p3,p2,_t); \
- } while (0)
+#define umul_ppppmnnn(p3, p2, p1, p0, m, n2, n1, n0) \
+ do \
+ { \
+ UWtype _t; \
+ umul_ppmm (p1, p0, m, n0); \
+ umul_ppmm (p2, _t, m, n1); \
+ __FP_FRAC_ADDI_2 (p2, p1, _t); \
+ umul_ppmm (p3, _t, m, n2); \
+ __FP_FRAC_ADDI_2 (p3, p2, _t); \
+ } \
+ while (0)
/*
* Division algorithms:
*/
-#define _FP_DIV_MEAT_4_udiv(fs, R, X, Y) \
- do { \
- int _i; \
- _FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m); \
- _FP_FRAC_SET_4(_n, _FP_ZEROFRAC_4); \
- if (_FP_FRAC_GT_4(X, Y)) \
- { \
- _n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
- _FP_FRAC_SRL_4(X, 1); \
- } \
- else \
- R##_e--; \
- \
- /* Normalize, i.e. make the most significant bit of the \
- denominator set. */ \
- _FP_FRAC_SLL_4(Y, _FP_WFRACXBITS_##fs); \
- \
- for (_i = 3; ; _i--) \
- { \
- if (X##_f[3] == Y##_f[3]) \
- { \
- /* This is a special case, not an optimization \
- (X##_f[3]/Y##_f[3] would not fit into UWtype). \
- As X## is guaranteed to be < Y, R##_f[_i] can be either \
- (UWtype)-1 or (UWtype)-2. */ \
- R##_f[_i] = -1; \
- if (!_i) \
- break; \
- __FP_FRAC_SUB_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
- Y##_f[2], Y##_f[1], Y##_f[0], 0, \
- X##_f[2], X##_f[1], X##_f[0], _n_f[_i]); \
- _FP_FRAC_SUB_4(X, Y, X); \
- if (X##_f[3] > Y##_f[3]) \
- { \
- R##_f[_i] = -2; \
- _FP_FRAC_ADD_4(X, Y, X); \
- } \
- } \
- else \
- { \
- udiv_qrnnd(R##_f[_i], X##_f[3], X##_f[3], X##_f[2], Y##_f[3]); \
- umul_ppppmnnn(_m_f[3], _m_f[2], _m_f[1], _m_f[0], \
- R##_f[_i], Y##_f[2], Y##_f[1], Y##_f[0]); \
- X##_f[2] = X##_f[1]; \
- X##_f[1] = X##_f[0]; \
- X##_f[0] = _n_f[_i]; \
- if (_FP_FRAC_GT_4(_m, X)) \
- { \
- R##_f[_i]--; \
- _FP_FRAC_ADD_4(X, Y, X); \
- if (_FP_FRAC_GE_4(X, Y) && _FP_FRAC_GT_4(_m, X)) \
- { \
- R##_f[_i]--; \
- _FP_FRAC_ADD_4(X, Y, X); \
- } \
- } \
- _FP_FRAC_DEC_4(X, _m); \
- if (!_i) \
- { \
- if (!_FP_FRAC_EQ_4(X, _m)) \
- R##_f[0] |= _FP_WORK_STICKY; \
- break; \
- } \
- } \
- } \
- } while (0)
+#define _FP_DIV_MEAT_4_udiv(fs, R, X, Y) \
+ do \
+ { \
+ int _i; \
+ _FP_FRAC_DECL_4 (_n); \
+ _FP_FRAC_DECL_4 (_m); \
+ _FP_FRAC_SET_4 (_n, _FP_ZEROFRAC_4); \
+ if (_FP_FRAC_GE_4 (X, Y)) \
+ { \
+ _n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_4 (X, 1); \
+ } \
+ else \
+ R##_e--; \
+ \
+ /* Normalize, i.e. make the most significant bit of the \
+ denominator set. */ \
+ _FP_FRAC_SLL_4 (Y, _FP_WFRACXBITS_##fs); \
+ \
+ for (_i = 3; ; _i--) \
+ { \
+ if (X##_f[3] == Y##_f[3]) \
+ { \
+ /* This is a special case, not an optimization \
+ (X##_f[3]/Y##_f[3] would not fit into UWtype). \
+ As X## is guaranteed to be < Y, R##_f[_i] can be either \
+ (UWtype)-1 or (UWtype)-2. */ \
+ R##_f[_i] = -1; \
+ if (!_i) \
+ break; \
+ __FP_FRAC_SUB_4 (X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[2], Y##_f[1], Y##_f[0], 0, \
+ X##_f[2], X##_f[1], X##_f[0], _n_f[_i]); \
+ _FP_FRAC_SUB_4 (X, Y, X); \
+ if (X##_f[3] > Y##_f[3]) \
+ { \
+ R##_f[_i] = -2; \
+ _FP_FRAC_ADD_4 (X, Y, X); \
+ } \
+ } \
+ else \
+ { \
+ udiv_qrnnd (R##_f[_i], X##_f[3], X##_f[3], X##_f[2], Y##_f[3]); \
+ umul_ppppmnnn (_m_f[3], _m_f[2], _m_f[1], _m_f[0], \
+ R##_f[_i], Y##_f[2], Y##_f[1], Y##_f[0]); \
+ X##_f[2] = X##_f[1]; \
+ X##_f[1] = X##_f[0]; \
+ X##_f[0] = _n_f[_i]; \
+ if (_FP_FRAC_GT_4 (_m, X)) \
+ { \
+ R##_f[_i]--; \
+ _FP_FRAC_ADD_4 (X, Y, X); \
+ if (_FP_FRAC_GE_4 (X, Y) && _FP_FRAC_GT_4 (_m, X)) \
+ { \
+ R##_f[_i]--; \
+ _FP_FRAC_ADD_4 (X, Y, X); \
+ } \
+ } \
+ _FP_FRAC_DEC_4 (X, _m); \
+ if (!_i) \
+ { \
+ if (!_FP_FRAC_EQ_4 (X, _m)) \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ break; \
+ } \
+ } \
+ } \
+ } \
+ while (0)
/*
@@ -450,183 +481,203 @@
* should be added for those machines where division is fast.
*/
-#define _FP_SQRT_MEAT_4(R, S, T, X, q) \
- do { \
- while (q) \
- { \
- T##_f[3] = S##_f[3] + q; \
- if (T##_f[3] <= X##_f[3]) \
- { \
- S##_f[3] = T##_f[3] + q; \
- X##_f[3] -= T##_f[3]; \
- R##_f[3] += q; \
- } \
- _FP_FRAC_SLL_4(X, 1); \
- q >>= 1; \
- } \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- while (q) \
- { \
- T##_f[2] = S##_f[2] + q; \
- T##_f[3] = S##_f[3]; \
- if (T##_f[3] < X##_f[3] || \
- (T##_f[3] == X##_f[3] && T##_f[2] <= X##_f[2])) \
- { \
- S##_f[2] = T##_f[2] + q; \
- S##_f[3] += (T##_f[2] > S##_f[2]); \
- __FP_FRAC_DEC_2(X##_f[3], X##_f[2], \
- T##_f[3], T##_f[2]); \
- R##_f[2] += q; \
- } \
- _FP_FRAC_SLL_4(X, 1); \
- q >>= 1; \
- } \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- while (q) \
- { \
- T##_f[1] = S##_f[1] + q; \
- T##_f[2] = S##_f[2]; \
- T##_f[3] = S##_f[3]; \
- if (T##_f[3] < X##_f[3] || \
- (T##_f[3] == X##_f[3] && (T##_f[2] < X##_f[2] || \
- (T##_f[2] == X##_f[2] && T##_f[1] <= X##_f[1])))) \
- { \
- S##_f[1] = T##_f[1] + q; \
- S##_f[2] += (T##_f[1] > S##_f[1]); \
- S##_f[3] += (T##_f[2] > S##_f[2]); \
- __FP_FRAC_DEC_3(X##_f[3], X##_f[2], X##_f[1], \
- T##_f[3], T##_f[2], T##_f[1]); \
- R##_f[1] += q; \
- } \
- _FP_FRAC_SLL_4(X, 1); \
- q >>= 1; \
- } \
- q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
- while (q != _FP_WORK_ROUND) \
- { \
- T##_f[0] = S##_f[0] + q; \
- T##_f[1] = S##_f[1]; \
- T##_f[2] = S##_f[2]; \
- T##_f[3] = S##_f[3]; \
- if (_FP_FRAC_GE_4(X,T)) \
- { \
- S##_f[0] = T##_f[0] + q; \
- S##_f[1] += (T##_f[0] > S##_f[0]); \
- S##_f[2] += (T##_f[1] > S##_f[1]); \
- S##_f[3] += (T##_f[2] > S##_f[2]); \
- _FP_FRAC_DEC_4(X, T); \
- R##_f[0] += q; \
- } \
- _FP_FRAC_SLL_4(X, 1); \
- q >>= 1; \
- } \
- if (!_FP_FRAC_ZEROP_4(X)) \
- { \
- if (_FP_FRAC_GT_4(X,S)) \
- R##_f[0] |= _FP_WORK_ROUND; \
- R##_f[0] |= _FP_WORK_STICKY; \
- } \
- } while (0)
+#define _FP_SQRT_MEAT_4(R, S, T, X, q) \
+ do \
+ { \
+ while (q) \
+ { \
+ T##_f[3] = S##_f[3] + q; \
+ if (T##_f[3] <= X##_f[3]) \
+ { \
+ S##_f[3] = T##_f[3] + q; \
+ X##_f[3] -= T##_f[3]; \
+ R##_f[3] += q; \
+ } \
+ _FP_FRAC_SLL_4 (X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[2] = S##_f[2] + q; \
+ T##_f[3] = S##_f[3]; \
+ if (T##_f[3] < X##_f[3] \
+ || (T##_f[3] == X##_f[3] && T##_f[2] <= X##_f[2])) \
+ { \
+ S##_f[2] = T##_f[2] + q; \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ __FP_FRAC_DEC_2 (X##_f[3], X##_f[2], \
+ T##_f[3], T##_f[2]); \
+ R##_f[2] += q; \
+ } \
+ _FP_FRAC_SLL_4 (X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[1] = S##_f[1] + q; \
+ T##_f[2] = S##_f[2]; \
+ T##_f[3] = S##_f[3]; \
+ if (T##_f[3] < X##_f[3] \
+ || (T##_f[3] == X##_f[3] \
+ && (T##_f[2] < X##_f[2] \
+ || (T##_f[2] == X##_f[2] \
+ && T##_f[1] <= X##_f[1])))) \
+ { \
+ S##_f[1] = T##_f[1] + q; \
+ S##_f[2] += (T##_f[1] > S##_f[1]); \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ __FP_FRAC_DEC_3 (X##_f[3], X##_f[2], X##_f[1], \
+ T##_f[3], T##_f[2], T##_f[1]); \
+ R##_f[1] += q; \
+ } \
+ _FP_FRAC_SLL_4 (X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f[0] = S##_f[0] + q; \
+ T##_f[1] = S##_f[1]; \
+ T##_f[2] = S##_f[2]; \
+ T##_f[3] = S##_f[3]; \
+ if (_FP_FRAC_GE_4 (X, T)) \
+ { \
+ S##_f[0] = T##_f[0] + q; \
+ S##_f[1] += (T##_f[0] > S##_f[0]); \
+ S##_f[2] += (T##_f[1] > S##_f[1]); \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ _FP_FRAC_DEC_4 (X, T); \
+ R##_f[0] += q; \
+ } \
+ _FP_FRAC_SLL_4 (X, 1); \
+ q >>= 1; \
+ } \
+ if (!_FP_FRAC_ZEROP_4 (X)) \
+ { \
+ if (_FP_FRAC_GT_4 (X, S)) \
+ R##_f[0] |= _FP_WORK_ROUND; \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ } \
+ } \
+ while (0)
/*
* Internals
*/
-#define __FP_FRAC_SET_4(X,I3,I2,I1,I0) \
+#define __FP_FRAC_SET_4(X, I3, I2, I1, I0) \
(X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
#ifndef __FP_FRAC_ADD_3
-#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
- do { \
- _FP_W_TYPE __FP_FRAC_ADD_3_c1, __FP_FRAC_ADD_3_c2; \
- r0 = x0 + y0; \
- __FP_FRAC_ADD_3_c1 = r0 < x0; \
- r1 = x1 + y1; \
- __FP_FRAC_ADD_3_c2 = r1 < x1; \
- r1 += __FP_FRAC_ADD_3_c1; \
- __FP_FRAC_ADD_3_c2 |= r1 < __FP_FRAC_ADD_3_c1; \
- r2 = x2 + y2 + __FP_FRAC_ADD_3_c2; \
- } while (0)
+# define __FP_FRAC_ADD_3(r2, r1, r0, x2, x1, x0, y2, y1, y0) \
+ do \
+ { \
+ _FP_W_TYPE __FP_FRAC_ADD_3_c1, __FP_FRAC_ADD_3_c2; \
+ r0 = x0 + y0; \
+ __FP_FRAC_ADD_3_c1 = r0 < x0; \
+ r1 = x1 + y1; \
+ __FP_FRAC_ADD_3_c2 = r1 < x1; \
+ r1 += __FP_FRAC_ADD_3_c1; \
+ __FP_FRAC_ADD_3_c2 |= r1 < __FP_FRAC_ADD_3_c1; \
+ r2 = x2 + y2 + __FP_FRAC_ADD_3_c2; \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_ADD_4
-#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
- do { \
- _FP_W_TYPE _c1, _c2, _c3; \
- r0 = x0 + y0; \
- _c1 = r0 < x0; \
- r1 = x1 + y1; \
- _c2 = r1 < x1; \
- r1 += _c1; \
- _c2 |= r1 < _c1; \
- r2 = x2 + y2; \
- _c3 = r2 < x2; \
- r2 += _c2; \
- _c3 |= r2 < _c2; \
- r3 = x3 + y3 + _c3; \
- } while (0)
+# define __FP_FRAC_ADD_4(r3, r2, r1, r0, x3, x2, x1, x0, y3, y2, y1, y0) \
+ do \
+ { \
+ _FP_W_TYPE _c1, _c2, _c3; \
+ r0 = x0 + y0; \
+ _c1 = r0 < x0; \
+ r1 = x1 + y1; \
+ _c2 = r1 < x1; \
+ r1 += _c1; \
+ _c2 |= r1 < _c1; \
+ r2 = x2 + y2; \
+ _c3 = r2 < x2; \
+ r2 += _c2; \
+ _c3 |= r2 < _c2; \
+ r3 = x3 + y3 + _c3; \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_SUB_3
-#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
- do { \
- _FP_W_TYPE _c1, _c2; \
- r0 = x0 - y0; \
- _c1 = r0 > x0; \
- r1 = x1 - y1; \
- _c2 = r1 > x1; \
- r1 -= _c1; \
- _c2 |= _c1 && (y1 == x1); \
- r2 = x2 - y2 - _c2; \
- } while (0)
+# define __FP_FRAC_SUB_3(r2, r1, r0, x2, x1, x0, y2, y1, y0) \
+ do \
+ { \
+ _FP_W_TYPE _c1, _c2; \
+ r0 = x0 - y0; \
+ _c1 = r0 > x0; \
+ r1 = x1 - y1; \
+ _c2 = r1 > x1; \
+ r1 -= _c1; \
+ _c2 |= _c1 && (y1 == x1); \
+ r2 = x2 - y2 - _c2; \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_SUB_4
-#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
- do { \
- _FP_W_TYPE _c1, _c2, _c3; \
- r0 = x0 - y0; \
- _c1 = r0 > x0; \
- r1 = x1 - y1; \
- _c2 = r1 > x1; \
- r1 -= _c1; \
- _c2 |= _c1 && (y1 == x1); \
- r2 = x2 - y2; \
- _c3 = r2 > x2; \
- r2 -= _c2; \
- _c3 |= _c2 && (y2 == x2); \
- r3 = x3 - y3 - _c3; \
- } while (0)
+# define __FP_FRAC_SUB_4(r3, r2, r1, r0, x3, x2, x1, x0, y3, y2, y1, y0) \
+ do \
+ { \
+ _FP_W_TYPE _c1, _c2, _c3; \
+ r0 = x0 - y0; \
+ _c1 = r0 > x0; \
+ r1 = x1 - y1; \
+ _c2 = r1 > x1; \
+ r1 -= _c1; \
+ _c2 |= _c1 && (y1 == x1); \
+ r2 = x2 - y2; \
+ _c3 = r2 > x2; \
+ r2 -= _c2; \
+ _c3 |= _c2 && (y2 == x2); \
+ r3 = x3 - y3 - _c3; \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_DEC_3
-#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) \
- do { \
- UWtype _t0, _t1, _t2; \
- _t0 = x0, _t1 = x1, _t2 = x2; \
- __FP_FRAC_SUB_3 (x2, x1, x0, _t2, _t1, _t0, y2, y1, y0); \
- } while (0)
+# define __FP_FRAC_DEC_3(x2, x1, x0, y2, y1, y0) \
+ do \
+ { \
+ UWtype _t0, _t1, _t2; \
+ _t0 = x0, _t1 = x1, _t2 = x2; \
+ __FP_FRAC_SUB_3 (x2, x1, x0, _t2, _t1, _t0, y2, y1, y0); \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_DEC_4
-#define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) \
- do { \
- UWtype _t0, _t1, _t2, _t3; \
- _t0 = x0, _t1 = x1, _t2 = x2, _t3 = x3; \
- __FP_FRAC_SUB_4 (x3,x2,x1,x0,_t3,_t2,_t1,_t0, y3,y2,y1,y0); \
- } while (0)
+# define __FP_FRAC_DEC_4(x3, x2, x1, x0, y3, y2, y1, y0) \
+ do \
+ { \
+ UWtype _t0, _t1, _t2, _t3; \
+ _t0 = x0, _t1 = x1, _t2 = x2, _t3 = x3; \
+ __FP_FRAC_SUB_4 (x3, x2, x1, x0, _t3, _t2, _t1, _t0, y3, y2, y1, y0); \
+ } \
+ while (0)
#endif
#ifndef __FP_FRAC_ADDI_4
-#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \
- do { \
- UWtype _t; \
- _t = ((x0 += i) < i); \
- x1 += _t; _t = (x1 < _t); \
- x2 += _t; _t = (x2 < _t); \
- x3 += _t; \
- } while (0)
+# define __FP_FRAC_ADDI_4(x3, x2, x1, x0, i) \
+ do \
+ { \
+ UWtype _t; \
+ _t = ((x0 += i) < i); \
+ x1 += _t; \
+ _t = (x1 < _t); \
+ x2 += _t; \
+ _t = (x2 < _t); \
+ x3 += _t; \
+ } \
+ while (0)
#endif
/* Convert FP values between word sizes. This appears to be more
@@ -639,38 +690,42 @@
#define _FP_FRAC_COPY_1_4(D, S) (D##_f = S##_f[0])
#define _FP_FRAC_COPY_2_4(D, S) \
-do { \
- D##_f0 = S##_f[0]; \
- D##_f1 = S##_f[1]; \
-} while (0)
+ do \
+ { \
+ D##_f0 = S##_f[0]; \
+ D##_f1 = S##_f[1]; \
+ } \
+ while (0)
/* Assembly/disassembly for converting to/from integral types.
* No shifting or overflow handled here.
*/
/* Put the FP value X into r, which is an integer of size rsize. */
#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
- do { \
- if (rsize <= _FP_W_TYPE_SIZE) \
- r = X##_f[0]; \
- else if (rsize <= 2*_FP_W_TYPE_SIZE) \
- { \
- r = X##_f[1]; \
- r <<= _FP_W_TYPE_SIZE; \
- r += X##_f[0]; \
- } \
- else \
+ do \
{ \
- /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
- /* and int == 4words as a single case. */ \
- r = X##_f[3]; \
- r <<= _FP_W_TYPE_SIZE; \
- r += X##_f[2]; \
- r <<= _FP_W_TYPE_SIZE; \
- r += X##_f[1]; \
- r <<= _FP_W_TYPE_SIZE; \
- r += X##_f[0]; \
+ if (rsize <= _FP_W_TYPE_SIZE) \
+ r = X##_f[0]; \
+ else if (rsize <= 2*_FP_W_TYPE_SIZE) \
+ { \
+ r = X##_f[1]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[0]; \
+ } \
+ else \
+ { \
+ /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
+ /* and int == 4words as a single case. */ \
+ r = X##_f[3]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[2]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[1]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[0]; \
+ } \
} \
- } while (0)
+ while (0)
/* "No disassemble Number Five!" */
/* move an integer of size rsize into X's fractional part. We rely on
@@ -678,24 +733,30 @@ do { \
* having to mask the values we store into it.
*/
#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
- do { \
- X##_f[0] = r; \
- X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
- X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \
- X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \
- } while (0);
+ do \
+ { \
+ X##_f[0] = r; \
+ X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
+ X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \
+ X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \
+ } \
+ while (0)
#define _FP_FRAC_COPY_4_1(D, S) \
-do { \
- D##_f[0] = S##_f; \
- D##_f[1] = D##_f[2] = D##_f[3] = 0; \
-} while (0)
+ do \
+ { \
+ D##_f[0] = S##_f; \
+ D##_f[1] = D##_f[2] = D##_f[3] = 0; \
+ } \
+ while (0)
#define _FP_FRAC_COPY_4_2(D, S) \
-do { \
- D##_f[0] = S##_f0; \
- D##_f[1] = S##_f1; \
- D##_f[2] = D##_f[3] = 0; \
-} while (0)
-
-#define _FP_FRAC_COPY_4_4(D,S) _FP_FRAC_COPY_4(D,S)
+ do \
+ { \
+ D##_f[0] = S##_f0; \
+ D##_f[1] = S##_f1; \
+ D##_f[2] = D##_f[3] = 0; \
+ } \
+ while (0)
+
+#define _FP_FRAC_COPY_4_4(D, S) _FP_FRAC_COPY_4 (D, S)
diff --git a/libc/soft-fp/op-8.h b/libc/soft-fp/op-8.h
index 8890d0220..f1b23db80 100644
--- a/libc/soft-fp/op-8.h
+++ b/libc/soft-fp/op-8.h
@@ -34,47 +34,51 @@
#define _FP_FRAC_DECL_8(X) _FP_W_TYPE X##_f[8]
#define _FP_FRAC_HIGH_8(X) (X##_f[7])
#define _FP_FRAC_LOW_8(X) (X##_f[0])
-#define _FP_FRAC_WORD_8(X,w) (X##_f[w])
+#define _FP_FRAC_WORD_8(X, w) (X##_f[w])
-#define _FP_FRAC_SLL_8(X,N) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _up = (N) % _FP_W_TYPE_SIZE; \
- _down = _FP_W_TYPE_SIZE - _up; \
- if (!_up) \
- for (_i = 7; _i >= _skip; --_i) \
- X##_f[_i] = X##_f[_i-_skip]; \
- else \
- { \
- for (_i = 7; _i > _skip; --_i) \
- X##_f[_i] = X##_f[_i-_skip] << _up \
- | X##_f[_i-_skip-1] >> _down; \
- X##_f[_i--] = X##_f[0] << _up; \
- } \
- for (; _i >= 0; --_i) \
- X##_f[_i] = 0; \
- } while (0)
+#define _FP_FRAC_SLL_8(X, N) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _up = (N) % _FP_W_TYPE_SIZE; \
+ _down = _FP_W_TYPE_SIZE - _up; \
+ if (!_up) \
+ for (_i = 7; _i >= _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip]; \
+ else \
+ { \
+ for (_i = 7; _i > _skip; --_i) \
+ X##_f[_i] = (X##_f[_i-_skip] << _up \
+ | X##_f[_i-_skip-1] >> _down); \
+ X##_f[_i--] = X##_f[0] << _up; \
+ } \
+ for (; _i >= 0; --_i) \
+ X##_f[_i] = 0; \
+ } \
+ while (0)
-#define _FP_FRAC_SRL_8(X,N) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _down = (N) % _FP_W_TYPE_SIZE; \
- _up = _FP_W_TYPE_SIZE - _down; \
- if (!_down) \
- for (_i = 0; _i <= 7-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip]; \
- else \
- { \
- for (_i = 0; _i < 7-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip] >> _down \
- | X##_f[_i+_skip+1] << _up; \
- X##_f[_i++] = X##_f[7] >> _down; \
- } \
- for (; _i < 8; ++_i) \
- X##_f[_i] = 0; \
- } while (0)
+#define _FP_FRAC_SRL_8(X, N) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ if (!_down) \
+ for (_i = 0; _i <= 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 7-_skip; ++_i) \
+ X##_f[_i] = (X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up); \
+ X##_f[_i++] = X##_f[7] >> _down; \
+ } \
+ for (; _i < 8; ++_i) \
+ X##_f[_i] = 0; \
+ } \
+ while (0)
/* Right shift with sticky-lsb.
@@ -82,28 +86,31 @@
* but that if any of the bits that fall off the right hand side
* were one then we always set the LSbit.
*/
-#define _FP_FRAC_SRS_8(X,N,size) \
- do { \
- _FP_I_TYPE _up, _down, _skip, _i; \
- _FP_W_TYPE _s; \
- _skip = (N) / _FP_W_TYPE_SIZE; \
- _down = (N) % _FP_W_TYPE_SIZE; \
- _up = _FP_W_TYPE_SIZE - _down; \
- for (_s = _i = 0; _i < _skip; ++_i) \
- _s |= X##_f[_i]; \
- if (!_down) \
- for (_i = 0; _i <= 7-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip]; \
- else \
- { \
- _s |= X##_f[_i] << _up; \
- for (_i = 0; _i < 7-_skip; ++_i) \
- X##_f[_i] = X##_f[_i+_skip] >> _down \
- | X##_f[_i+_skip+1] << _up; \
- X##_f[_i++] = X##_f[7] >> _down; \
- } \
- for (; _i < 8; ++_i) \
- X##_f[_i] = 0; \
- /* don't fix the LSB until the very end when we're sure f[0] is stable */ \
- X##_f[0] |= (_s != 0); \
- } while (0)
+#define _FP_FRAC_SRS_8(X, N, size) \
+ do \
+ { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _FP_W_TYPE _s; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ for (_s = _i = 0; _i < _skip; ++_i) \
+ _s |= X##_f[_i]; \
+ if (!_down) \
+ for (_i = 0; _i <= 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ _s |= X##_f[_i] << _up; \
+ for (_i = 0; _i < 7-_skip; ++_i) \
+ X##_f[_i] = (X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up); \
+ X##_f[_i++] = X##_f[7] >> _down; \
+ } \
+ for (; _i < 8; ++_i) \
+ X##_f[_i] = 0; \
+ /* don't fix the LSB until the very end when we're sure f[0] is \
+ stable */ \
+ X##_f[0] |= (_s != 0); \
+ } \
+ while (0)
diff --git a/libc/soft-fp/op-common.h b/libc/soft-fp/op-common.h
index bed1e21fd..67cdc33b4 100644
--- a/libc/soft-fp/op-common.h
+++ b/libc/soft-fp/op-common.h
@@ -30,145 +30,157 @@
<http://www.gnu.org/licenses/>. */
#define _FP_DECL(wc, X) \
- _FP_I_TYPE X##_c __attribute__((unused)); \
- _FP_I_TYPE X##_s __attribute__((unused)); \
+ _FP_I_TYPE X##_c __attribute__ ((unused)); \
+ _FP_I_TYPE X##_s __attribute__ ((unused)); \
_FP_I_TYPE X##_e; \
- _FP_FRAC_DECL_##wc(X)
+ _FP_FRAC_DECL_##wc (X)
/* Test whether the qNaN bit denotes a signaling NaN. */
-#define _FP_FRAC_SNANP(fs, X) \
- ((_FP_QNANNEGATEDP) \
- ? (_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
- : !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs))
-#define _FP_FRAC_SNANP_SEMIRAW(fs, X) \
- ((_FP_QNANNEGATEDP) \
- ? (_FP_FRAC_HIGH_##fs(X) & _FP_QNANBIT_SH_##fs) \
- : !(_FP_FRAC_HIGH_##fs(X) & _FP_QNANBIT_SH_##fs))
+#define _FP_FRAC_SNANP(fs, X) \
+ ((_FP_QNANNEGATEDP) \
+ ? (_FP_FRAC_HIGH_RAW_##fs (X) & _FP_QNANBIT_##fs) \
+ : !(_FP_FRAC_HIGH_RAW_##fs (X) & _FP_QNANBIT_##fs))
+#define _FP_FRAC_SNANP_SEMIRAW(fs, X) \
+ ((_FP_QNANNEGATEDP) \
+ ? (_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs) \
+ : !(_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs))
/*
- * Finish truely unpacking a native fp value by classifying the kind
+ * Finish truly unpacking a native fp value by classifying the kind
* of fp value and normalizing both the exponent and the fraction.
*/
-#define _FP_UNPACK_CANONICAL(fs, wc, X) \
-do { \
- switch (X##_e) \
- { \
- default: \
- _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_IMPLBIT_##fs; \
- _FP_FRAC_SLL_##wc(X, _FP_WORKBITS); \
- X##_e -= _FP_EXPBIAS_##fs; \
- X##_c = FP_CLS_NORMAL; \
- break; \
- \
- case 0: \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- X##_c = FP_CLS_ZERO; \
- else \
- { \
- /* a denormalized number */ \
- _FP_I_TYPE _shift; \
- _FP_FRAC_CLZ_##wc(_shift, X); \
- _shift -= _FP_FRACXBITS_##fs; \
- _FP_FRAC_SLL_##wc(X, (_shift+_FP_WORKBITS)); \
- X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \
- X##_c = FP_CLS_NORMAL; \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- } \
- break; \
- \
- case _FP_EXPMAX_##fs: \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- X##_c = FP_CLS_INF; \
- else \
- { \
- X##_c = FP_CLS_NAN; \
- /* Check for signaling NaN */ \
- if (_FP_FRAC_SNANP(fs, X)) \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- } \
- break; \
- } \
-} while (0)
+#define _FP_UNPACK_CANONICAL(fs, wc, X) \
+ do \
+ { \
+ switch (X##_e) \
+ { \
+ default: \
+ _FP_FRAC_HIGH_RAW_##fs (X) |= _FP_IMPLBIT_##fs; \
+ _FP_FRAC_SLL_##wc (X, _FP_WORKBITS); \
+ X##_e -= _FP_EXPBIAS_##fs; \
+ X##_c = FP_CLS_NORMAL; \
+ break; \
+ \
+ case 0: \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ X##_c = FP_CLS_ZERO; \
+ else \
+ { \
+ /* a denormalized number */ \
+ _FP_I_TYPE _shift; \
+ _FP_FRAC_CLZ_##wc (_shift, X); \
+ _shift -= _FP_FRACXBITS_##fs; \
+ _FP_FRAC_SLL_##wc (X, (_shift+_FP_WORKBITS)); \
+ X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \
+ X##_c = FP_CLS_NORMAL; \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ } \
+ break; \
+ \
+ case _FP_EXPMAX_##fs: \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ X##_c = FP_CLS_INF; \
+ else \
+ { \
+ X##_c = FP_CLS_NAN; \
+ /* Check for signaling NaN */ \
+ if (_FP_FRAC_SNANP (fs, X)) \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ } \
+ break; \
+ } \
+ } \
+ while (0)
/* Finish unpacking an fp value in semi-raw mode: the mantissa is
shifted by _FP_WORKBITS but the implicit MSB is not inserted and
other classification is not done. */
-#define _FP_UNPACK_SEMIRAW(fs, wc, X) _FP_FRAC_SLL_##wc(X, _FP_WORKBITS)
+#define _FP_UNPACK_SEMIRAW(fs, wc, X) _FP_FRAC_SLL_##wc (X, _FP_WORKBITS)
/* A semi-raw value has overflowed to infinity. Adjust the mantissa
and exponent appropriately. */
#define _FP_OVERFLOW_SEMIRAW(fs, wc, X) \
-do { \
- if (FP_ROUNDMODE == FP_RND_NEAREST \
- || (FP_ROUNDMODE == FP_RND_PINF && !X##_s) \
- || (FP_ROUNDMODE == FP_RND_MINF && X##_s)) \
+ do \
{ \
- X##_e = _FP_EXPMAX_##fs; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ if (FP_ROUNDMODE == FP_RND_NEAREST \
+ || (FP_ROUNDMODE == FP_RND_PINF && !X##_s) \
+ || (FP_ROUNDMODE == FP_RND_MINF && X##_s)) \
+ { \
+ X##_e = _FP_EXPMAX_##fs; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
+ } \
+ else \
+ { \
+ X##_e = _FP_EXPMAX_##fs - 1; \
+ _FP_FRAC_SET_##wc (X, _FP_MAXFRAC_##wc); \
+ } \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ FP_SET_EXCEPTION (FP_EX_OVERFLOW); \
} \
- else \
- { \
- X##_e = _FP_EXPMAX_##fs - 1; \
- _FP_FRAC_SET_##wc(X, _FP_MAXFRAC_##wc); \
- } \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
-} while (0)
+ while (0)
/* Check for a semi-raw value being a signaling NaN and raise the
invalid exception if so. */
-#define _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X) \
-do { \
- if (X##_e == _FP_EXPMAX_##fs \
- && !_FP_FRAC_ZEROP_##wc(X) \
- && _FP_FRAC_SNANP_SEMIRAW(fs, X)) \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
-} while (0)
+#define _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X) \
+ do \
+ { \
+ if (X##_e == _FP_EXPMAX_##fs \
+ && !_FP_FRAC_ZEROP_##wc (X) \
+ && _FP_FRAC_SNANP_SEMIRAW (fs, X)) \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ } \
+ while (0)
/* Choose a NaN result from an operation on two semi-raw NaN
values. */
#define _FP_CHOOSENAN_SEMIRAW(fs, wc, R, X, Y, OP) \
-do { \
- /* _FP_CHOOSENAN expects raw values, so shift as required. */ \
- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- _FP_FRAC_SRL_##wc(Y, _FP_WORKBITS); \
- _FP_CHOOSENAN(fs, wc, R, X, Y, OP); \
- _FP_FRAC_SLL_##wc(R, _FP_WORKBITS); \
-} while (0)
+ do \
+ { \
+ /* _FP_CHOOSENAN expects raw values, so shift as required. */ \
+ _FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
+ _FP_FRAC_SRL_##wc (Y, _FP_WORKBITS); \
+ _FP_CHOOSENAN (fs, wc, R, X, Y, OP); \
+ _FP_FRAC_SLL_##wc (R, _FP_WORKBITS); \
+ } \
+ while (0)
/* Make the fractional part a quiet NaN, preserving the payload
if possible, otherwise make it the canonical quiet NaN and set
the sign bit accordingly. */
-#define _FP_SETQNAN(fs, wc, X) \
-do { \
- if (_FP_QNANNEGATEDP) \
- { \
- _FP_FRAC_HIGH_RAW_##fs(X) &= _FP_QNANBIT_##fs - 1; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- X##_s = _FP_NANSIGN_##fs; \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- } \
- } \
- else \
- _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
-} while (0)
-#define _FP_SETQNAN_SEMIRAW(fs, wc, X) \
-do { \
- if (_FP_QNANNEGATEDP) \
- { \
- _FP_FRAC_HIGH_##fs(X) &= _FP_QNANBIT_SH_##fs - 1; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- X##_s = _FP_NANSIGN_##fs; \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- _FP_FRAC_SLL_##wc(X, _FP_WORKBITS); \
- } \
- } \
- else \
- _FP_FRAC_HIGH_##fs(X) |= _FP_QNANBIT_SH_##fs; \
-} while (0)
+#define _FP_SETQNAN(fs, wc, X) \
+ do \
+ { \
+ if (_FP_QNANNEGATEDP) \
+ { \
+ _FP_FRAC_HIGH_RAW_##fs (X) &= _FP_QNANBIT_##fs - 1; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ X##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_SET_##wc (X, _FP_NANFRAC_##fs); \
+ } \
+ } \
+ else \
+ _FP_FRAC_HIGH_RAW_##fs (X) |= _FP_QNANBIT_##fs; \
+ } \
+ while (0)
+#define _FP_SETQNAN_SEMIRAW(fs, wc, X) \
+ do \
+ { \
+ if (_FP_QNANNEGATEDP) \
+ { \
+ _FP_FRAC_HIGH_##fs (X) &= _FP_QNANBIT_SH_##fs - 1; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ X##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_SET_##wc (X, _FP_NANFRAC_##fs); \
+ _FP_FRAC_SLL_##wc (X, _FP_WORKBITS); \
+ } \
+ } \
+ else \
+ _FP_FRAC_HIGH_##fs (X) |= _FP_QNANBIT_SH_##fs; \
+ } \
+ while (0)
/* Test whether a biased exponent is normal (not zero or maximum). */
#define _FP_EXP_NORMAL(fs, wc, X) (((X##_e + 1) & _FP_EXPMAX_##fs) > 1)
@@ -177,34 +189,36 @@ do { \
rounded and shifted right, with the rounding possibly increasing
the exponent (including changing a finite value to infinity). */
#define _FP_PACK_SEMIRAW(fs, wc, X) \
-do { \
- _FP_ROUND(wc, X); \
- if (X##_e == 0 && !_FP_FRAC_ZEROP_##wc(X)) \
- { \
+ do \
+ { \
+ _FP_ROUND (wc, X); \
+ if (X##_e == 0 && !_FP_FRAC_ZEROP_##wc (X)) \
+ { \
if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
|| (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
- } \
- if (_FP_FRAC_HIGH_##fs(X) \
- & (_FP_OVERFLOW_##fs >> 1)) \
- { \
- _FP_FRAC_HIGH_##fs(X) &= ~(_FP_OVERFLOW_##fs >> 1); \
- X##_e++; \
- if (X##_e == _FP_EXPMAX_##fs) \
- _FP_OVERFLOW_SEMIRAW(fs, wc, X); \
- } \
- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- if (X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
- { \
- if (!_FP_KEEPNANFRACP) \
+ FP_SET_EXCEPTION (FP_EX_UNDERFLOW); \
+ } \
+ if (_FP_FRAC_HIGH_##fs (X) \
+ & (_FP_OVERFLOW_##fs >> 1)) \
{ \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- X##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_HIGH_##fs (X) &= ~(_FP_OVERFLOW_##fs >> 1); \
+ X##_e++; \
+ if (X##_e == _FP_EXPMAX_##fs) \
+ _FP_OVERFLOW_SEMIRAW (fs, wc, X); \
+ } \
+ _FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
+ if (X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ if (!_FP_KEEPNANFRACP) \
+ { \
+ _FP_FRAC_SET_##wc (X, _FP_NANFRAC_##fs); \
+ X##_s = _FP_NANSIGN_##fs; \
+ } \
+ else \
+ _FP_SETQNAN (fs, wc, X); \
} \
- else \
- _FP_SETQNAN(fs, wc, X); \
} \
-} while (0)
+ while (0)
/*
* Before packing the bits back into the native fp result, take care
@@ -213,912 +227,927 @@ do { \
* extracted -- but that is ok, we can regenerate them now.
*/
-#define _FP_PACK_CANONICAL(fs, wc, X) \
-do { \
- switch (X##_c) \
- { \
- case FP_CLS_NORMAL: \
- X##_e += _FP_EXPBIAS_##fs; \
- if (X##_e > 0) \
- { \
- _FP_ROUND(wc, X); \
- if (_FP_FRAC_OVERP_##wc(fs, X)) \
- { \
- _FP_FRAC_CLEAR_OVERP_##wc(fs, X); \
- X##_e++; \
- } \
- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- if (X##_e >= _FP_EXPMAX_##fs) \
- { \
- /* overflow */ \
- switch (FP_ROUNDMODE) \
- { \
- case FP_RND_NEAREST: \
- X##_c = FP_CLS_INF; \
- break; \
- case FP_RND_PINF: \
- if (!X##_s) X##_c = FP_CLS_INF; \
- break; \
- case FP_RND_MINF: \
- if (X##_s) X##_c = FP_CLS_INF; \
- break; \
- } \
- if (X##_c == FP_CLS_INF) \
- { \
- /* Overflow to infinity */ \
- X##_e = _FP_EXPMAX_##fs; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
- } \
- else \
- { \
- /* Overflow to maximum normal */ \
- X##_e = _FP_EXPMAX_##fs - 1; \
- _FP_FRAC_SET_##wc(X, _FP_MAXFRAC_##wc); \
- } \
- FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- } \
- } \
- else \
- { \
- /* we've got a denormalized number */ \
- X##_e = -X##_e + 1; \
- if (X##_e <= _FP_WFRACBITS_##fs) \
- { \
- _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
- _FP_ROUND(wc, X); \
- if (_FP_FRAC_HIGH_##fs(X) \
- & (_FP_OVERFLOW_##fs >> 1)) \
- { \
- X##_e = 1; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- } \
- else \
- { \
- X##_e = 0; \
- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- } \
- if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
- || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
- } \
- else \
- { \
- /* underflow to zero */ \
- X##_e = 0; \
- if (!_FP_FRAC_ZEROP_##wc(X)) \
- { \
- _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
- _FP_ROUND(wc, X); \
- _FP_FRAC_LOW_##wc(X) >>= (_FP_WORKBITS); \
- } \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
- } \
- } \
- break; \
- \
- case FP_CLS_ZERO: \
- X##_e = 0; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
- break; \
- \
- case FP_CLS_INF: \
- X##_e = _FP_EXPMAX_##fs; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
- break; \
- \
- case FP_CLS_NAN: \
- X##_e = _FP_EXPMAX_##fs; \
- if (!_FP_KEEPNANFRACP) \
- { \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- X##_s = _FP_NANSIGN_##fs; \
- } \
- else \
- _FP_SETQNAN(fs, wc, X); \
- break; \
- } \
-} while (0)
+#define _FP_PACK_CANONICAL(fs, wc, X) \
+ do \
+ { \
+ switch (X##_c) \
+ { \
+ case FP_CLS_NORMAL: \
+ X##_e += _FP_EXPBIAS_##fs; \
+ if (X##_e > 0) \
+ { \
+ _FP_ROUND (wc, X); \
+ if (_FP_FRAC_OVERP_##wc (fs, X)) \
+ { \
+ _FP_FRAC_CLEAR_OVERP_##wc (fs, X); \
+ X##_e++; \
+ } \
+ _FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
+ if (X##_e >= _FP_EXPMAX_##fs) \
+ { \
+ /* overflow */ \
+ switch (FP_ROUNDMODE) \
+ { \
+ case FP_RND_NEAREST: \
+ X##_c = FP_CLS_INF; \
+ break; \
+ case FP_RND_PINF: \
+ if (!X##_s) \
+ X##_c = FP_CLS_INF; \
+ break; \
+ case FP_RND_MINF: \
+ if (X##_s) \
+ X##_c = FP_CLS_INF; \
+ break; \
+ } \
+ if (X##_c == FP_CLS_INF) \
+ { \
+ /* Overflow to infinity */ \
+ X##_e = _FP_EXPMAX_##fs; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
+ } \
+ else \
+ { \
+ /* Overflow to maximum normal */ \
+ X##_e = _FP_EXPMAX_##fs - 1; \
+ _FP_FRAC_SET_##wc (X, _FP_MAXFRAC_##wc); \
+ } \
+ FP_SET_EXCEPTION (FP_EX_OVERFLOW); \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ } \
+ } \
+ else \
+ { \
+ /* we've got a denormalized number */ \
+ X##_e = -X##_e + 1; \
+ if (X##_e <= _FP_WFRACBITS_##fs) \
+ { \
+ _FP_FRAC_SRS_##wc (X, X##_e, _FP_WFRACBITS_##fs); \
+ _FP_ROUND (wc, X); \
+ if (_FP_FRAC_HIGH_##fs (X) \
+ & (_FP_OVERFLOW_##fs >> 1)) \
+ { \
+ X##_e = 1; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ } \
+ else \
+ { \
+ X##_e = 0; \
+ _FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
+ } \
+ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
+ || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
+ FP_SET_EXCEPTION (FP_EX_UNDERFLOW); \
+ } \
+ else \
+ { \
+ /* underflow to zero */ \
+ X##_e = 0; \
+ if (!_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ _FP_FRAC_SET_##wc (X, _FP_MINFRAC_##wc); \
+ _FP_ROUND (wc, X); \
+ _FP_FRAC_LOW_##wc (X) >>= (_FP_WORKBITS); \
+ } \
+ FP_SET_EXCEPTION (FP_EX_UNDERFLOW); \
+ } \
+ } \
+ break; \
+ \
+ case FP_CLS_ZERO: \
+ X##_e = 0; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
+ break; \
+ \
+ case FP_CLS_INF: \
+ X##_e = _FP_EXPMAX_##fs; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
+ break; \
+ \
+ case FP_CLS_NAN: \
+ X##_e = _FP_EXPMAX_##fs; \
+ if (!_FP_KEEPNANFRACP) \
+ { \
+ _FP_FRAC_SET_##wc (X, _FP_NANFRAC_##fs); \
+ X##_s = _FP_NANSIGN_##fs; \
+ } \
+ else \
+ _FP_SETQNAN (fs, wc, X); \
+ break; \
+ } \
+ } \
+ while (0)
/* This one accepts raw argument and not cooked, returns
* 1 if X is a signaling NaN.
*/
-#define _FP_ISSIGNAN(fs, wc, X) \
-({ \
- int __ret = 0; \
- if (X##_e == _FP_EXPMAX_##fs) \
- { \
- if (!_FP_FRAC_ZEROP_##wc(X) \
- && _FP_FRAC_SNANP(fs, X)) \
- __ret = 1; \
- } \
- __ret; \
-})
+#define _FP_ISSIGNAN(fs, wc, X) \
+ ({ \
+ int __ret = 0; \
+ if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ if (!_FP_FRAC_ZEROP_##wc (X) \
+ && _FP_FRAC_SNANP (fs, X)) \
+ __ret = 1; \
+ } \
+ __ret; \
+ })
/* Addition on semi-raw values. */
-#define _FP_ADD_INTERNAL(fs, wc, R, X, Y, OP) \
-do { \
- if (X##_s == Y##_s) \
- { \
- /* Addition. */ \
- R##_s = X##_s; \
- int ediff = X##_e - Y##_e; \
- if (ediff > 0) \
- { \
- R##_e = X##_e; \
- if (Y##_e == 0) \
- { \
- /* Y is zero or denormalized. */ \
- if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto add_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- ediff--; \
- if (ediff == 0) \
- { \
- _FP_FRAC_ADD_##wc(R, X, Y); \
- goto add3; \
- } \
- if (X##_e == _FP_EXPMAX_##fs) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto add_done; \
- } \
- goto add1; \
- } \
- } \
- else if (X##_e == _FP_EXPMAX_##fs) \
- { \
- /* X is NaN or Inf, Y is normal. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto add_done; \
- } \
- \
- /* Insert implicit MSB of Y. */ \
- _FP_FRAC_HIGH_##fs(Y) |= _FP_IMPLBIT_SH_##fs; \
- \
- add1: \
- /* Shift the mantissa of Y to the right EDIFF steps; \
- remember to account later for the implicit MSB of X. */ \
- if (ediff <= _FP_WFRACBITS_##fs) \
- _FP_FRAC_SRS_##wc(Y, ediff, _FP_WFRACBITS_##fs); \
- else if (!_FP_FRAC_ZEROP_##wc(Y)) \
- _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
- _FP_FRAC_ADD_##wc(R, X, Y); \
- } \
- else if (ediff < 0) \
- { \
- ediff = -ediff; \
- R##_e = Y##_e; \
- if (X##_e == 0) \
- { \
- /* X is zero or denormalized. */ \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto add_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- ediff--; \
- if (ediff == 0) \
- { \
- _FP_FRAC_ADD_##wc(R, Y, X); \
- goto add3; \
- } \
- if (Y##_e == _FP_EXPMAX_##fs) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto add_done; \
- } \
- goto add2; \
- } \
- } \
- else if (Y##_e == _FP_EXPMAX_##fs) \
- { \
- /* Y is NaN or Inf, X is normal. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto add_done; \
- } \
- \
- /* Insert implicit MSB of X. */ \
- _FP_FRAC_HIGH_##fs(X) |= _FP_IMPLBIT_SH_##fs; \
- \
- add2: \
- /* Shift the mantissa of X to the right EDIFF steps; \
- remember to account later for the implicit MSB of Y. */ \
- if (ediff <= _FP_WFRACBITS_##fs) \
- _FP_FRAC_SRS_##wc(X, ediff, _FP_WFRACBITS_##fs); \
- else if (!_FP_FRAC_ZEROP_##wc(X)) \
- _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
- _FP_FRAC_ADD_##wc(R, Y, X); \
- } \
- else \
- { \
- /* ediff == 0. */ \
- if (!_FP_EXP_NORMAL(fs, wc, X)) \
- { \
- if (X##_e == 0) \
- { \
- /* X and Y are zero or denormalized. */ \
- R##_e = 0; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- if (!_FP_FRAC_ZEROP_##wc(Y)) \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto add_done; \
- } \
- else if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto add_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_ADD_##wc(R, X, Y); \
- if (_FP_FRAC_HIGH_##fs(R) & _FP_IMPLBIT_SH_##fs) \
- { \
- /* Normalized result. */ \
- _FP_FRAC_HIGH_##fs(R) \
- &= ~(_FP_W_TYPE)_FP_IMPLBIT_SH_##fs; \
- R##_e = 1; \
- } \
- goto add_done; \
- } \
- } \
- else \
- { \
- /* X and Y are NaN or Inf. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- R##_e = _FP_EXPMAX_##fs; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- _FP_FRAC_COPY_##wc(R, Y); \
- else if (_FP_FRAC_ZEROP_##wc(Y)) \
- _FP_FRAC_COPY_##wc(R, X); \
- else \
- _FP_CHOOSENAN_SEMIRAW(fs, wc, R, X, Y, OP); \
- goto add_done; \
- } \
- } \
- /* The exponents of X and Y, both normal, are equal. The \
- implicit MSBs will always add to increase the \
- exponent. */ \
- _FP_FRAC_ADD_##wc(R, X, Y); \
- R##_e = X##_e + 1; \
- _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
- if (R##_e == _FP_EXPMAX_##fs) \
- /* Overflow to infinity (depending on rounding mode). */ \
- _FP_OVERFLOW_SEMIRAW(fs, wc, R); \
- goto add_done; \
- } \
- add3: \
- if (_FP_FRAC_HIGH_##fs(R) & _FP_IMPLBIT_SH_##fs) \
- { \
- /* Overflow. */ \
- _FP_FRAC_HIGH_##fs(R) &= ~(_FP_W_TYPE)_FP_IMPLBIT_SH_##fs; \
- R##_e++; \
- _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
- if (R##_e == _FP_EXPMAX_##fs) \
- /* Overflow to infinity (depending on rounding mode). */ \
- _FP_OVERFLOW_SEMIRAW(fs, wc, R); \
- } \
- add_done: ; \
- } \
- else \
- { \
- /* Subtraction. */ \
- int ediff = X##_e - Y##_e; \
- if (ediff > 0) \
- { \
- R##_e = X##_e; \
- R##_s = X##_s; \
- if (Y##_e == 0) \
- { \
- /* Y is zero or denormalized. */ \
- if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto sub_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- ediff--; \
- if (ediff == 0) \
- { \
- _FP_FRAC_SUB_##wc(R, X, Y); \
- goto sub3; \
- } \
- if (X##_e == _FP_EXPMAX_##fs) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto sub_done; \
- } \
- goto sub1; \
- } \
- } \
- else if (X##_e == _FP_EXPMAX_##fs) \
- { \
- /* X is NaN or Inf, Y is normal. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_FRAC_COPY_##wc(R, X); \
- goto sub_done; \
- } \
- \
- /* Insert implicit MSB of Y. */ \
- _FP_FRAC_HIGH_##fs(Y) |= _FP_IMPLBIT_SH_##fs; \
- \
- sub1: \
- /* Shift the mantissa of Y to the right EDIFF steps; \
- remember to account later for the implicit MSB of X. */ \
- if (ediff <= _FP_WFRACBITS_##fs) \
- _FP_FRAC_SRS_##wc(Y, ediff, _FP_WFRACBITS_##fs); \
- else if (!_FP_FRAC_ZEROP_##wc(Y)) \
- _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
- _FP_FRAC_SUB_##wc(R, X, Y); \
- } \
- else if (ediff < 0) \
- { \
- ediff = -ediff; \
- R##_e = Y##_e; \
- R##_s = Y##_s; \
- if (X##_e == 0) \
- { \
- /* X is zero or denormalized. */ \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto sub_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- ediff--; \
- if (ediff == 0) \
- { \
- _FP_FRAC_SUB_##wc(R, Y, X); \
- goto sub3; \
- } \
- if (Y##_e == _FP_EXPMAX_##fs) \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto sub_done; \
- } \
- goto sub2; \
- } \
- } \
- else if (Y##_e == _FP_EXPMAX_##fs) \
- { \
- /* Y is NaN or Inf, X is normal. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- _FP_FRAC_COPY_##wc(R, Y); \
- goto sub_done; \
- } \
- \
- /* Insert implicit MSB of X. */ \
- _FP_FRAC_HIGH_##fs(X) |= _FP_IMPLBIT_SH_##fs; \
- \
- sub2: \
- /* Shift the mantissa of X to the right EDIFF steps; \
- remember to account later for the implicit MSB of Y. */ \
- if (ediff <= _FP_WFRACBITS_##fs) \
- _FP_FRAC_SRS_##wc(X, ediff, _FP_WFRACBITS_##fs); \
- else if (!_FP_FRAC_ZEROP_##wc(X)) \
- _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
- _FP_FRAC_SUB_##wc(R, Y, X); \
- } \
- else \
- { \
- /* ediff == 0. */ \
- if (!_FP_EXP_NORMAL(fs, wc, X)) \
- { \
- if (X##_e == 0) \
- { \
- /* X and Y are zero or denormalized. */ \
- R##_e = 0; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- _FP_FRAC_COPY_##wc(R, Y); \
- if (_FP_FRAC_ZEROP_##wc(Y)) \
- R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- R##_s = Y##_s; \
- } \
- goto sub_done; \
- } \
- else if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_COPY_##wc(R, X); \
- R##_s = X##_s; \
- goto sub_done; \
- } \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_SUB_##wc(R, X, Y); \
- R##_s = X##_s; \
- if (_FP_FRAC_HIGH_##fs(R) & _FP_IMPLBIT_SH_##fs) \
- { \
- /* |X| < |Y|, negate result. */ \
- _FP_FRAC_SUB_##wc(R, Y, X); \
- R##_s = Y##_s; \
- } \
- else if (_FP_FRAC_ZEROP_##wc(R)) \
- R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
- goto sub_done; \
- } \
- } \
- else \
- { \
- /* X and Y are NaN or Inf, of opposite signs. */ \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, X); \
- _FP_CHECK_SIGNAN_SEMIRAW(fs, wc, Y); \
- R##_e = _FP_EXPMAX_##fs; \
- if (_FP_FRAC_ZEROP_##wc(X)) \
- { \
- if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- /* Inf - Inf. */ \
- R##_s = _FP_NANSIGN_##fs; \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- _FP_FRAC_SLL_##wc(R, _FP_WORKBITS); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- } \
- else \
- { \
- /* Inf - NaN. */ \
- R##_s = Y##_s; \
- _FP_FRAC_COPY_##wc(R, Y); \
- } \
- } \
- else \
- { \
- if (_FP_FRAC_ZEROP_##wc(Y)) \
- { \
- /* NaN - Inf. */ \
- R##_s = X##_s; \
- _FP_FRAC_COPY_##wc(R, X); \
- } \
- else \
- { \
- /* NaN - NaN. */ \
- _FP_CHOOSENAN_SEMIRAW(fs, wc, R, X, Y, OP); \
- } \
- } \
- goto sub_done; \
- } \
- } \
- /* The exponents of X and Y, both normal, are equal. The \
- implicit MSBs cancel. */ \
- R##_e = X##_e; \
- _FP_FRAC_SUB_##wc(R, X, Y); \
- R##_s = X##_s; \
- if (_FP_FRAC_HIGH_##fs(R) & _FP_IMPLBIT_SH_##fs) \
- { \
- /* |X| < |Y|, negate result. */ \
- _FP_FRAC_SUB_##wc(R, Y, X); \
- R##_s = Y##_s; \
- } \
- else if (_FP_FRAC_ZEROP_##wc(R)) \
- { \
- R##_e = 0; \
- R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
- goto sub_done; \
- } \
- goto norm; \
- } \
- sub3: \
- if (_FP_FRAC_HIGH_##fs(R) & _FP_IMPLBIT_SH_##fs) \
- { \
- int diff; \
- /* Carry into most significant bit of larger one of X and Y, \
- canceling it; renormalize. */ \
- _FP_FRAC_HIGH_##fs(R) &= _FP_IMPLBIT_SH_##fs - 1; \
- norm: \
- _FP_FRAC_CLZ_##wc(diff, R); \
- diff -= _FP_WFRACXBITS_##fs; \
- _FP_FRAC_SLL_##wc(R, diff); \
- if (R##_e <= diff) \
- { \
- /* R is denormalized. */ \
- diff = diff - R##_e + 1; \
- _FP_FRAC_SRS_##wc(R, diff, _FP_WFRACBITS_##fs); \
- R##_e = 0; \
- } \
- else \
- { \
- R##_e -= diff; \
- _FP_FRAC_HIGH_##fs(R) &= ~(_FP_W_TYPE)_FP_IMPLBIT_SH_##fs; \
- } \
- } \
- sub_done: ; \
- } \
-} while (0)
+#define _FP_ADD_INTERNAL(fs, wc, R, X, Y, OP) \
+ do \
+ { \
+ if (X##_s == Y##_s) \
+ { \
+ /* Addition. */ \
+ R##_s = X##_s; \
+ int ediff = X##_e - Y##_e; \
+ if (ediff > 0) \
+ { \
+ R##_e = X##_e; \
+ if (Y##_e == 0) \
+ { \
+ /* Y is zero or denormalized. */ \
+ if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto add_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ ediff--; \
+ if (ediff == 0) \
+ { \
+ _FP_FRAC_ADD_##wc (R, X, Y); \
+ goto add3; \
+ } \
+ if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto add_done; \
+ } \
+ goto add1; \
+ } \
+ } \
+ else if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ /* X is NaN or Inf, Y is normal. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto add_done; \
+ } \
+ \
+ /* Insert implicit MSB of Y. */ \
+ _FP_FRAC_HIGH_##fs (Y) |= _FP_IMPLBIT_SH_##fs; \
+ \
+ add1: \
+ /* Shift the mantissa of Y to the right EDIFF steps; \
+ remember to account later for the implicit MSB of X. */ \
+ if (ediff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc (Y, ediff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc (Y)) \
+ _FP_FRAC_SET_##wc (Y, _FP_MINFRAC_##wc); \
+ _FP_FRAC_ADD_##wc (R, X, Y); \
+ } \
+ else if (ediff < 0) \
+ { \
+ ediff = -ediff; \
+ R##_e = Y##_e; \
+ if (X##_e == 0) \
+ { \
+ /* X is zero or denormalized. */ \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto add_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ ediff--; \
+ if (ediff == 0) \
+ { \
+ _FP_FRAC_ADD_##wc (R, Y, X); \
+ goto add3; \
+ } \
+ if (Y##_e == _FP_EXPMAX_##fs) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto add_done; \
+ } \
+ goto add2; \
+ } \
+ } \
+ else if (Y##_e == _FP_EXPMAX_##fs) \
+ { \
+ /* Y is NaN or Inf, X is normal. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto add_done; \
+ } \
+ \
+ /* Insert implicit MSB of X. */ \
+ _FP_FRAC_HIGH_##fs (X) |= _FP_IMPLBIT_SH_##fs; \
+ \
+ add2: \
+ /* Shift the mantissa of X to the right EDIFF steps; \
+ remember to account later for the implicit MSB of Y. */ \
+ if (ediff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc (X, ediff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc (X)) \
+ _FP_FRAC_SET_##wc (X, _FP_MINFRAC_##wc); \
+ _FP_FRAC_ADD_##wc (R, Y, X); \
+ } \
+ else \
+ { \
+ /* ediff == 0. */ \
+ if (!_FP_EXP_NORMAL (fs, wc, X)) \
+ { \
+ if (X##_e == 0) \
+ { \
+ /* X and Y are zero or denormalized. */ \
+ R##_e = 0; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ if (!_FP_FRAC_ZEROP_##wc (Y)) \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto add_done; \
+ } \
+ else if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto add_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_ADD_##wc (R, X, Y); \
+ if (_FP_FRAC_HIGH_##fs (R) & _FP_IMPLBIT_SH_##fs) \
+ { \
+ /* Normalized result. */ \
+ _FP_FRAC_HIGH_##fs (R) \
+ &= ~(_FP_W_TYPE) _FP_IMPLBIT_SH_##fs; \
+ R##_e = 1; \
+ } \
+ goto add_done; \
+ } \
+ } \
+ else \
+ { \
+ /* X and Y are NaN or Inf. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ R##_e = _FP_EXPMAX_##fs; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ else if (_FP_FRAC_ZEROP_##wc (Y)) \
+ _FP_FRAC_COPY_##wc (R, X); \
+ else \
+ _FP_CHOOSENAN_SEMIRAW (fs, wc, R, X, Y, OP); \
+ goto add_done; \
+ } \
+ } \
+ /* The exponents of X and Y, both normal, are equal. The \
+ implicit MSBs will always add to increase the \
+ exponent. */ \
+ _FP_FRAC_ADD_##wc (R, X, Y); \
+ R##_e = X##_e + 1; \
+ _FP_FRAC_SRS_##wc (R, 1, _FP_WFRACBITS_##fs); \
+ if (R##_e == _FP_EXPMAX_##fs) \
+ /* Overflow to infinity (depending on rounding mode). */ \
+ _FP_OVERFLOW_SEMIRAW (fs, wc, R); \
+ goto add_done; \
+ } \
+ add3: \
+ if (_FP_FRAC_HIGH_##fs (R) & _FP_IMPLBIT_SH_##fs) \
+ { \
+ /* Overflow. */ \
+ _FP_FRAC_HIGH_##fs (R) &= ~(_FP_W_TYPE) _FP_IMPLBIT_SH_##fs; \
+ R##_e++; \
+ _FP_FRAC_SRS_##wc (R, 1, _FP_WFRACBITS_##fs); \
+ if (R##_e == _FP_EXPMAX_##fs) \
+ /* Overflow to infinity (depending on rounding mode). */ \
+ _FP_OVERFLOW_SEMIRAW (fs, wc, R); \
+ } \
+ add_done: ; \
+ } \
+ else \
+ { \
+ /* Subtraction. */ \
+ int ediff = X##_e - Y##_e; \
+ if (ediff > 0) \
+ { \
+ R##_e = X##_e; \
+ R##_s = X##_s; \
+ if (Y##_e == 0) \
+ { \
+ /* Y is zero or denormalized. */ \
+ if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto sub_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ ediff--; \
+ if (ediff == 0) \
+ { \
+ _FP_FRAC_SUB_##wc (R, X, Y); \
+ goto sub3; \
+ } \
+ if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto sub_done; \
+ } \
+ goto sub1; \
+ } \
+ } \
+ else if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ /* X is NaN or Inf, Y is normal. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ goto sub_done; \
+ } \
+ \
+ /* Insert implicit MSB of Y. */ \
+ _FP_FRAC_HIGH_##fs (Y) |= _FP_IMPLBIT_SH_##fs; \
+ \
+ sub1: \
+ /* Shift the mantissa of Y to the right EDIFF steps; \
+ remember to account later for the implicit MSB of X. */ \
+ if (ediff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc (Y, ediff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc (Y)) \
+ _FP_FRAC_SET_##wc (Y, _FP_MINFRAC_##wc); \
+ _FP_FRAC_SUB_##wc (R, X, Y); \
+ } \
+ else if (ediff < 0) \
+ { \
+ ediff = -ediff; \
+ R##_e = Y##_e; \
+ R##_s = Y##_s; \
+ if (X##_e == 0) \
+ { \
+ /* X is zero or denormalized. */ \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto sub_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ ediff--; \
+ if (ediff == 0) \
+ { \
+ _FP_FRAC_SUB_##wc (R, Y, X); \
+ goto sub3; \
+ } \
+ if (Y##_e == _FP_EXPMAX_##fs) \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto sub_done; \
+ } \
+ goto sub2; \
+ } \
+ } \
+ else if (Y##_e == _FP_EXPMAX_##fs) \
+ { \
+ /* Y is NaN or Inf, X is normal. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ goto sub_done; \
+ } \
+ \
+ /* Insert implicit MSB of X. */ \
+ _FP_FRAC_HIGH_##fs (X) |= _FP_IMPLBIT_SH_##fs; \
+ \
+ sub2: \
+ /* Shift the mantissa of X to the right EDIFF steps; \
+ remember to account later for the implicit MSB of Y. */ \
+ if (ediff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc (X, ediff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc (X)) \
+ _FP_FRAC_SET_##wc (X, _FP_MINFRAC_##wc); \
+ _FP_FRAC_SUB_##wc (R, Y, X); \
+ } \
+ else \
+ { \
+ /* ediff == 0. */ \
+ if (!_FP_EXP_NORMAL (fs, wc, X)) \
+ { \
+ if (X##_e == 0) \
+ { \
+ /* X and Y are zero or denormalized. */ \
+ R##_e = 0; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ if (_FP_FRAC_ZEROP_##wc (Y)) \
+ R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ R##_s = Y##_s; \
+ } \
+ goto sub_done; \
+ } \
+ else if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_s = X##_s; \
+ goto sub_done; \
+ } \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_SUB_##wc (R, X, Y); \
+ R##_s = X##_s; \
+ if (_FP_FRAC_HIGH_##fs (R) & _FP_IMPLBIT_SH_##fs) \
+ { \
+ /* |X| < |Y|, negate result. */ \
+ _FP_FRAC_SUB_##wc (R, Y, X); \
+ R##_s = Y##_s; \
+ } \
+ else if (_FP_FRAC_ZEROP_##wc (R)) \
+ R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
+ goto sub_done; \
+ } \
+ } \
+ else \
+ { \
+ /* X and Y are NaN or Inf, of opposite signs. */ \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, X); \
+ _FP_CHECK_SIGNAN_SEMIRAW (fs, wc, Y); \
+ R##_e = _FP_EXPMAX_##fs; \
+ if (_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ /* Inf - Inf. */ \
+ R##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ _FP_FRAC_SLL_##wc (R, _FP_WORKBITS); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ } \
+ else \
+ { \
+ /* Inf - NaN. */ \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ } \
+ } \
+ else \
+ { \
+ if (_FP_FRAC_ZEROP_##wc (Y)) \
+ { \
+ /* NaN - Inf. */ \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc (R, X); \
+ } \
+ else \
+ { \
+ /* NaN - NaN. */ \
+ _FP_CHOOSENAN_SEMIRAW (fs, wc, R, X, Y, OP); \
+ } \
+ } \
+ goto sub_done; \
+ } \
+ } \
+ /* The exponents of X and Y, both normal, are equal. The \
+ implicit MSBs cancel. */ \
+ R##_e = X##_e; \
+ _FP_FRAC_SUB_##wc (R, X, Y); \
+ R##_s = X##_s; \
+ if (_FP_FRAC_HIGH_##fs (R) & _FP_IMPLBIT_SH_##fs) \
+ { \
+ /* |X| < |Y|, negate result. */ \
+ _FP_FRAC_SUB_##wc (R, Y, X); \
+ R##_s = Y##_s; \
+ } \
+ else if (_FP_FRAC_ZEROP_##wc (R)) \
+ { \
+ R##_e = 0; \
+ R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
+ goto sub_done; \
+ } \
+ goto norm; \
+ } \
+ sub3: \
+ if (_FP_FRAC_HIGH_##fs (R) & _FP_IMPLBIT_SH_##fs) \
+ { \
+ int diff; \
+ /* Carry into most significant bit of larger one of X and Y, \
+ canceling it; renormalize. */ \
+ _FP_FRAC_HIGH_##fs (R) &= _FP_IMPLBIT_SH_##fs - 1; \
+ norm: \
+ _FP_FRAC_CLZ_##wc (diff, R); \
+ diff -= _FP_WFRACXBITS_##fs; \
+ _FP_FRAC_SLL_##wc (R, diff); \
+ if (R##_e <= diff) \
+ { \
+ /* R is denormalized. */ \
+ diff = diff - R##_e + 1; \
+ _FP_FRAC_SRS_##wc (R, diff, _FP_WFRACBITS_##fs); \
+ R##_e = 0; \
+ } \
+ else \
+ { \
+ R##_e -= diff; \
+ _FP_FRAC_HIGH_##fs (R) &= ~(_FP_W_TYPE) _FP_IMPLBIT_SH_##fs; \
+ } \
+ } \
+ sub_done: ; \
+ } \
+ } \
+ while (0)
-#define _FP_ADD(fs, wc, R, X, Y) _FP_ADD_INTERNAL(fs, wc, R, X, Y, '+')
-#define _FP_SUB(fs, wc, R, X, Y) \
- do { \
- if (!(Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) Y##_s ^= 1; \
- _FP_ADD_INTERNAL(fs, wc, R, X, Y, '-'); \
- } while (0)
+#define _FP_ADD(fs, wc, R, X, Y) _FP_ADD_INTERNAL (fs, wc, R, X, Y, '+')
+#define _FP_SUB(fs, wc, R, X, Y) \
+ do \
+ { \
+ if (!(Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
+ Y##_s ^= 1; \
+ _FP_ADD_INTERNAL (fs, wc, R, X, Y, '-'); \
+ } \
+ while (0)
/*
- * Main negation routine. FIXME -- when we care about setting exception
- * bits reliably, this will not do. We should examine all of the fp classes.
+ * Main negation routine. The input value is raw.
*/
-#define _FP_NEG(fs, wc, R, X) \
- do { \
- _FP_FRAC_COPY_##wc(R, X); \
- R##_c = X##_c; \
- R##_e = X##_e; \
- R##_s = 1 ^ X##_s; \
- } while (0)
+#define _FP_NEG(fs, wc, R, X) \
+ do \
+ { \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_e = X##_e; \
+ R##_s = 1 ^ X##_s; \
+ } \
+ while (0)
/*
* Main multiplication routine. The input values should be cooked.
*/
-#define _FP_MUL(fs, wc, R, X, Y) \
-do { \
- R##_s = X##_s ^ Y##_s; \
- R##_e = X##_e + Y##_e + 1; \
- switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
- { \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
- R##_c = FP_CLS_NORMAL; \
- \
- _FP_MUL_MEAT_##fs(R,X,Y); \
- \
- if (_FP_FRAC_OVERP_##wc(fs, R)) \
- _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
- else \
- R##_e--; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
- _FP_CHOOSENAN(fs, wc, R, X, Y, '*'); \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
- R##_s = X##_s; \
- \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
- _FP_FRAC_COPY_##wc(R, X); \
- R##_c = X##_c; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
- R##_s = Y##_s; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
- _FP_FRAC_COPY_##wc(R, Y); \
- R##_c = Y##_c; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
- R##_s = _FP_NANSIGN_##fs; \
- R##_c = FP_CLS_NAN; \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- break; \
- \
- default: \
- abort(); \
- } \
-} while (0)
-
-
-/* Fused multiply-add. The input values should be cooked. */
-
-#define _FP_FMA(fs, wc, dwc, R, X, Y, Z) \
-do { \
- FP_DECL_##fs(T); \
- T##_s = X##_s ^ Y##_s; \
- T##_e = X##_e + Y##_e + 1; \
- switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
- { \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
- switch (Z##_c) \
- { \
- case FP_CLS_INF: \
- case FP_CLS_NAN: \
- R##_s = Z##_s; \
- _FP_FRAC_COPY_##wc(R, Z); \
- R##_c = Z##_c; \
- break; \
+#define _FP_MUL(fs, wc, R, X, Y) \
+ do \
+ { \
+ R##_s = X##_s ^ Y##_s; \
+ R##_e = X##_e + Y##_e + 1; \
+ switch (_FP_CLS_COMBINE (X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NORMAL): \
+ R##_c = FP_CLS_NORMAL; \
\
- case FP_CLS_ZERO: \
- R##_c = FP_CLS_NORMAL; \
- R##_s = T##_s; \
- R##_e = T##_e; \
+ _FP_MUL_MEAT_##fs (R, X, Y); \
\
- _FP_MUL_MEAT_##fs(R, X, Y); \
+ if (_FP_FRAC_OVERP_##wc (fs, R)) \
+ _FP_FRAC_SRS_##wc (R, 1, _FP_WFRACBITS_##fs); \
+ else \
+ R##_e--; \
+ break; \
\
- if (_FP_FRAC_OVERP_##wc(fs, R)) \
- _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
- else \
- R##_e--; \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NAN): \
+ _FP_CHOOSENAN (fs, wc, R, X, Y, '*'); \
+ break; \
\
- case FP_CLS_NORMAL:; \
- _FP_FRAC_DECL_##dwc(TD); \
- _FP_FRAC_DECL_##dwc(ZD); \
- _FP_FRAC_DECL_##dwc(RD); \
- _FP_MUL_MEAT_DW_##fs(TD, X, Y); \
- R##_e = T##_e; \
- int tsh = _FP_FRAC_HIGHBIT_DW_##dwc(fs, TD) == 0; \
- T##_e -= tsh; \
- int ediff = T##_e - Z##_e; \
- if (ediff >= 0) \
- { \
- int shift = _FP_WFRACBITS_##fs - tsh - ediff; \
- if (shift <= -_FP_WFRACBITS_##fs) \
- _FP_FRAC_SET_##dwc(ZD, _FP_MINFRAC_##dwc); \
- else \
- { \
- _FP_FRAC_COPY_##dwc##_##wc(ZD, Z); \
- if (shift < 0) \
- _FP_FRAC_SRS_##dwc(ZD, -shift, \
- _FP_WFRACBITS_DW_##fs); \
- else if (shift > 0) \
- _FP_FRAC_SLL_##dwc(ZD, shift); \
- } \
- R##_s = T##_s; \
- if (T##_s == Z##_s) \
- _FP_FRAC_ADD_##dwc(RD, TD, ZD); \
- else \
- { \
- _FP_FRAC_SUB_##dwc(RD, TD, ZD); \
- if (_FP_FRAC_NEGP_##dwc(RD)) \
- { \
- R##_s = Z##_s; \
- _FP_FRAC_SUB_##dwc(RD, ZD, TD); \
- } \
- } \
- } \
- else \
- { \
- R##_e = Z##_e; \
- R##_s = Z##_s; \
- _FP_FRAC_COPY_##dwc##_##wc(ZD, Z); \
- _FP_FRAC_SLL_##dwc(ZD, _FP_WFRACBITS_##fs); \
- int shift = -ediff - tsh; \
- if (shift >= _FP_WFRACBITS_DW_##fs) \
- _FP_FRAC_SET_##dwc(TD, _FP_MINFRAC_##dwc); \
- else if (shift > 0) \
- _FP_FRAC_SRS_##dwc(TD, shift, \
- _FP_WFRACBITS_DW_##fs); \
- if (Z##_s == T##_s) \
- _FP_FRAC_ADD_##dwc(RD, ZD, TD); \
- else \
- _FP_FRAC_SUB_##dwc(RD, ZD, TD); \
- } \
- if (_FP_FRAC_ZEROP_##dwc(RD)) \
- { \
- if (T##_s == Z##_s) \
- R##_s = Z##_s; \
- else \
- R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
- _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
- R##_c = FP_CLS_ZERO; \
- } \
- else \
- { \
- int rlz; \
- _FP_FRAC_CLZ_##dwc(rlz, RD); \
- rlz -= _FP_WFRACXBITS_DW_##fs; \
- R##_e -= rlz; \
- int shift = _FP_WFRACBITS_##fs - rlz; \
- if (shift > 0) \
- _FP_FRAC_SRS_##dwc(RD, shift, \
- _FP_WFRACBITS_DW_##fs); \
- else if (shift < 0) \
- _FP_FRAC_SLL_##dwc(RD, -shift); \
- _FP_FRAC_COPY_##wc##_##dwc(R, RD); \
- R##_c = FP_CLS_NORMAL; \
- } \
- break; \
- } \
- goto done_fma; \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
+ R##_s = X##_s; \
\
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
- _FP_CHOOSENAN(fs, wc, T, X, Y, '*'); \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_c = X##_c; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
- T##_s = X##_s; \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
+ R##_s = Y##_s; \
\
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
- _FP_FRAC_COPY_##wc(T, X); \
- T##_c = X##_c; \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ R##_c = Y##_c; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
- T##_s = Y##_s; \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_INF): \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
- _FP_FRAC_COPY_##wc(T, Y); \
- T##_c = Y##_c; \
- break; \
+ default: \
+ abort (); \
+ } \
+ } \
+ while (0)
+
+
+/* Fused multiply-add. The input values should be cooked. */
+
+#define _FP_FMA(fs, wc, dwc, R, X, Y, Z) \
+ do \
+ { \
+ FP_DECL_##fs (T); \
+ T##_s = X##_s ^ Y##_s; \
+ T##_e = X##_e + Y##_e + 1; \
+ switch (_FP_CLS_COMBINE (X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NORMAL): \
+ switch (Z##_c) \
+ { \
+ case FP_CLS_INF: \
+ case FP_CLS_NAN: \
+ R##_s = Z##_s; \
+ _FP_FRAC_COPY_##wc (R, Z); \
+ R##_c = Z##_c; \
+ break; \
+ \
+ case FP_CLS_ZERO: \
+ R##_c = FP_CLS_NORMAL; \
+ R##_s = T##_s; \
+ R##_e = T##_e; \
+ \
+ _FP_MUL_MEAT_##fs (R, X, Y); \
+ \
+ if (_FP_FRAC_OVERP_##wc (fs, R)) \
+ _FP_FRAC_SRS_##wc (R, 1, _FP_WFRACBITS_##fs); \
+ else \
+ R##_e--; \
+ break; \
+ \
+ case FP_CLS_NORMAL:; \
+ _FP_FRAC_DECL_##dwc (TD); \
+ _FP_FRAC_DECL_##dwc (ZD); \
+ _FP_FRAC_DECL_##dwc (RD); \
+ _FP_MUL_MEAT_DW_##fs (TD, X, Y); \
+ R##_e = T##_e; \
+ int tsh = _FP_FRAC_HIGHBIT_DW_##dwc (fs, TD) == 0; \
+ T##_e -= tsh; \
+ int ediff = T##_e - Z##_e; \
+ if (ediff >= 0) \
+ { \
+ int shift = _FP_WFRACBITS_##fs - tsh - ediff; \
+ if (shift <= -_FP_WFRACBITS_##fs) \
+ _FP_FRAC_SET_##dwc (ZD, _FP_MINFRAC_##dwc); \
+ else \
+ { \
+ _FP_FRAC_COPY_##dwc##_##wc (ZD, Z); \
+ if (shift < 0) \
+ _FP_FRAC_SRS_##dwc (ZD, -shift, \
+ _FP_WFRACBITS_DW_##fs); \
+ else if (shift > 0) \
+ _FP_FRAC_SLL_##dwc (ZD, shift); \
+ } \
+ R##_s = T##_s; \
+ if (T##_s == Z##_s) \
+ _FP_FRAC_ADD_##dwc (RD, TD, ZD); \
+ else \
+ { \
+ _FP_FRAC_SUB_##dwc (RD, TD, ZD); \
+ if (_FP_FRAC_NEGP_##dwc (RD)) \
+ { \
+ R##_s = Z##_s; \
+ _FP_FRAC_SUB_##dwc (RD, ZD, TD); \
+ } \
+ } \
+ } \
+ else \
+ { \
+ R##_e = Z##_e; \
+ R##_s = Z##_s; \
+ _FP_FRAC_COPY_##dwc##_##wc (ZD, Z); \
+ _FP_FRAC_SLL_##dwc (ZD, _FP_WFRACBITS_##fs); \
+ int shift = -ediff - tsh; \
+ if (shift >= _FP_WFRACBITS_DW_##fs) \
+ _FP_FRAC_SET_##dwc (TD, _FP_MINFRAC_##dwc); \
+ else if (shift > 0) \
+ _FP_FRAC_SRS_##dwc (TD, shift, \
+ _FP_WFRACBITS_DW_##fs); \
+ if (Z##_s == T##_s) \
+ _FP_FRAC_ADD_##dwc (RD, ZD, TD); \
+ else \
+ _FP_FRAC_SUB_##dwc (RD, ZD, TD); \
+ } \
+ if (_FP_FRAC_ZEROP_##dwc (RD)) \
+ { \
+ if (T##_s == Z##_s) \
+ R##_s = Z##_s; \
+ else \
+ R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
+ _FP_FRAC_SET_##wc (R, _FP_ZEROFRAC_##wc); \
+ R##_c = FP_CLS_ZERO; \
+ } \
+ else \
+ { \
+ int rlz; \
+ _FP_FRAC_CLZ_##dwc (rlz, RD); \
+ rlz -= _FP_WFRACXBITS_DW_##fs; \
+ R##_e -= rlz; \
+ int shift = _FP_WFRACBITS_##fs - rlz; \
+ if (shift > 0) \
+ _FP_FRAC_SRS_##dwc (RD, shift, \
+ _FP_WFRACBITS_DW_##fs); \
+ else if (shift < 0) \
+ _FP_FRAC_SLL_##dwc (RD, -shift); \
+ _FP_FRAC_COPY_##wc##_##dwc (R, RD); \
+ R##_c = FP_CLS_NORMAL; \
+ } \
+ break; \
+ } \
+ goto done_fma; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NAN): \
+ _FP_CHOOSENAN (fs, wc, T, X, Y, '*'); \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
+ T##_s = X##_s; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc (T, X); \
+ T##_c = X##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
+ T##_s = Y##_s; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc (T, Y); \
+ T##_c = Y##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_INF): \
+ T##_s = _FP_NANSIGN_##fs; \
+ T##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc (T, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ break; \
+ \
+ default: \
+ abort (); \
+ } \
+ \
+ /* T = X * Y is zero, infinity or NaN. */ \
+ switch (_FP_CLS_COMBINE (T##_c, Z##_c)) \
+ { \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NAN): \
+ _FP_CHOOSENAN (fs, wc, R, T, Z, '+'); \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_ZERO): \
+ R##_s = T##_s; \
+ _FP_FRAC_COPY_##wc (R, T); \
+ R##_c = T##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_INF): \
+ R##_s = Z##_s; \
+ _FP_FRAC_COPY_##wc (R, Z); \
+ R##_c = Z##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
+ if (T##_s == Z##_s) \
+ { \
+ R##_s = Z##_s; \
+ _FP_FRAC_COPY_##wc (R, Z); \
+ R##_c = Z##_c; \
+ } \
+ else \
+ { \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ } \
+ break; \
+ \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_ZERO): \
+ if (T##_s == Z##_s) \
+ R##_s = Z##_s; \
+ else \
+ R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
+ _FP_FRAC_COPY_##wc (R, Z); \
+ R##_c = Z##_c; \
+ break; \
+ \
+ default: \
+ abort (); \
+ } \
+ done_fma: ; \
+ } \
+ while (0)
+
+
+/*
+ * Main division routine. The input values should be cooked.
+ */
+
+#define _FP_DIV(fs, wc, R, X, Y) \
+ do \
+ { \
+ R##_s = X##_s ^ Y##_s; \
+ R##_e = X##_e - Y##_e; \
+ switch (_FP_CLS_COMBINE (X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NORMAL): \
+ R##_c = FP_CLS_NORMAL; \
\
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
- T##_s = _FP_NANSIGN_##fs; \
- T##_c = FP_CLS_NAN; \
- _FP_FRAC_SET_##wc(T, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- break; \
+ _FP_DIV_MEAT_##fs (R, X, Y); \
+ break; \
\
- default: \
- abort(); \
- } \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NAN): \
+ _FP_CHOOSENAN (fs, wc, R, X, Y, '/'); \
+ break; \
\
- /* T = X * Y is zero, infinity or NaN. */ \
- switch (_FP_CLS_COMBINE(T##_c, Z##_c)) \
- { \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
- _FP_CHOOSENAN(fs, wc, R, T, Z, '+'); \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_c = X##_c; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
- R##_s = T##_s; \
- _FP_FRAC_COPY_##wc(R, T); \
- R##_c = T##_c; \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc (R, Y); \
+ R##_c = Y##_c; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
- R##_s = Z##_s; \
- _FP_FRAC_COPY_##wc(R, Z); \
- R##_c = Z##_c; \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NORMAL): \
+ R##_c = FP_CLS_ZERO; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
- if (T##_s == Z##_s) \
- { \
- R##_s = Z##_s; \
- _FP_FRAC_COPY_##wc(R, Z); \
- R##_c = Z##_c; \
- } \
- else \
- { \
- R##_s = _FP_NANSIGN_##fs; \
- R##_c = FP_CLS_NAN; \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- } \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
+ FP_SET_EXCEPTION (FP_EX_DIVZERO); \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
+ R##_c = FP_CLS_INF; \
+ break; \
\
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
- if (T##_s == Z##_s) \
- R##_s = Z##_s; \
- else \
- R##_s = (FP_ROUNDMODE == FP_RND_MINF); \
- _FP_FRAC_COPY_##wc(R, Z); \
- R##_c = Z##_c; \
- break; \
+ case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
+ case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_ZERO): \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ break; \
\
- default: \
- abort(); \
- } \
- done_fma: ; \
-} while (0)
-
-
-/*
- * Main division routine. The input values should be cooked.
- */
-
-#define _FP_DIV(fs, wc, R, X, Y) \
-do { \
- R##_s = X##_s ^ Y##_s; \
- R##_e = X##_e - Y##_e; \
- switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
- { \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
- R##_c = FP_CLS_NORMAL; \
- \
- _FP_DIV_MEAT_##fs(R,X,Y); \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
- _FP_CHOOSENAN(fs, wc, R, X, Y, '/'); \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
- R##_s = X##_s; \
- _FP_FRAC_COPY_##wc(R, X); \
- R##_c = X##_c; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
- R##_s = Y##_s; \
- _FP_FRAC_COPY_##wc(R, Y); \
- R##_c = Y##_c; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
- R##_c = FP_CLS_ZERO; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
- FP_SET_EXCEPTION(FP_EX_DIVZERO); \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
- R##_c = FP_CLS_INF; \
- break; \
- \
- case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
- case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
- R##_s = _FP_NANSIGN_##fs; \
- R##_c = FP_CLS_NAN; \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- break; \
- \
- default: \
- abort(); \
- } \
-} while (0)
+ default: \
+ abort (); \
+ } \
+ } \
+ while (0)
/*
@@ -1127,122 +1156,131 @@ do { \
*/
#define _FP_CMP(fs, wc, ret, X, Y, un) \
- do { \
- /* NANs are unordered */ \
- if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
- || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
- { \
- ret = un; \
- } \
- else \
- { \
- int __is_zero_x; \
- int __is_zero_y; \
+ do \
+ { \
+ /* NANs are unordered */ \
+ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
+ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
+ { \
+ ret = un; \
+ } \
+ else \
+ { \
+ int __is_zero_x; \
+ int __is_zero_y; \
\
- __is_zero_x = (!X##_e && _FP_FRAC_ZEROP_##wc(X)) ? 1 : 0; \
- __is_zero_y = (!Y##_e && _FP_FRAC_ZEROP_##wc(Y)) ? 1 : 0; \
+ __is_zero_x = (!X##_e && _FP_FRAC_ZEROP_##wc (X)) ? 1 : 0; \
+ __is_zero_y = (!Y##_e && _FP_FRAC_ZEROP_##wc (Y)) ? 1 : 0; \
\
- if (__is_zero_x && __is_zero_y) \
- ret = 0; \
- else if (__is_zero_x) \
- ret = Y##_s ? 1 : -1; \
- else if (__is_zero_y) \
- ret = X##_s ? -1 : 1; \
- else if (X##_s != Y##_s) \
- ret = X##_s ? -1 : 1; \
- else if (X##_e > Y##_e) \
- ret = X##_s ? -1 : 1; \
- else if (X##_e < Y##_e) \
- ret = X##_s ? 1 : -1; \
- else if (_FP_FRAC_GT_##wc(X, Y)) \
- ret = X##_s ? -1 : 1; \
- else if (_FP_FRAC_GT_##wc(Y, X)) \
- ret = X##_s ? 1 : -1; \
- else \
- ret = 0; \
- } \
- } while (0)
+ if (__is_zero_x && __is_zero_y) \
+ ret = 0; \
+ else if (__is_zero_x) \
+ ret = Y##_s ? 1 : -1; \
+ else if (__is_zero_y) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_s != Y##_s) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_e > Y##_e) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_e < Y##_e) \
+ ret = X##_s ? 1 : -1; \
+ else if (_FP_FRAC_GT_##wc (X, Y)) \
+ ret = X##_s ? -1 : 1; \
+ else if (_FP_FRAC_GT_##wc (Y, X)) \
+ ret = X##_s ? 1 : -1; \
+ else \
+ ret = 0; \
+ } \
+ } \
+ while (0)
/* Simplification for strict equality. */
-#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
- do { \
- /* NANs are unordered */ \
- if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
- || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
- { \
- ret = 1; \
- } \
- else \
- { \
- ret = !(X##_e == Y##_e \
- && _FP_FRAC_EQ_##wc(X, Y) \
- && (X##_s == Y##_s || (!X##_e && _FP_FRAC_ZEROP_##wc(X)))); \
- } \
- } while (0)
+#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
+ do \
+ { \
+ /* NANs are unordered */ \
+ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
+ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
+ { \
+ ret = 1; \
+ } \
+ else \
+ { \
+ ret = !(X##_e == Y##_e \
+ && _FP_FRAC_EQ_##wc (X, Y) \
+ && (X##_s == Y##_s || (!X##_e && _FP_FRAC_ZEROP_##wc (X)))); \
+ } \
+ } \
+ while (0)
/* Version to test unordered. */
#define _FP_CMP_UNORD(fs, wc, ret, X, Y) \
- do { \
- ret = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
- || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))); \
- } while (0)
+ do \
+ { \
+ ret = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
+ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))); \
+ } \
+ while (0)
/*
* Main square root routine. The input value should be cooked.
*/
-#define _FP_SQRT(fs, wc, R, X) \
-do { \
- _FP_FRAC_DECL_##wc(T); _FP_FRAC_DECL_##wc(S); \
- _FP_W_TYPE q; \
- switch (X##_c) \
- { \
- case FP_CLS_NAN: \
- _FP_FRAC_COPY_##wc(R, X); \
- R##_s = X##_s; \
- R##_c = FP_CLS_NAN; \
- break; \
- case FP_CLS_INF: \
- if (X##_s) \
- { \
- R##_s = _FP_NANSIGN_##fs; \
- R##_c = FP_CLS_NAN; /* NAN */ \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- } \
- else \
- { \
- R##_s = 0; \
- R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */ \
- } \
- break; \
- case FP_CLS_ZERO: \
- R##_s = X##_s; \
- R##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */ \
- break; \
- case FP_CLS_NORMAL: \
- R##_s = 0; \
- if (X##_s) \
- { \
- R##_c = FP_CLS_NAN; /* NAN */ \
- R##_s = _FP_NANSIGN_##fs; \
- _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- break; \
- } \
- R##_c = FP_CLS_NORMAL; \
- if (X##_e & 1) \
- _FP_FRAC_SLL_##wc(X, 1); \
- R##_e = X##_e >> 1; \
- _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc); \
- _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
- q = _FP_OVERFLOW_##fs >> 1; \
- _FP_SQRT_MEAT_##wc(R, S, T, X, q); \
- } \
- } while (0)
+#define _FP_SQRT(fs, wc, R, X) \
+ do \
+ { \
+ _FP_FRAC_DECL_##wc (T); \
+ _FP_FRAC_DECL_##wc (S); \
+ _FP_W_TYPE q; \
+ switch (X##_c) \
+ { \
+ case FP_CLS_NAN: \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_s = X##_s; \
+ R##_c = FP_CLS_NAN; \
+ break; \
+ case FP_CLS_INF: \
+ if (X##_s) \
+ { \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; /* NAN */ \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ } \
+ else \
+ { \
+ R##_s = 0; \
+ R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */ \
+ } \
+ break; \
+ case FP_CLS_ZERO: \
+ R##_s = X##_s; \
+ R##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */ \
+ break; \
+ case FP_CLS_NORMAL: \
+ R##_s = 0; \
+ if (X##_s) \
+ { \
+ R##_c = FP_CLS_NAN; /* NAN */ \
+ R##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_SET_##wc (R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ break; \
+ } \
+ R##_c = FP_CLS_NORMAL; \
+ if (X##_e & 1) \
+ _FP_FRAC_SLL_##wc (X, 1); \
+ R##_e = X##_e >> 1; \
+ _FP_FRAC_SET_##wc (S, _FP_ZEROFRAC_##wc); \
+ _FP_FRAC_SET_##wc (R, _FP_ZEROFRAC_##wc); \
+ q = _FP_OVERFLOW_##fs >> 1; \
+ _FP_SQRT_MEAT_##wc (R, S, T, X, q); \
+ } \
+ } \
+ while (0)
/*
* Convert from FP to integer. Input is raw.
@@ -1260,292 +1298,306 @@ do { \
* depending on the sign in such case.
*/
#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
-do { \
- if (X##_e < _FP_EXPBIAS_##fs) \
+ do \
{ \
- r = 0; \
- if (X##_e == 0) \
+ if (X##_e < _FP_EXPBIAS_##fs) \
{ \
- if (!_FP_FRAC_ZEROP_##wc(X)) \
+ r = 0; \
+ if (X##_e == 0) \
{ \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
+ if (!_FP_FRAC_ZEROP_##wc (X)) \
+ { \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ } \
} \
+ else \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
} \
- else \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- } \
- else if (X##_e >= _FP_EXPBIAS_##fs + rsize - (rsigned > 0 || X##_s) \
- || (!rsigned && X##_s)) \
- { \
- /* Overflow or converting to the most negative integer. */ \
- if (rsigned) \
+ else if (X##_e >= _FP_EXPBIAS_##fs + rsize - (rsigned > 0 || X##_s) \
+ || (!rsigned && X##_s)) \
{ \
- r = 1; \
- r <<= rsize - 1; \
- r -= 1 - X##_s; \
- } else { \
- r = 0; \
- if (X##_s) \
- r = ~r; \
- } \
+ /* Overflow or converting to the most negative integer. */ \
+ if (rsigned) \
+ { \
+ r = 1; \
+ r <<= rsize - 1; \
+ r -= 1 - X##_s; \
+ } else { \
+ r = 0; \
+ if (!X##_s) \
+ r = ~r; \
+ } \
\
- if (rsigned && X##_s && X##_e == _FP_EXPBIAS_##fs + rsize - 1) \
- { \
- /* Possibly converting to most negative integer; check the \
- mantissa. */ \
- int inexact = 0; \
- (void)((_FP_FRACBITS_##fs > rsize) \
- ? ({ _FP_FRAC_SRST_##wc(X, inexact, \
- _FP_FRACBITS_##fs - rsize, \
- _FP_FRACBITS_##fs); 0; }) \
- : 0); \
- if (!_FP_FRAC_ZEROP_##wc(X)) \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- else if (inexact) \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ if (rsigned && X##_s && X##_e == _FP_EXPBIAS_##fs + rsize - 1) \
+ { \
+ /* Possibly converting to most negative integer; check the \
+ mantissa. */ \
+ int inexact = 0; \
+ (void) ((_FP_FRACBITS_##fs > rsize) \
+ ? ({ \
+ _FP_FRAC_SRST_##wc (X, inexact, \
+ _FP_FRACBITS_##fs - rsize, \
+ _FP_FRACBITS_##fs); \
+ 0; \
+ }) \
+ : 0); \
+ if (!_FP_FRAC_ZEROP_##wc (X)) \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ else if (inexact) \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ } \
+ else \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
} \
else \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
+ { \
+ _FP_FRAC_HIGH_RAW_##fs (X) |= _FP_IMPLBIT_##fs; \
+ if (X##_e >= _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1) \
+ { \
+ _FP_FRAC_ASSEMBLE_##wc (r, X, rsize); \
+ r <<= X##_e - _FP_EXPBIAS_##fs - _FP_FRACBITS_##fs + 1; \
+ } \
+ else \
+ { \
+ int inexact; \
+ _FP_FRAC_SRST_##wc (X, inexact, \
+ (_FP_FRACBITS_##fs + _FP_EXPBIAS_##fs - 1 \
+ - X##_e), \
+ _FP_FRACBITS_##fs); \
+ if (inexact) \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ _FP_FRAC_ASSEMBLE_##wc (r, X, rsize); \
+ } \
+ if (rsigned && X##_s) \
+ r = -r; \
+ } \
} \
- else \
+ while (0)
+
+/* Convert integer to fp. Output is raw. RTYPE is unsigned even if
+ input is signed. */
+#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
+ do \
{ \
- _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_IMPLBIT_##fs; \
- if (X##_e >= _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1) \
+ if (r) \
{ \
- _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
- r <<= X##_e - _FP_EXPBIAS_##fs - _FP_FRACBITS_##fs + 1; \
+ rtype ur_; \
+ \
+ if ((X##_s = (r < 0))) \
+ r = -(rtype) r; \
+ \
+ ur_ = (rtype) r; \
+ (void) ((rsize <= _FP_W_TYPE_SIZE) \
+ ? ({ \
+ int lz_; \
+ __FP_CLZ (lz_, (_FP_W_TYPE) ur_); \
+ X##_e = _FP_EXPBIAS_##fs + _FP_W_TYPE_SIZE - 1 - lz_; \
+ }) \
+ : ((rsize <= 2 * _FP_W_TYPE_SIZE) \
+ ? ({ \
+ int lz_; \
+ __FP_CLZ_2 (lz_, \
+ (_FP_W_TYPE) (ur_ >> _FP_W_TYPE_SIZE), \
+ (_FP_W_TYPE) ur_); \
+ X##_e = (_FP_EXPBIAS_##fs + 2 * _FP_W_TYPE_SIZE - 1 \
+ - lz_); \
+ }) \
+ : (abort (), 0))); \
+ \
+ if (rsize - 1 + _FP_EXPBIAS_##fs >= _FP_EXPMAX_##fs \
+ && X##_e >= _FP_EXPMAX_##fs) \
+ { \
+ /* Exponent too big; overflow to infinity. (May also \
+ happen after rounding below.) */ \
+ _FP_OVERFLOW_SEMIRAW (fs, wc, X); \
+ goto pack_semiraw; \
+ } \
+ \
+ if (rsize <= _FP_FRACBITS_##fs \
+ || X##_e < _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs) \
+ { \
+ /* Exactly representable; shift left. */ \
+ _FP_FRAC_DISASSEMBLE_##wc (X, ur_, rsize); \
+ if (_FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1 - X##_e > 0) \
+ _FP_FRAC_SLL_##wc (X, (_FP_EXPBIAS_##fs \
+ + _FP_FRACBITS_##fs - 1 - X##_e)); \
+ } \
+ else \
+ { \
+ /* More bits in integer than in floating type; need to \
+ round. */ \
+ if (_FP_EXPBIAS_##fs + _FP_WFRACBITS_##fs - 1 < X##_e) \
+ ur_ = ((ur_ >> (X##_e - _FP_EXPBIAS_##fs \
+ - _FP_WFRACBITS_##fs + 1)) \
+ | ((ur_ << (rsize - (X##_e - _FP_EXPBIAS_##fs \
+ - _FP_WFRACBITS_##fs + 1))) \
+ != 0)); \
+ _FP_FRAC_DISASSEMBLE_##wc (X, ur_, rsize); \
+ if ((_FP_EXPBIAS_##fs + _FP_WFRACBITS_##fs - 1 - X##_e) > 0) \
+ _FP_FRAC_SLL_##wc (X, (_FP_EXPBIAS_##fs \
+ + _FP_WFRACBITS_##fs - 1 - X##_e)); \
+ _FP_FRAC_HIGH_##fs (X) &= ~(_FP_W_TYPE) _FP_IMPLBIT_SH_##fs; \
+ pack_semiraw: \
+ _FP_PACK_SEMIRAW (fs, wc, X); \
+ } \
} \
else \
{ \
- int inexact; \
- _FP_FRAC_SRST_##wc(X, inexact, \
- (_FP_FRACBITS_##fs + _FP_EXPBIAS_##fs - 1 \
- - X##_e), \
- _FP_FRACBITS_##fs); \
- if (inexact) \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
+ X##_s = 0; \
+ X##_e = 0; \
+ _FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
} \
- if (rsigned && X##_s) \
- r = -r; \
} \
-} while (0)
-
-/* Convert integer to fp. Output is raw. RTYPE is unsigned even if
- input is signed. */
-#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
- do { \
- if (r) \
- { \
- rtype ur_; \
- \
- if ((X##_s = (r < 0))) \
- r = -(rtype)r; \
- \
- ur_ = (rtype) r; \
- (void)((rsize <= _FP_W_TYPE_SIZE) \
- ? ({ \
- int lz_; \
- __FP_CLZ(lz_, (_FP_W_TYPE)ur_); \
- X##_e = _FP_EXPBIAS_##fs + _FP_W_TYPE_SIZE - 1 - lz_; \
- }) \
- : ((rsize <= 2 * _FP_W_TYPE_SIZE) \
- ? ({ \
- int lz_; \
- __FP_CLZ_2(lz_, (_FP_W_TYPE)(ur_ >> _FP_W_TYPE_SIZE), \
- (_FP_W_TYPE)ur_); \
- X##_e = (_FP_EXPBIAS_##fs + 2 * _FP_W_TYPE_SIZE - 1 \
- - lz_); \
- }) \
- : (abort(), 0))); \
- \
- if (rsize - 1 + _FP_EXPBIAS_##fs >= _FP_EXPMAX_##fs \
- && X##_e >= _FP_EXPMAX_##fs) \
- { \
- /* Exponent too big; overflow to infinity. (May also \
- happen after rounding below.) */ \
- _FP_OVERFLOW_SEMIRAW(fs, wc, X); \
- goto pack_semiraw; \
- } \
- \
- if (rsize <= _FP_FRACBITS_##fs \
- || X##_e < _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs) \
- { \
- /* Exactly representable; shift left. */ \
- _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \
- if (_FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1 - X##_e > 0) \
- _FP_FRAC_SLL_##wc(X, (_FP_EXPBIAS_##fs \
- + _FP_FRACBITS_##fs - 1 - X##_e)); \
- } \
- else \
- { \
- /* More bits in integer than in floating type; need to \
- round. */ \
- if (_FP_EXPBIAS_##fs + _FP_WFRACBITS_##fs - 1 < X##_e) \
- ur_ = ((ur_ >> (X##_e - _FP_EXPBIAS_##fs \
- - _FP_WFRACBITS_##fs + 1)) \
- | ((ur_ << (rsize - (X##_e - _FP_EXPBIAS_##fs \
- - _FP_WFRACBITS_##fs + 1))) \
- != 0)); \
- _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \
- if ((_FP_EXPBIAS_##fs + _FP_WFRACBITS_##fs - 1 - X##_e) > 0) \
- _FP_FRAC_SLL_##wc(X, (_FP_EXPBIAS_##fs \
- + _FP_WFRACBITS_##fs - 1 - X##_e)); \
- _FP_FRAC_HIGH_##fs(X) &= ~(_FP_W_TYPE)_FP_IMPLBIT_SH_##fs; \
- pack_semiraw: \
- _FP_PACK_SEMIRAW(fs, wc, X); \
- } \
- } \
- else \
- { \
- X##_s = 0; \
- X##_e = 0; \
- _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
- } \
- } while (0)
+ while (0)
/* Extend from a narrower floating-point format to a wider one. Input
and output are raw. */
-#define FP_EXTEND(dfs,sfs,dwc,swc,D,S) \
-do { \
- if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs \
- || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs \
- < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs) \
- || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
- && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs)) \
- abort(); \
- D##_s = S##_s; \
- _FP_FRAC_COPY_##dwc##_##swc(D, S); \
- if (_FP_EXP_NORMAL(sfs, swc, S)) \
- { \
- D##_e = S##_e + _FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs; \
- _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs - _FP_FRACBITS_##sfs)); \
- } \
- else \
- { \
- if (S##_e == 0) \
- { \
- if (_FP_FRAC_ZEROP_##swc(S)) \
- D##_e = 0; \
- else if (_FP_EXPBIAS_##dfs \
- < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs \
- - _FP_FRACBITS_##sfs)); \
- D##_e = 0; \
- } \
- else \
- { \
- int _lz; \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- _FP_FRAC_CLZ_##swc(_lz, S); \
- _FP_FRAC_SLL_##dwc(D, \
- _lz + _FP_FRACBITS_##dfs \
- - _FP_FRACTBITS_##sfs); \
- D##_e = (_FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs + 1 \
- + _FP_FRACXBITS_##sfs - _lz); \
- } \
- } \
- else \
- { \
- D##_e = _FP_EXPMAX_##dfs; \
- if (!_FP_FRAC_ZEROP_##swc(S)) \
- { \
- if (_FP_FRAC_SNANP(sfs, S)) \
- FP_SET_EXCEPTION(FP_EX_INVALID); \
- _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs \
- - _FP_FRACBITS_##sfs)); \
- } \
- } \
- } \
-} while (0)
+#define FP_EXTEND(dfs, sfs, dwc, swc, D, S) \
+ do \
+ { \
+ if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs \
+ || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs \
+ < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs) \
+ || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
+ && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs)) \
+ abort (); \
+ D##_s = S##_s; \
+ _FP_FRAC_COPY_##dwc##_##swc (D, S); \
+ if (_FP_EXP_NORMAL (sfs, swc, S)) \
+ { \
+ D##_e = S##_e + _FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs; \
+ _FP_FRAC_SLL_##dwc (D, (_FP_FRACBITS_##dfs - _FP_FRACBITS_##sfs)); \
+ } \
+ else \
+ { \
+ if (S##_e == 0) \
+ { \
+ if (_FP_FRAC_ZEROP_##swc (S)) \
+ D##_e = 0; \
+ else if (_FP_EXPBIAS_##dfs \
+ < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_SLL_##dwc (D, (_FP_FRACBITS_##dfs \
+ - _FP_FRACBITS_##sfs)); \
+ D##_e = 0; \
+ } \
+ else \
+ { \
+ int _lz; \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ _FP_FRAC_CLZ_##swc (_lz, S); \
+ _FP_FRAC_SLL_##dwc (D, \
+ _lz + _FP_FRACBITS_##dfs \
+ - _FP_FRACTBITS_##sfs); \
+ D##_e = (_FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs + 1 \
+ + _FP_FRACXBITS_##sfs - _lz); \
+ } \
+ } \
+ else \
+ { \
+ D##_e = _FP_EXPMAX_##dfs; \
+ if (!_FP_FRAC_ZEROP_##swc (S)) \
+ { \
+ if (_FP_FRAC_SNANP (sfs, S)) \
+ FP_SET_EXCEPTION (FP_EX_INVALID); \
+ _FP_FRAC_SLL_##dwc (D, (_FP_FRACBITS_##dfs \
+ - _FP_FRACBITS_##sfs)); \
+ _FP_SETQNAN (dfs, dwc, D); \
+ } \
+ } \
+ } \
+ } \
+ while (0)
/* Truncate from a wider floating-point format to a narrower one.
Input and output are semi-raw. */
-#define FP_TRUNC(dfs,sfs,dwc,swc,D,S) \
-do { \
- if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs \
- || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1 \
- && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs)) \
- abort(); \
- D##_s = S##_s; \
- if (_FP_EXP_NORMAL(sfs, swc, S)) \
- { \
- D##_e = S##_e + _FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs; \
- if (D##_e >= _FP_EXPMAX_##dfs) \
- _FP_OVERFLOW_SEMIRAW(dfs, dwc, D); \
- else \
- { \
- if (D##_e <= 0) \
- { \
- if (D##_e < 1 - _FP_FRACBITS_##dfs) \
- { \
- _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc); \
- _FP_FRAC_LOW_##swc(S) |= 1; \
- } \
- else \
- { \
- _FP_FRAC_HIGH_##sfs(S) |= _FP_IMPLBIT_SH_##sfs; \
- _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs \
- - _FP_WFRACBITS_##dfs + 1 - D##_e), \
- _FP_WFRACBITS_##sfs); \
- } \
- D##_e = 0; \
- } \
- else \
- _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs \
- - _FP_WFRACBITS_##dfs), \
- _FP_WFRACBITS_##sfs); \
- _FP_FRAC_COPY_##dwc##_##swc(D, S); \
- } \
- } \
- else \
- { \
- if (S##_e == 0) \
- { \
- D##_e = 0; \
- if (_FP_FRAC_ZEROP_##swc(S)) \
- _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
- else \
- { \
- FP_SET_EXCEPTION(FP_EX_DENORM); \
- if (_FP_EXPBIAS_##sfs \
- < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1) \
- { \
- _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs \
- - _FP_WFRACBITS_##dfs), \
- _FP_WFRACBITS_##sfs); \
- _FP_FRAC_COPY_##dwc##_##swc(D, S); \
- } \
- else \
- { \
- _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
- _FP_FRAC_LOW_##dwc(D) |= 1; \
- } \
- } \
- } \
- else \
- { \
- D##_e = _FP_EXPMAX_##dfs; \
- if (_FP_FRAC_ZEROP_##swc(S)) \
- _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc); \
- else \
- { \
- _FP_CHECK_SIGNAN_SEMIRAW(sfs, swc, S); \
- _FP_FRAC_SRL_##swc(S, (_FP_WFRACBITS_##sfs \
- - _FP_WFRACBITS_##dfs)); \
- _FP_FRAC_COPY_##dwc##_##swc(D, S); \
- /* Semi-raw NaN must have all workbits cleared. */ \
- _FP_FRAC_LOW_##dwc(D) \
- &= ~(_FP_W_TYPE) ((1 << _FP_WORKBITS) - 1); \
- _FP_SETQNAN_SEMIRAW(dfs, dwc, D); \
- } \
- } \
- } \
-} while (0)
+#define FP_TRUNC(dfs, sfs, dwc, swc, D, S) \
+ do \
+ { \
+ if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs \
+ || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1 \
+ && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs)) \
+ abort (); \
+ D##_s = S##_s; \
+ if (_FP_EXP_NORMAL (sfs, swc, S)) \
+ { \
+ D##_e = S##_e + _FP_EXPBIAS_##dfs - _FP_EXPBIAS_##sfs; \
+ if (D##_e >= _FP_EXPMAX_##dfs) \
+ _FP_OVERFLOW_SEMIRAW (dfs, dwc, D); \
+ else \
+ { \
+ if (D##_e <= 0) \
+ { \
+ if (D##_e < 1 - _FP_FRACBITS_##dfs) \
+ { \
+ _FP_FRAC_SET_##swc (S, _FP_ZEROFRAC_##swc); \
+ _FP_FRAC_LOW_##swc (S) |= 1; \
+ } \
+ else \
+ { \
+ _FP_FRAC_HIGH_##sfs (S) |= _FP_IMPLBIT_SH_##sfs; \
+ _FP_FRAC_SRS_##swc (S, (_FP_WFRACBITS_##sfs \
+ - _FP_WFRACBITS_##dfs \
+ + 1 - D##_e), \
+ _FP_WFRACBITS_##sfs); \
+ } \
+ D##_e = 0; \
+ } \
+ else \
+ _FP_FRAC_SRS_##swc (S, (_FP_WFRACBITS_##sfs \
+ - _FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ _FP_FRAC_COPY_##dwc##_##swc (D, S); \
+ } \
+ } \
+ else \
+ { \
+ if (S##_e == 0) \
+ { \
+ D##_e = 0; \
+ if (_FP_FRAC_ZEROP_##swc (S)) \
+ _FP_FRAC_SET_##dwc (D, _FP_ZEROFRAC_##dwc); \
+ else \
+ { \
+ FP_SET_EXCEPTION (FP_EX_DENORM); \
+ if (_FP_EXPBIAS_##sfs \
+ < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1) \
+ { \
+ _FP_FRAC_SRS_##swc (S, (_FP_WFRACBITS_##sfs \
+ - _FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ _FP_FRAC_COPY_##dwc##_##swc (D, S); \
+ } \
+ else \
+ { \
+ _FP_FRAC_SET_##dwc (D, _FP_ZEROFRAC_##dwc); \
+ _FP_FRAC_LOW_##dwc (D) |= 1; \
+ } \
+ } \
+ } \
+ else \
+ { \
+ D##_e = _FP_EXPMAX_##dfs; \
+ if (_FP_FRAC_ZEROP_##swc (S)) \
+ _FP_FRAC_SET_##dwc (D, _FP_ZEROFRAC_##dwc); \
+ else \
+ { \
+ _FP_CHECK_SIGNAN_SEMIRAW (sfs, swc, S); \
+ _FP_FRAC_SRL_##swc (S, (_FP_WFRACBITS_##sfs \
+ - _FP_WFRACBITS_##dfs)); \
+ _FP_FRAC_COPY_##dwc##_##swc (D, S); \
+ /* Semi-raw NaN must have all workbits cleared. */ \
+ _FP_FRAC_LOW_##dwc (D) \
+ &= ~(_FP_W_TYPE) ((1 << _FP_WORKBITS) - 1); \
+ _FP_SETQNAN_SEMIRAW (dfs, dwc, D); \
+ } \
+ } \
+ } \
+ } \
+ while (0)
/*
* Helper primitives.
@@ -1555,64 +1607,72 @@ do { \
#ifndef __FP_CLZ
/* GCC 3.4 and later provide the builtins for us. */
-#define __FP_CLZ(r, x) \
- do { \
- if (sizeof (_FP_W_TYPE) == sizeof (unsigned int)) \
- r = __builtin_clz (x); \
- else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long)) \
- r = __builtin_clzl (x); \
- else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long long)) \
- r = __builtin_clzll (x); \
- else \
- abort (); \
- } while (0)
+# define __FP_CLZ(r, x) \
+ do \
+ { \
+ if (sizeof (_FP_W_TYPE) == sizeof (unsigned int)) \
+ r = __builtin_clz (x); \
+ else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long)) \
+ r = __builtin_clzl (x); \
+ else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long long)) \
+ r = __builtin_clzll (x); \
+ else \
+ abort (); \
+ } \
+ while (0)
#endif /* ndef __FP_CLZ */
#define _FP_DIV_HELP_imm(q, r, n, d) \
- do { \
- q = n / d, r = n % d; \
- } while (0)
+ do \
+ { \
+ q = n / d, r = n % d; \
+ } \
+ while (0)
/* A restoring bit-by-bit division primitive. */
#define _FP_DIV_MEAT_N_loop(fs, wc, R, X, Y) \
- do { \
- int count = _FP_WFRACBITS_##fs; \
- _FP_FRAC_DECL_##wc (u); \
- _FP_FRAC_DECL_##wc (v); \
- _FP_FRAC_COPY_##wc (u, X); \
- _FP_FRAC_COPY_##wc (v, Y); \
- _FP_FRAC_SET_##wc (R, _FP_ZEROFRAC_##wc); \
- /* Normalize U and V. */ \
- _FP_FRAC_SLL_##wc (u, _FP_WFRACXBITS_##fs); \
- _FP_FRAC_SLL_##wc (v, _FP_WFRACXBITS_##fs); \
- /* First round. Since the operands are normalized, either the \
- first or second bit will be set in the fraction. Produce a \
- normalized result by checking which and adjusting the loop \
- count and exponent accordingly. */ \
- if (_FP_FRAC_GE_1 (u, v)) \
- { \
- _FP_FRAC_SUB_##wc (u, u, v); \
- _FP_FRAC_LOW_##wc (R) |= 1; \
- count--; \
- } \
- else \
- R##_e--; \
- /* Subsequent rounds. */ \
- do { \
- int msb = (_FP_WS_TYPE) _FP_FRAC_HIGH_##wc (u) < 0; \
- _FP_FRAC_SLL_##wc (u, 1); \
- _FP_FRAC_SLL_##wc (R, 1); \
- if (msb || _FP_FRAC_GE_1 (u, v)) \
+ do \
+ { \
+ int count = _FP_WFRACBITS_##fs; \
+ _FP_FRAC_DECL_##wc (u); \
+ _FP_FRAC_DECL_##wc (v); \
+ _FP_FRAC_COPY_##wc (u, X); \
+ _FP_FRAC_COPY_##wc (v, Y); \
+ _FP_FRAC_SET_##wc (R, _FP_ZEROFRAC_##wc); \
+ /* Normalize U and V. */ \
+ _FP_FRAC_SLL_##wc (u, _FP_WFRACXBITS_##fs); \
+ _FP_FRAC_SLL_##wc (v, _FP_WFRACXBITS_##fs); \
+ /* First round. Since the operands are normalized, either the \
+ first or second bit will be set in the fraction. Produce a \
+ normalized result by checking which and adjusting the loop \
+ count and exponent accordingly. */ \
+ if (_FP_FRAC_GE_1 (u, v)) \
{ \
_FP_FRAC_SUB_##wc (u, u, v); \
_FP_FRAC_LOW_##wc (R) |= 1; \
+ count--; \
} \
- } while (--count > 0); \
- /* If there's anything left in U, the result is inexact. */ \
- _FP_FRAC_LOW_##wc (R) |= !_FP_FRAC_ZEROP_##wc (u); \
- } while (0)
+ else \
+ R##_e--; \
+ /* Subsequent rounds. */ \
+ do \
+ { \
+ int msb = (_FP_WS_TYPE) _FP_FRAC_HIGH_##wc (u) < 0; \
+ _FP_FRAC_SLL_##wc (u, 1); \
+ _FP_FRAC_SLL_##wc (R, 1); \
+ if (msb || _FP_FRAC_GE_1 (u, v)) \
+ { \
+ _FP_FRAC_SUB_##wc (u, u, v); \
+ _FP_FRAC_LOW_##wc (R) |= 1; \
+ } \
+ } \
+ while (--count > 0); \
+ /* If there's anything left in U, the result is inexact. */ \
+ _FP_FRAC_LOW_##wc (R) |= !_FP_FRAC_ZEROP_##wc (u); \
+ } \
+ while (0)
#define _FP_DIV_MEAT_1_loop(fs, R, X, Y) _FP_DIV_MEAT_N_loop (fs, 1, R, X, Y)
#define _FP_DIV_MEAT_2_loop(fs, R, X, Y) _FP_DIV_MEAT_N_loop (fs, 2, R, X, Y)
diff --git a/libc/soft-fp/quad.h b/libc/soft-fp/quad.h
index 9a16bf328..5002da5a5 100644
--- a/libc/soft-fp/quad.h
+++ b/libc/soft-fp/quad.h
@@ -31,15 +31,15 @@
<http://www.gnu.org/licenses/>. */
#if _FP_W_TYPE_SIZE < 32
-#error "Here's a nickel, kid. Go buy yourself a real computer."
+# error "Here's a nickel, kid. Go buy yourself a real computer."
#endif
#if _FP_W_TYPE_SIZE < 64
-#define _FP_FRACTBITS_Q (4*_FP_W_TYPE_SIZE)
-#define _FP_FRACTBITS_DW_Q (8*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_Q (4*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_DW_Q (8*_FP_W_TYPE_SIZE)
#else
-#define _FP_FRACTBITS_Q (2*_FP_W_TYPE_SIZE)
-#define _FP_FRACTBITS_DW_Q (4*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_Q (2*_FP_W_TYPE_SIZE)
+# define _FP_FRACTBITS_DW_Q (4*_FP_W_TYPE_SIZE)
#endif
#define _FP_FRACBITS_Q 113
@@ -51,233 +51,271 @@
#define _FP_EXPMAX_Q 32767
#define _FP_QNANBIT_Q \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-2) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-2) % _FP_W_TYPE_SIZE)
#define _FP_QNANBIT_SH_Q \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_Q \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-1) % _FP_W_TYPE_SIZE)
#define _FP_IMPLBIT_SH_Q \
- ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
#define _FP_OVERFLOW_Q \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_Q % _FP_W_TYPE_SIZE))
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_Q % _FP_W_TYPE_SIZE))
#define _FP_WFRACBITS_DW_Q (2 * _FP_WFRACBITS_Q)
#define _FP_WFRACXBITS_DW_Q (_FP_FRACTBITS_DW_Q - _FP_WFRACBITS_DW_Q)
#define _FP_HIGHBIT_DW_Q \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_DW_Q - 1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_Q - 1) % _FP_W_TYPE_SIZE)
-typedef float TFtype __attribute__((mode(TF)));
+typedef float TFtype __attribute__ ((mode (TF)));
#if _FP_W_TYPE_SIZE < 64
union _FP_UNION_Q
{
- TFtype flt;
- struct _FP_STRUCT_LAYOUT
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned sign : 1;
- unsigned exp : _FP_EXPBITS_Q;
- unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
- unsigned long frac2 : _FP_W_TYPE_SIZE;
- unsigned long frac1 : _FP_W_TYPE_SIZE;
- unsigned long frac0 : _FP_W_TYPE_SIZE;
-#else
- unsigned long frac0 : _FP_W_TYPE_SIZE;
- unsigned long frac1 : _FP_W_TYPE_SIZE;
- unsigned long frac2 : _FP_W_TYPE_SIZE;
- unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
- unsigned exp : _FP_EXPBITS_Q;
- unsigned sign : 1;
-#endif /* not bigendian */
- } bits __attribute__((packed));
+ TFtype flt;
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
+ unsigned long frac2 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+# else
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac2 : _FP_W_TYPE_SIZE;
+ unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned sign : 1;
+# endif /* not bigendian */
+ } bits __attribute__ ((packed));
};
-#define FP_DECL_Q(X) _FP_DECL(4,X)
-#define FP_UNPACK_RAW_Q(X,val) _FP_UNPACK_RAW_4(Q,X,val)
-#define FP_UNPACK_RAW_QP(X,val) _FP_UNPACK_RAW_4_P(Q,X,val)
-#define FP_PACK_RAW_Q(val,X) _FP_PACK_RAW_4(Q,val,X)
-#define FP_PACK_RAW_QP(val,X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_4_P(Q,val,X); \
- } while (0)
-
-#define FP_UNPACK_Q(X,val) \
- do { \
- _FP_UNPACK_RAW_4(Q,X,val); \
- _FP_UNPACK_CANONICAL(Q,4,X); \
- } while (0)
-
-#define FP_UNPACK_QP(X,val) \
- do { \
- _FP_UNPACK_RAW_4_P(Q,X,val); \
- _FP_UNPACK_CANONICAL(Q,4,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_Q(X,val) \
- do { \
- _FP_UNPACK_RAW_4(Q,X,val); \
- _FP_UNPACK_SEMIRAW(Q,4,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_QP(X,val) \
- do { \
- _FP_UNPACK_RAW_4_P(Q,X,val); \
- _FP_UNPACK_SEMIRAW(Q,4,X); \
- } while (0)
-
-#define FP_PACK_Q(val,X) \
- do { \
- _FP_PACK_CANONICAL(Q,4,X); \
- _FP_PACK_RAW_4(Q,val,X); \
- } while (0)
-
-#define FP_PACK_QP(val,X) \
- do { \
- _FP_PACK_CANONICAL(Q,4,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_4_P(Q,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_Q(val,X) \
- do { \
- _FP_PACK_SEMIRAW(Q,4,X); \
- _FP_PACK_RAW_4(Q,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_QP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(Q,4,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_4_P(Q,val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN(Q,4,X)
-#define FP_NEG_Q(R,X) _FP_NEG(Q,4,R,X)
-#define FP_ADD_Q(R,X,Y) _FP_ADD(Q,4,R,X,Y)
-#define FP_SUB_Q(R,X,Y) _FP_SUB(Q,4,R,X,Y)
-#define FP_MUL_Q(R,X,Y) _FP_MUL(Q,4,R,X,Y)
-#define FP_DIV_Q(R,X,Y) _FP_DIV(Q,4,R,X,Y)
-#define FP_SQRT_Q(R,X) _FP_SQRT(Q,4,R,X)
-#define _FP_SQRT_MEAT_Q(R,S,T,X,Q) _FP_SQRT_MEAT_4(R,S,T,X,Q)
-#define FP_FMA_Q(R,X,Y,Z) _FP_FMA(Q,4,8,R,X,Y,Z)
-
-#define FP_CMP_Q(r,X,Y,un) _FP_CMP(Q,4,r,X,Y,un)
-#define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,4,r,X,Y)
-#define FP_CMP_UNORD_Q(r,X,Y) _FP_CMP_UNORD(Q,4,r,X,Y)
-
-#define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,4,r,X,rsz,rsg)
-#define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,4,X,r,rs,rt)
-
-#define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4(X)
-#define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_4(X)
-
-#define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_8(X)
+# define FP_DECL_Q(X) _FP_DECL (4, X)
+# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_4 (Q, X, val)
+# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_4_P (Q, X, val)
+# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_4 (Q, val, X)
+# define FP_PACK_RAW_QP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_4_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_Q(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_4 (Q, X, val); \
+ _FP_UNPACK_CANONICAL (Q, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_QP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_4_P (Q, X, val); \
+ _FP_UNPACK_CANONICAL (Q, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_Q(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_4 (Q, X, val); \
+ _FP_UNPACK_SEMIRAW (Q, 4, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_QP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_4_P (Q, X, val); \
+ _FP_UNPACK_SEMIRAW (Q, 4, X); \
+ } \
+ while (0)
+
+# define FP_PACK_Q(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (Q, 4, X); \
+ _FP_PACK_RAW_4 (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_QP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (Q, 4, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_4_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_Q(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (Q, 4, X); \
+ _FP_PACK_RAW_4 (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_QP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (Q, 4, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_4_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN (Q, 4, X)
+# define FP_NEG_Q(R, X) _FP_NEG (Q, 4, R, X)
+# define FP_ADD_Q(R, X, Y) _FP_ADD (Q, 4, R, X, Y)
+# define FP_SUB_Q(R, X, Y) _FP_SUB (Q, 4, R, X, Y)
+# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
+# define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 4, R, X, Y)
+# define FP_SQRT_Q(R, X) _FP_SQRT (Q, 4, R, X)
+# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_4 (R, S, T, X, Q)
+# define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 4, 8, R, X, Y, Z)
+
+# define FP_CMP_Q(r, X, Y, un) _FP_CMP (Q, 4, r, X, Y, un)
+# define FP_CMP_EQ_Q(r, X, Y) _FP_CMP_EQ (Q, 4, r, X, Y)
+# define FP_CMP_UNORD_Q(r, X, Y) _FP_CMP_UNORD (Q, 4, r, X, Y)
+
+# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 4, r, X, rsz, rsg)
+# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 4, X, r, rs, rt)
+
+# define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4 (X)
+# define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_4 (X)
+
+# define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_8 (X)
#else /* not _FP_W_TYPE_SIZE < 64 */
union _FP_UNION_Q
{
- TFtype flt /* __attribute__((mode(TF))) */ ;
- struct _FP_STRUCT_LAYOUT {
+ TFtype flt /* __attribute__ ((mode (TF))) */ ;
+ struct _FP_STRUCT_LAYOUT
+ {
_FP_W_TYPE a, b;
} longs;
- struct _FP_STRUCT_LAYOUT {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct _FP_STRUCT_LAYOUT
+ {
+# if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_Q;
_FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
_FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
-#else
+# else
_FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
_FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
unsigned exp : _FP_EXPBITS_Q;
unsigned sign : 1;
-#endif
+# endif
} bits;
};
-#define FP_DECL_Q(X) _FP_DECL(2,X)
-#define FP_UNPACK_RAW_Q(X,val) _FP_UNPACK_RAW_2(Q,X,val)
-#define FP_UNPACK_RAW_QP(X,val) _FP_UNPACK_RAW_2_P(Q,X,val)
-#define FP_PACK_RAW_Q(val,X) _FP_PACK_RAW_2(Q,val,X)
-#define FP_PACK_RAW_QP(val,X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(Q,val,X); \
- } while (0)
-
-#define FP_UNPACK_Q(X,val) \
- do { \
- _FP_UNPACK_RAW_2(Q,X,val); \
- _FP_UNPACK_CANONICAL(Q,2,X); \
- } while (0)
-
-#define FP_UNPACK_QP(X,val) \
- do { \
- _FP_UNPACK_RAW_2_P(Q,X,val); \
- _FP_UNPACK_CANONICAL(Q,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_Q(X,val) \
- do { \
- _FP_UNPACK_RAW_2(Q,X,val); \
- _FP_UNPACK_SEMIRAW(Q,2,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_QP(X,val) \
- do { \
- _FP_UNPACK_RAW_2_P(Q,X,val); \
- _FP_UNPACK_SEMIRAW(Q,2,X); \
- } while (0)
-
-#define FP_PACK_Q(val,X) \
- do { \
- _FP_PACK_CANONICAL(Q,2,X); \
- _FP_PACK_RAW_2(Q,val,X); \
- } while (0)
-
-#define FP_PACK_QP(val,X) \
- do { \
- _FP_PACK_CANONICAL(Q,2,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(Q,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_Q(val,X) \
- do { \
- _FP_PACK_SEMIRAW(Q,2,X); \
- _FP_PACK_RAW_2(Q,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_QP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(Q,2,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_2_P(Q,val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN(Q,2,X)
-#define FP_NEG_Q(R,X) _FP_NEG(Q,2,R,X)
-#define FP_ADD_Q(R,X,Y) _FP_ADD(Q,2,R,X,Y)
-#define FP_SUB_Q(R,X,Y) _FP_SUB(Q,2,R,X,Y)
-#define FP_MUL_Q(R,X,Y) _FP_MUL(Q,2,R,X,Y)
-#define FP_DIV_Q(R,X,Y) _FP_DIV(Q,2,R,X,Y)
-#define FP_SQRT_Q(R,X) _FP_SQRT(Q,2,R,X)
-#define _FP_SQRT_MEAT_Q(R,S,T,X,Q) _FP_SQRT_MEAT_2(R,S,T,X,Q)
-#define FP_FMA_Q(R,X,Y,Z) _FP_FMA(Q,2,4,R,X,Y,Z)
-
-#define FP_CMP_Q(r,X,Y,un) _FP_CMP(Q,2,r,X,Y,un)
-#define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,2,r,X,Y)
-#define FP_CMP_UNORD_Q(r,X,Y) _FP_CMP_UNORD(Q,2,r,X,Y)
-
-#define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,2,r,X,rsz,rsg)
-#define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,2,X,r,rs,rt)
-
-#define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2(X)
-#define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_2(X)
-
-#define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_4(X)
+# define FP_DECL_Q(X) _FP_DECL (2, X)
+# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_2 (Q, X, val)
+# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_2_P (Q, X, val)
+# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_2 (Q, val, X)
+# define FP_PACK_RAW_QP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_Q(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2 (Q, X, val); \
+ _FP_UNPACK_CANONICAL (Q, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_QP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2_P (Q, X, val); \
+ _FP_UNPACK_CANONICAL (Q, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_Q(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2 (Q, X, val); \
+ _FP_UNPACK_SEMIRAW (Q, 2, X); \
+ } \
+ while (0)
+
+# define FP_UNPACK_SEMIRAW_QP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_2_P (Q, X, val); \
+ _FP_UNPACK_SEMIRAW (Q, 2, X); \
+ } \
+ while (0)
+
+# define FP_PACK_Q(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (Q, 2, X); \
+ _FP_PACK_RAW_2 (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_QP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (Q, 2, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_Q(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (Q, 2, X); \
+ _FP_PACK_RAW_2 (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_PACK_SEMIRAW_QP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (Q, 2, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P (Q, val, X); \
+ } \
+ while (0)
+
+# define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN (Q, 2, X)
+# define FP_NEG_Q(R, X) _FP_NEG (Q, 2, R, X)
+# define FP_ADD_Q(R, X, Y) _FP_ADD (Q, 2, R, X, Y)
+# define FP_SUB_Q(R, X, Y) _FP_SUB (Q, 2, R, X, Y)
+# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 2, R, X, Y)
+# define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 2, R, X, Y)
+# define FP_SQRT_Q(R, X) _FP_SQRT (Q, 2, R, X)
+# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, Q)
+# define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 2, 4, R, X, Y, Z)
+
+# define FP_CMP_Q(r, X, Y, un) _FP_CMP (Q, 2, r, X, Y, un)
+# define FP_CMP_EQ_Q(r, X, Y) _FP_CMP_EQ (Q, 2, r, X, Y)
+# define FP_CMP_UNORD_Q(r, X, Y) _FP_CMP_UNORD (Q, 2, r, X, Y)
+
+# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 2, r, X, rsz, rsg)
+# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 2, X, r, rs, rt)
+
+# define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2 (X)
+# define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_2 (X)
+
+# define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_4 (X)
#endif /* not _FP_W_TYPE_SIZE < 64 */
diff --git a/libc/soft-fp/single.h b/libc/soft-fp/single.h
index c94f31f99..af60c96e6 100644
--- a/libc/soft-fp/single.h
+++ b/libc/soft-fp/single.h
@@ -31,7 +31,7 @@
<http://www.gnu.org/licenses/>. */
#if _FP_W_TYPE_SIZE < 32
-#error "Here's a nickel kid. Go buy yourself a real computer."
+# error "Here's a nickel kid. Go buy yourself a real computer."
#endif
#define _FP_FRACTBITS_S _FP_W_TYPE_SIZE
@@ -49,26 +49,27 @@
#define _FP_EXPBITS_S 8
#define _FP_EXPBIAS_S 127
#define _FP_EXPMAX_S 255
-#define _FP_QNANBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
-#define _FP_QNANBIT_SH_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2+_FP_WORKBITS))
-#define _FP_IMPLBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
-#define _FP_IMPLBIT_SH_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1+_FP_WORKBITS))
-#define _FP_OVERFLOW_S ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
+#define _FP_QNANBIT_S ((_FP_W_TYPE) 1 << (_FP_FRACBITS_S-2))
+#define _FP_QNANBIT_SH_S ((_FP_W_TYPE) 1 << (_FP_FRACBITS_S-2+_FP_WORKBITS))
+#define _FP_IMPLBIT_S ((_FP_W_TYPE) 1 << (_FP_FRACBITS_S-1))
+#define _FP_IMPLBIT_SH_S ((_FP_W_TYPE) 1 << (_FP_FRACBITS_S-1+_FP_WORKBITS))
+#define _FP_OVERFLOW_S ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_S))
#define _FP_WFRACBITS_DW_S (2 * _FP_WFRACBITS_S)
#define _FP_WFRACXBITS_DW_S (_FP_FRACTBITS_DW_S - _FP_WFRACBITS_DW_S)
#define _FP_HIGHBIT_DW_S \
- ((_FP_W_TYPE)1 << (_FP_WFRACBITS_DW_S - 1) % _FP_W_TYPE_SIZE)
+ ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_S - 1) % _FP_W_TYPE_SIZE)
/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
chosen by the target machine. */
-typedef float SFtype __attribute__((mode(SF)));
+typedef float SFtype __attribute__ ((mode (SF)));
union _FP_UNION_S
{
SFtype flt;
- struct _FP_STRUCT_LAYOUT {
+ struct _FP_STRUCT_LAYOUT
+ {
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_S;
@@ -78,96 +79,114 @@ union _FP_UNION_S
unsigned exp : _FP_EXPBITS_S;
unsigned sign : 1;
#endif
- } bits __attribute__((packed));
+ } bits __attribute__ ((packed));
};
-#define FP_DECL_S(X) _FP_DECL(1,X)
-#define FP_UNPACK_RAW_S(X,val) _FP_UNPACK_RAW_1(S,X,val)
-#define FP_UNPACK_RAW_SP(X,val) _FP_UNPACK_RAW_1_P(S,X,val)
-#define FP_PACK_RAW_S(val,X) _FP_PACK_RAW_1(S,val,X)
-#define FP_PACK_RAW_SP(val,X) \
- do { \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(S,val,X); \
- } while (0)
-
-#define FP_UNPACK_S(X,val) \
- do { \
- _FP_UNPACK_RAW_1(S,X,val); \
- _FP_UNPACK_CANONICAL(S,1,X); \
- } while (0)
-
-#define FP_UNPACK_SP(X,val) \
- do { \
- _FP_UNPACK_RAW_1_P(S,X,val); \
- _FP_UNPACK_CANONICAL(S,1,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_S(X,val) \
- do { \
- _FP_UNPACK_RAW_1(S,X,val); \
- _FP_UNPACK_SEMIRAW(S,1,X); \
- } while (0)
-
-#define FP_UNPACK_SEMIRAW_SP(X,val) \
- do { \
- _FP_UNPACK_RAW_1_P(S,X,val); \
- _FP_UNPACK_SEMIRAW(S,1,X); \
- } while (0)
-
-#define FP_PACK_S(val,X) \
- do { \
- _FP_PACK_CANONICAL(S,1,X); \
- _FP_PACK_RAW_1(S,val,X); \
- } while (0)
-
-#define FP_PACK_SP(val,X) \
- do { \
- _FP_PACK_CANONICAL(S,1,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(S,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_S(val,X) \
- do { \
- _FP_PACK_SEMIRAW(S,1,X); \
- _FP_PACK_RAW_1(S,val,X); \
- } while (0)
-
-#define FP_PACK_SEMIRAW_SP(val,X) \
- do { \
- _FP_PACK_SEMIRAW(S,1,X); \
- if (!FP_INHIBIT_RESULTS) \
- _FP_PACK_RAW_1_P(S,val,X); \
- } while (0)
-
-#define FP_ISSIGNAN_S(X) _FP_ISSIGNAN(S,1,X)
-#define FP_NEG_S(R,X) _FP_NEG(S,1,R,X)
-#define FP_ADD_S(R,X,Y) _FP_ADD(S,1,R,X,Y)
-#define FP_SUB_S(R,X,Y) _FP_SUB(S,1,R,X,Y)
-#define FP_MUL_S(R,X,Y) _FP_MUL(S,1,R,X,Y)
-#define FP_DIV_S(R,X,Y) _FP_DIV(S,1,R,X,Y)
-#define FP_SQRT_S(R,X) _FP_SQRT(S,1,R,X)
-#define _FP_SQRT_MEAT_S(R,S,T,X,Q) _FP_SQRT_MEAT_1(R,S,T,X,Q)
+#define FP_DECL_S(X) _FP_DECL (1, X)
+#define FP_UNPACK_RAW_S(X, val) _FP_UNPACK_RAW_1 (S, X, val)
+#define FP_UNPACK_RAW_SP(X, val) _FP_UNPACK_RAW_1_P (S, X, val)
+#define FP_PACK_RAW_S(val, X) _FP_PACK_RAW_1 (S, val, X)
+#define FP_PACK_RAW_SP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (S, val, X); \
+ } \
+ while (0)
+
+#define FP_UNPACK_S(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1 (S, X, val); \
+ _FP_UNPACK_CANONICAL (S, 1, X); \
+ } \
+ while (0)
+
+#define FP_UNPACK_SP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1_P (S, X, val); \
+ _FP_UNPACK_CANONICAL (S, 1, X); \
+ } \
+ while (0)
+
+#define FP_UNPACK_SEMIRAW_S(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1 (S, X, val); \
+ _FP_UNPACK_SEMIRAW (S, 1, X); \
+ } \
+ while (0)
+
+#define FP_UNPACK_SEMIRAW_SP(X, val) \
+ do \
+ { \
+ _FP_UNPACK_RAW_1_P (S, X, val); \
+ _FP_UNPACK_SEMIRAW (S, 1, X); \
+ } \
+ while (0)
+
+#define FP_PACK_S(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (S, 1, X); \
+ _FP_PACK_RAW_1 (S, val, X); \
+ } \
+ while (0)
+
+#define FP_PACK_SP(val, X) \
+ do \
+ { \
+ _FP_PACK_CANONICAL (S, 1, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (S, val, X); \
+ } \
+ while (0)
+
+#define FP_PACK_SEMIRAW_S(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (S, 1, X); \
+ _FP_PACK_RAW_1 (S, val, X); \
+ } \
+ while (0)
+
+#define FP_PACK_SEMIRAW_SP(val, X) \
+ do \
+ { \
+ _FP_PACK_SEMIRAW (S, 1, X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P (S, val, X); \
+ } \
+ while (0)
+
+#define FP_ISSIGNAN_S(X) _FP_ISSIGNAN (S, 1, X)
+#define FP_NEG_S(R, X) _FP_NEG (S, 1, R, X)
+#define FP_ADD_S(R, X, Y) _FP_ADD (S, 1, R, X, Y)
+#define FP_SUB_S(R, X, Y) _FP_SUB (S, 1, R, X, Y)
+#define FP_MUL_S(R, X, Y) _FP_MUL (S, 1, R, X, Y)
+#define FP_DIV_S(R, X, Y) _FP_DIV (S, 1, R, X, Y)
+#define FP_SQRT_S(R, X) _FP_SQRT (S, 1, R, X)
+#define _FP_SQRT_MEAT_S(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, Q)
#if _FP_W_TYPE_SIZE < 64
-# define FP_FMA_S(R, X, Y, Z) _FP_FMA(S, 1, 2, R, X, Y, Z)
+# define FP_FMA_S(R, X, Y, Z) _FP_FMA (S, 1, 2, R, X, Y, Z)
#else
-# define FP_FMA_S(R, X, Y, Z) _FP_FMA(S, 1, 1, R, X, Y, Z)
+# define FP_FMA_S(R, X, Y, Z) _FP_FMA (S, 1, 1, R, X, Y, Z)
#endif
-#define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
-#define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
-#define FP_CMP_UNORD_S(r,X,Y) _FP_CMP_UNORD(S,1,r,X,Y)
+#define FP_CMP_S(r, X, Y, un) _FP_CMP (S, 1, r, X, Y, un)
+#define FP_CMP_EQ_S(r, X, Y) _FP_CMP_EQ (S, 1, r, X, Y)
+#define FP_CMP_UNORD_S(r, X, Y) _FP_CMP_UNORD (S, 1, r, X, Y)
-#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
-#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)
+#define FP_TO_INT_S(r, X, rsz, rsg) _FP_TO_INT (S, 1, r, X, rsz, rsg)
+#define FP_FROM_INT_S(X, r, rs, rt) _FP_FROM_INT (S, 1, X, r, rs, rt)
-#define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1(X)
-#define _FP_FRAC_HIGH_RAW_S(X) _FP_FRAC_HIGH_1(X)
+#define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1 (X)
+#define _FP_FRAC_HIGH_RAW_S(X) _FP_FRAC_HIGH_1 (X)
#if _FP_W_TYPE_SIZE < 64
-# define _FP_FRAC_HIGH_DW_S(X) _FP_FRAC_HIGH_2(X)
+# define _FP_FRAC_HIGH_DW_S(X) _FP_FRAC_HIGH_2 (X)
#else
-# define _FP_FRAC_HIGH_DW_S(X) _FP_FRAC_HIGH_1(X)
+# define _FP_FRAC_HIGH_DW_S(X) _FP_FRAC_HIGH_1 (X)
#endif
diff --git a/libc/soft-fp/soft-fp.h b/libc/soft-fp/soft-fp.h
index b1c6e619b..696fc8676 100644
--- a/libc/soft-fp/soft-fp.h
+++ b/libc/soft-fp/soft-fp.h
@@ -33,25 +33,25 @@
#define SOFT_FP_H
#ifdef _LIBC
-#include <sfp-machine.h>
+# include <sfp-machine.h>
#else
-#include "sfp-machine.h"
+# include "sfp-machine.h"
#endif
/* Allow sfp-machine to have its own byte order definitions. */
#ifndef __BYTE_ORDER
-#ifdef _LIBC
-#include <endian.h>
-#else
-#error "endianness not defined by sfp-machine.h"
-#endif
+# ifdef _LIBC
+# include <endian.h>
+# else
+# error "endianness not defined by sfp-machine.h"
+# endif
#endif
#define _FP_WORKBITS 3
-#define _FP_WORK_LSB ((_FP_W_TYPE)1 << 3)
-#define _FP_WORK_ROUND ((_FP_W_TYPE)1 << 2)
-#define _FP_WORK_GUARD ((_FP_W_TYPE)1 << 1)
-#define _FP_WORK_STICKY ((_FP_W_TYPE)1 << 0)
+#define _FP_WORK_LSB ((_FP_W_TYPE) 1 << 3)
+#define _FP_WORK_ROUND ((_FP_W_TYPE) 1 << 2)
+#define _FP_WORK_GUARD ((_FP_W_TYPE) 1 << 1)
+#define _FP_WORK_STICKY ((_FP_W_TYPE) 1 << 0)
#ifndef FP_RND_NEAREST
# define FP_RND_NEAREST 0
@@ -65,22 +65,22 @@
/* By default don't care about exceptions. */
#ifndef FP_EX_INVALID
-#define FP_EX_INVALID 0
+# define FP_EX_INVALID 0
#endif
#ifndef FP_EX_OVERFLOW
-#define FP_EX_OVERFLOW 0
+# define FP_EX_OVERFLOW 0
#endif
#ifndef FP_EX_UNDERFLOW
-#define FP_EX_UNDERFLOW 0
+# define FP_EX_UNDERFLOW 0
#endif
#ifndef FP_EX_DIVZERO
-#define FP_EX_DIVZERO 0
+# define FP_EX_DIVZERO 0
#endif
#ifndef FP_EX_INEXACT
-#define FP_EX_INEXACT 0
+# define FP_EX_INEXACT 0
#endif
#ifndef FP_EX_DENORM
-#define FP_EX_DENORM 0
+# define FP_EX_DENORM 0
#endif
/* _FP_STRUCT_LAYOUT may be defined as an attribute to determine the
@@ -90,23 +90,31 @@
differences in how consecutive bit-fields are laid out from the
default expected by soft-fp. */
#ifndef _FP_STRUCT_LAYOUT
-#define _FP_STRUCT_LAYOUT
+# define _FP_STRUCT_LAYOUT
#endif
#ifdef _FP_DECL_EX
-#define FP_DECL_EX \
+# define FP_DECL_EX \
int _fex = 0; \
_FP_DECL_EX
#else
-#define FP_DECL_EX int _fex = 0
+# define FP_DECL_EX int _fex = 0
#endif
+/* Initialize any machine-specific state used in FP_ROUNDMODE,
+ FP_TRAPPING_EXCEPTIONS or FP_HANDLE_EXCEPTIONS. */
#ifndef FP_INIT_ROUNDMODE
-#define FP_INIT_ROUNDMODE do {} while (0)
+# define FP_INIT_ROUNDMODE do {} while (0)
+#endif
+
+/* Initialize any machine-specific state used in
+ FP_HANDLE_EXCEPTIONS. */
+#ifndef FP_INIT_EXCEPTIONS
+# define FP_INIT_EXCEPTIONS FP_INIT_ROUNDMODE
#endif
#ifndef FP_HANDLE_EXCEPTIONS
-#define FP_HANDLE_EXCEPTIONS do {} while (0)
+# define FP_HANDLE_EXCEPTIONS do {} while (0)
#endif
#ifndef FP_INHIBIT_RESULTS
@@ -115,15 +123,12 @@
* check if some exceptions are unmasked
* and inhibit it in such a case.
*/
-#define FP_INHIBIT_RESULTS 0
+# define FP_INHIBIT_RESULTS 0
#endif
#define FP_SET_EXCEPTION(ex) \
_fex |= (ex)
-#define FP_UNSET_EXCEPTION(ex) \
- _fex &= ~(ex)
-
#define FP_CLEAR_EXCEPTIONS \
_fex = 0
@@ -131,58 +136,90 @@
(_fex)
#ifndef FP_TRAPPING_EXCEPTIONS
-#define FP_TRAPPING_EXCEPTIONS 0
+# define FP_TRAPPING_EXCEPTIONS 0
#endif
-#define _FP_ROUND_NEAREST(wc, X) \
-do { \
- if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND) \
- _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
-} while (0)
+/* A file using soft-fp may define FP_NO_EXCEPTIONS before including
+ soft-fp.h to indicate that, although a macro used there could raise
+ exceptions, or do rounding and potentially thereby raise
+ exceptions, for some arguments, for the particular arguments used
+ in that file no exceptions or rounding can occur. Such a file
+ should not itself use macros relating to handling exceptions and
+ rounding modes; this is only for indirect uses (in particular, in
+ _FP_FROM_INT and the macros it calls). */
+#ifdef FP_NO_EXCEPTIONS
-#define _FP_ROUND_ZERO(wc, X) (void)0
+# undef FP_SET_EXCEPTION
+# define FP_SET_EXCEPTION(ex) do {} while (0)
-#define _FP_ROUND_PINF(wc, X) \
-do { \
- if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
- _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
-} while (0)
+# undef FP_CUR_EXCEPTIONS
+# define FP_CUR_EXCEPTIONS 0
-#define _FP_ROUND_MINF(wc, X) \
-do { \
- if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
- _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
-} while (0)
+# undef FP_TRAPPING_EXCEPTIONS
+# define FP_TRAPPING_EXCEPTIONS 0
+
+# undef FP_ROUNDMODE
+# define FP_ROUNDMODE FP_RND_ZERO
+
+#endif
+
+#define _FP_ROUND_NEAREST(wc, X) \
+ do \
+ { \
+ if ((_FP_FRAC_LOW_##wc (X) & 15) != _FP_WORK_ROUND) \
+ _FP_FRAC_ADDI_##wc (X, _FP_WORK_ROUND); \
+ } \
+ while (0)
+
+#define _FP_ROUND_ZERO(wc, X) (void) 0
+
+#define _FP_ROUND_PINF(wc, X) \
+ do \
+ { \
+ if (!X##_s && (_FP_FRAC_LOW_##wc (X) & 7)) \
+ _FP_FRAC_ADDI_##wc (X, _FP_WORK_LSB); \
+ } \
+ while (0)
+
+#define _FP_ROUND_MINF(wc, X) \
+ do \
+ { \
+ if (X##_s && (_FP_FRAC_LOW_##wc (X) & 7)) \
+ _FP_FRAC_ADDI_##wc (X, _FP_WORK_LSB); \
+ } \
+ while (0)
#define _FP_ROUND(wc, X) \
-do { \
- if (_FP_FRAC_LOW_##wc(X) & 7) \
- { \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
- switch (FP_ROUNDMODE) \
- { \
- case FP_RND_NEAREST: \
- _FP_ROUND_NEAREST(wc,X); \
- break; \
- case FP_RND_ZERO: \
- _FP_ROUND_ZERO(wc,X); \
- break; \
- case FP_RND_PINF: \
- _FP_ROUND_PINF(wc,X); \
- break; \
- case FP_RND_MINF: \
- _FP_ROUND_MINF(wc,X); \
- break; \
- } \
- } \
-} while (0)
+ do \
+ { \
+ if (_FP_FRAC_LOW_##wc (X) & 7) \
+ { \
+ FP_SET_EXCEPTION (FP_EX_INEXACT); \
+ switch (FP_ROUNDMODE) \
+ { \
+ case FP_RND_NEAREST: \
+ _FP_ROUND_NEAREST (wc, X); \
+ break; \
+ case FP_RND_ZERO: \
+ _FP_ROUND_ZERO (wc, X); \
+ break; \
+ case FP_RND_PINF: \
+ _FP_ROUND_PINF (wc, X); \
+ break; \
+ case FP_RND_MINF: \
+ _FP_ROUND_MINF (wc, X); \
+ break; \
+ } \
+ } \
+ } \
+ while (0)
#define FP_CLS_NORMAL 0
#define FP_CLS_ZERO 1
#define FP_CLS_INF 2
#define FP_CLS_NAN 3
-#define _FP_CLS_COMBINE(x,y) (((x) << 2) | (y))
+#define _FP_CLS_COMBINE(x, y) (((x) << 2) | (y))
#include "op-1.h"
#include "op-2.h"
@@ -194,35 +231,35 @@ do { \
#define UWtype _FP_W_TYPE
#define W_TYPE_SIZE _FP_W_TYPE_SIZE
-typedef int QItype __attribute__((mode(QI)));
-typedef int SItype __attribute__((mode(SI)));
-typedef int DItype __attribute__((mode(DI)));
-typedef unsigned int UQItype __attribute__((mode(QI)));
-typedef unsigned int USItype __attribute__((mode(SI)));
-typedef unsigned int UDItype __attribute__((mode(DI)));
+typedef int QItype __attribute__ ((mode (QI)));
+typedef int SItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UQItype __attribute__ ((mode (QI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
#if _FP_W_TYPE_SIZE == 32
-typedef unsigned int UHWtype __attribute__((mode(HI)));
+typedef unsigned int UHWtype __attribute__ ((mode (HI)));
#elif _FP_W_TYPE_SIZE == 64
typedef USItype UHWtype;
#endif
#ifndef CMPtype
-#define CMPtype int
+# define CMPtype int
#endif
-#define SI_BITS (__CHAR_BIT__ * (int)sizeof(SItype))
-#define DI_BITS (__CHAR_BIT__ * (int)sizeof(DItype))
+#define SI_BITS (__CHAR_BIT__ * (int) sizeof (SItype))
+#define DI_BITS (__CHAR_BIT__ * (int) sizeof (DItype))
#ifndef umul_ppmm
-#ifdef _LIBC
-#include <stdlib/longlong.h>
-#else
-#include "longlong.h"
-#endif
+# ifdef _LIBC
+# include <stdlib/longlong.h>
+# else
+# include "longlong.h"
+# endif
#endif
#ifdef _LIBC
-#include <stdlib.h>
+# include <stdlib.h>
#else
extern void abort (void);
#endif
diff --git a/libc/soft-fp/sqrtdf2.c b/libc/soft-fp/sqrtdf2.c
index eaa510d3e..266e1925a 100644
--- a/libc/soft-fp/sqrtdf2.c
+++ b/libc/soft-fp/sqrtdf2.c
@@ -31,16 +31,18 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __sqrtdf2(DFtype a)
+DFtype
+__sqrtdf2 (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_D(A, a);
- FP_SQRT_D(R, A);
- FP_PACK_D(r, R);
+ FP_UNPACK_D (A, a);
+ FP_SQRT_D (R, A);
+ FP_PACK_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/sqrtsf2.c b/libc/soft-fp/sqrtsf2.c
index eb6c4c8cc..ded6e87f5 100644
--- a/libc/soft-fp/sqrtsf2.c
+++ b/libc/soft-fp/sqrtsf2.c
@@ -31,16 +31,18 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __sqrtsf2(SFtype a)
+SFtype
+__sqrtsf2 (SFtype a)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_S(A, a);
- FP_SQRT_S(R, A);
- FP_PACK_S(r, R);
+ FP_UNPACK_S (A, a);
+ FP_SQRT_S (R, A);
+ FP_PACK_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/sqrttf2.c b/libc/soft-fp/sqrttf2.c
index 40b35830e..9f3e7187b 100644
--- a/libc/soft-fp/sqrttf2.c
+++ b/libc/soft-fp/sqrttf2.c
@@ -31,16 +31,18 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __sqrttf2(TFtype a)
+TFtype
+__sqrttf2 (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (R);
TFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_Q(A, a);
- FP_SQRT_Q(R, A);
- FP_PACK_Q(r, R);
+ FP_UNPACK_Q (A, a);
+ FP_SQRT_Q (R, A);
+ FP_PACK_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/subdf3.c b/libc/soft-fp/subdf3.c
index 032ac0f29..6846e98db 100644
--- a/libc/soft-fp/subdf3.c
+++ b/libc/soft-fp/subdf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "double.h"
-DFtype __subdf3(DFtype a, DFtype b)
+DFtype
+__subdf3 (DFtype a, DFtype b)
{
FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(R);
+ FP_DECL_D (A);
+ FP_DECL_D (B);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_D(A, a);
- FP_UNPACK_SEMIRAW_D(B, b);
- FP_SUB_D(R, A, B);
- FP_PACK_SEMIRAW_D(r, R);
+ FP_UNPACK_SEMIRAW_D (A, a);
+ FP_UNPACK_SEMIRAW_D (B, b);
+ FP_SUB_D (R, A, B);
+ FP_PACK_SEMIRAW_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/subsf3.c b/libc/soft-fp/subsf3.c
index c9f56c717..d46ddf58a 100644
--- a/libc/soft-fp/subsf3.c
+++ b/libc/soft-fp/subsf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "single.h"
-SFtype __subsf3(SFtype a, SFtype b)
+SFtype
+__subsf3 (SFtype a, SFtype b)
{
FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R);
+ FP_DECL_S (A);
+ FP_DECL_S (B);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_S(A, a);
- FP_UNPACK_SEMIRAW_S(B, b);
- FP_SUB_S(R, A, B);
- FP_PACK_SEMIRAW_S(r, R);
+ FP_UNPACK_SEMIRAW_S (A, a);
+ FP_UNPACK_SEMIRAW_S (B, b);
+ FP_SUB_S (R, A, B);
+ FP_PACK_SEMIRAW_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/subtf3.c b/libc/soft-fp/subtf3.c
index a111d571e..88c6edeb6 100644
--- a/libc/soft-fp/subtf3.c
+++ b/libc/soft-fp/subtf3.c
@@ -31,17 +31,20 @@
#include "soft-fp.h"
#include "quad.h"
-TFtype __subtf3(TFtype a, TFtype b)
+TFtype
+__subtf3 (TFtype a, TFtype b)
{
FP_DECL_EX;
- FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(R);
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
+ FP_DECL_Q (R);
TFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_Q(A, a);
- FP_UNPACK_SEMIRAW_Q(B, b);
- FP_SUB_Q(R, A, B);
- FP_PACK_SEMIRAW_Q(r, R);
+ FP_UNPACK_SEMIRAW_Q (A, a);
+ FP_UNPACK_SEMIRAW_Q (B, b);
+ FP_SUB_Q (R, A, B);
+ FP_PACK_SEMIRAW_Q (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/truncdfsf2.c b/libc/soft-fp/truncdfsf2.c
index e9a722367..3ec56fdf8 100644
--- a/libc/soft-fp/truncdfsf2.c
+++ b/libc/soft-fp/truncdfsf2.c
@@ -32,21 +32,22 @@
#include "single.h"
#include "double.h"
-SFtype __truncdfsf2(DFtype a)
+SFtype
+__truncdfsf2 (DFtype a)
{
FP_DECL_EX;
- FP_DECL_D(A);
- FP_DECL_S(R);
+ FP_DECL_D (A);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_D(A, a);
+ FP_UNPACK_SEMIRAW_D (A, a);
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
- FP_TRUNC(S,D,1,2,R,A);
+ FP_TRUNC (S, D, 1, 2, R, A);
#else
- FP_TRUNC(S,D,1,1,R,A);
+ FP_TRUNC (S, D, 1, 1, R, A);
#endif
- FP_PACK_SEMIRAW_S(r, R);
+ FP_PACK_SEMIRAW_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/trunctfdf2.c b/libc/soft-fp/trunctfdf2.c
index 35c649636..e97021012 100644
--- a/libc/soft-fp/trunctfdf2.c
+++ b/libc/soft-fp/trunctfdf2.c
@@ -32,21 +32,22 @@
#include "double.h"
#include "quad.h"
-DFtype __trunctfdf2(TFtype a)
+DFtype
+__trunctfdf2 (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
- FP_DECL_D(R);
+ FP_DECL_Q (A);
+ FP_DECL_D (R);
DFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_Q(A, a);
+ FP_UNPACK_SEMIRAW_Q (A, a);
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
- FP_TRUNC(D,Q,2,4,R,A);
+ FP_TRUNC (D, Q, 2, 4, R, A);
#else
- FP_TRUNC(D,Q,1,2,R,A);
+ FP_TRUNC (D, Q, 1, 2, R, A);
#endif
- FP_PACK_SEMIRAW_D(r, R);
+ FP_PACK_SEMIRAW_D (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/trunctfsf2.c b/libc/soft-fp/trunctfsf2.c
index 751c7c8d7..d8a3728a0 100644
--- a/libc/soft-fp/trunctfsf2.c
+++ b/libc/soft-fp/trunctfsf2.c
@@ -32,21 +32,22 @@
#include "single.h"
#include "quad.h"
-SFtype __trunctfsf2(TFtype a)
+SFtype
+__trunctfsf2 (TFtype a)
{
FP_DECL_EX;
- FP_DECL_Q(A);
- FP_DECL_S(R);
+ FP_DECL_Q (A);
+ FP_DECL_S (R);
SFtype r;
FP_INIT_ROUNDMODE;
- FP_UNPACK_SEMIRAW_Q(A, a);
+ FP_UNPACK_SEMIRAW_Q (A, a);
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
- FP_TRUNC(S,Q,1,4,R,A);
+ FP_TRUNC (S, Q, 1, 4, R, A);
#else
- FP_TRUNC(S,Q,1,2,R,A);
+ FP_TRUNC (S, Q, 1, 2, R, A);
#endif
- FP_PACK_SEMIRAW_S(r, R);
+ FP_PACK_SEMIRAW_S (r, R);
FP_HANDLE_EXCEPTIONS;
return r;
diff --git a/libc/soft-fp/trunctfxf2.c b/libc/soft-fp/trunctfxf2.c
new file mode 100644
index 000000000..750bec180
--- /dev/null
+++ b/libc/soft-fp/trunctfxf2.c
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+ Truncate IEEE quad into IEEE extended
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Uros Bizjak (ubizjak@gmail.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.
+
+ 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 into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "extended.h"
+#include "quad.h"
+
+XFtype
+__trunctfxf2 (TFtype a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_E (R);
+ XFtype r;
+
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_SEMIRAW_Q (A, a);
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+ FP_TRUNC (E, Q, 4, 4, R, A);
+#else
+ FP_TRUNC (E, Q, 2, 2, R, A);
+#endif
+ FP_PACK_SEMIRAW_E (r, R);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
diff --git a/libc/soft-fp/unorddf2.c b/libc/soft-fp/unorddf2.c
index 2e77f2d8f..641c86972 100644
--- a/libc/soft-fp/unorddf2.c
+++ b/libc/soft-fp/unorddf2.c
@@ -30,14 +30,21 @@
#include "soft-fp.h"
#include "double.h"
-CMPtype __unorddf2(DFtype a, DFtype b)
+CMPtype
+__unorddf2 (DFtype a, DFtype b)
{
- FP_DECL_D(A); FP_DECL_D(B);
+ FP_DECL_EX;
+ FP_DECL_D (A);
+ FP_DECL_D (B);
CMPtype r;
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_UNORD_D(r, A, B);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_D (A, a);
+ FP_UNPACK_RAW_D (B, b);
+ FP_CMP_UNORD_D (r, A, B);
+ if (r && (FP_ISSIGNAN_D (A) || FP_ISSIGNAN_D (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
+ FP_HANDLE_EXCEPTIONS;
return r;
}
diff --git a/libc/soft-fp/unordsf2.c b/libc/soft-fp/unordsf2.c
index b5b5322c1..f27142128 100644
--- a/libc/soft-fp/unordsf2.c
+++ b/libc/soft-fp/unordsf2.c
@@ -30,15 +30,21 @@
#include "soft-fp.h"
#include "single.h"
-CMPtype __unordsf2(SFtype a, SFtype b)
+CMPtype
+__unordsf2 (SFtype a, SFtype b)
{
- FP_DECL_S(A);
- FP_DECL_S(B);
+ FP_DECL_EX;
+ FP_DECL_S (A);
+ FP_DECL_S (B);
CMPtype r;
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_UNORD_S(r, A, B);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_S (A, a);
+ FP_UNPACK_RAW_S (B, b);
+ FP_CMP_UNORD_S (r, A, B);
+ if (r && (FP_ISSIGNAN_S (A) || FP_ISSIGNAN_S (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
+ FP_HANDLE_EXCEPTIONS;
return r;
}
diff --git a/libc/soft-fp/unordtf2.c b/libc/soft-fp/unordtf2.c
index 1a85c252c..38cc1a78b 100644
--- a/libc/soft-fp/unordtf2.c
+++ b/libc/soft-fp/unordtf2.c
@@ -30,15 +30,21 @@
#include "soft-fp.h"
#include "quad.h"
-CMPtype __unordtf2(TFtype a, TFtype b)
+CMPtype
+__unordtf2 (TFtype a, TFtype b)
{
- FP_DECL_Q(A);
- FP_DECL_Q(B);
+ FP_DECL_EX;
+ FP_DECL_Q (A);
+ FP_DECL_Q (B);
CMPtype r;
- FP_UNPACK_RAW_Q(A, a);
- FP_UNPACK_RAW_Q(B, b);
- FP_CMP_UNORD_Q(r, A, B);
+ FP_INIT_EXCEPTIONS;
+ FP_UNPACK_RAW_Q (A, a);
+ FP_UNPACK_RAW_Q (B, b);
+ FP_CMP_UNORD_Q (r, A, B);
+ if (r && (FP_ISSIGNAN_Q (A) || FP_ISSIGNAN_Q (B)))
+ FP_SET_EXCEPTION (FP_EX_INVALID);
+ FP_HANDLE_EXCEPTIONS;
return r;
}
diff --git a/libc/stdio-common/printf_fp.c b/libc/stdio-common/printf_fp.c
index 940fcc486..340f9977b 100644
--- a/libc/stdio-common/printf_fp.c
+++ b/libc/stdio-common/printf_fp.c
@@ -354,8 +354,7 @@ ___printf_fp (FILE *fp,
int res;
if (__isnanl (fpnum.ldbl))
{
- union ieee854_long_double u = { .d = fpnum.ldbl };
- is_neg = u.ieee.negative != 0;
+ is_neg = signbit (fpnum.ldbl);
if (isupper (info->spec))
{
special = "NAN";
diff --git a/libc/stdio-common/printf_fphex.c b/libc/stdio-common/printf_fphex.c
index 9b24168d9..9b0c4f31a 100644
--- a/libc/stdio-common/printf_fphex.c
+++ b/libc/stdio-common/printf_fphex.c
@@ -94,7 +94,7 @@ __printf_fphex (FILE *fp,
union
{
union ieee754_double dbl;
- union ieee854_long_double ldbl;
+ long double ldbl;
}
fpnum;
@@ -175,12 +175,11 @@ __printf_fphex (FILE *fp,
#ifndef __NO_LONG_DOUBLE_MATH
if (info->is_long_double && sizeof (long double) > sizeof (double))
{
- fpnum.ldbl.d = *(const long double *) args[0];
+ fpnum.ldbl = *(const long double *) args[0];
/* Check for special values: not a number or infinity. */
- if (__isnanl (fpnum.ldbl.d))
+ if (__isnanl (fpnum.ldbl))
{
- negative = fpnum.ldbl.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
@@ -194,8 +193,7 @@ __printf_fphex (FILE *fp,
}
else
{
- int res = __isinfl (fpnum.ldbl.d);
- if (res)
+ if (__isinfl (fpnum.ldbl))
{
if (isupper (info->spec))
{
@@ -207,11 +205,9 @@ __printf_fphex (FILE *fp,
special = "inf";
wspecial = L"inf";
}
- negative = res < 0;
}
- else
- negative = signbit (fpnum.ldbl.d);
}
+ negative = signbit (fpnum.ldbl);
}
else
#endif /* no long double */
diff --git a/libc/stdio-common/printf_size.c b/libc/stdio-common/printf_size.c
index 9a764af22..87a9c2da1 100644
--- a/libc/stdio-common/printf_size.c
+++ b/libc/stdio-common/printf_size.c
@@ -104,7 +104,7 @@ __printf_size (FILE *fp, const struct printf_info *info,
union
{
union ieee754_double dbl;
- union ieee854_long_double ldbl;
+ long double ldbl;
}
fpnum;
const void *ptr = &fpnum;
@@ -131,25 +131,25 @@ __printf_size (FILE *fp, const struct printf_info *info,
#ifndef __NO_LONG_DOUBLE_MATH
if (info->is_long_double && sizeof (long double) > sizeof (double))
{
- fpnum.ldbl.d = *(const long double *) args[0];
+ fpnum.ldbl = *(const long double *) args[0];
/* Check for special values: not a number or infinity. */
- if (__isnanl (fpnum.ldbl.d))
+ if (__isnanl (fpnum.ldbl))
{
special = "nan";
wspecial = L"nan";
// fpnum_sign = 0; Already zero
}
- else if ((res = __isinfl (fpnum.ldbl.d)))
+ else if ((res = __isinfl (fpnum.ldbl)))
{
fpnum_sign = res;
special = "inf";
wspecial = L"inf";
}
else
- while (fpnum.ldbl.d >= divisor && tag[1] != '\0')
+ while (fpnum.ldbl >= divisor && tag[1] != '\0')
{
- fpnum.ldbl.d /= divisor;
+ fpnum.ldbl /= divisor;
++tag;
}
}
diff --git a/libc/stdio-common/psiginfo-data.h b/libc/stdio-common/psiginfo-data.h
index 02ebf8af2..05bb76c17 100644
--- a/libc/stdio-common/psiginfo-data.h
+++ b/libc/stdio-common/psiginfo-data.h
@@ -34,7 +34,7 @@ P (TRAP_TRACE, N_("Process trace trap"))
#if NOW == SIGCLD
P (CLD_EXITED, N_("Child has exited"))
P (CLD_KILLED, N_("Child has terminated abnormally and did not create a core file"))
-P (CLD_DUMPED, N_("Child hat terminated abnormally and created a core file"))
+P (CLD_DUMPED, N_("Child has terminated abnormally and created a core file"))
P (CLD_TRAPPED, N_("Traced child has trapped"))
P (CLD_STOPPED, N_("Child has stopped"))
P (CLD_CONTINUED, N_("Stopped child has continued"))
diff --git a/libc/stdio-common/tst-long-dbl-fphex.c b/libc/stdio-common/tst-long-dbl-fphex.c
index 0be80cad2..a406a7180 100644
--- a/libc/stdio-common/tst-long-dbl-fphex.c
+++ b/libc/stdio-common/tst-long-dbl-fphex.c
@@ -28,9 +28,9 @@ do_test (void)
int result = 0;
const long double x = 24.5;
wchar_t a[16];
- swprintf (a, sizeof (a), L"%La\n", x);
+ swprintf (a, sizeof a / sizeof a[0], L"%La\n", x);
wchar_t A[16];
- swprintf (A, sizeof (A) / sizeof (A[0]), L"%LA\n", x);
+ swprintf (A, sizeof A / sizeof A[0], L"%LA\n", x);
/* Here wprintf can return four valid variants. We must accept all
of them. */
diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c
index 55632e493..8045bb013 100644
--- a/libc/stdio-common/vfprintf.c
+++ b/libc/stdio-common/vfprintf.c
@@ -91,13 +91,13 @@
do { \
if (width > 0) \
{ \
- unsigned int d = _IO_padn (s, (Padchar), width); \
- if (__glibc_unlikely (d == EOF)) \
+ _IO_ssize_t written = _IO_padn (s, (Padchar), width); \
+ if (__glibc_unlikely (written != width)) \
{ \
done = -1; \
goto all_done; \
} \
- done_add (d); \
+ done_add (written); \
} \
} while (0)
# define PUTC(C, F) _IO_putc_unlocked (C, F)
@@ -120,13 +120,13 @@
do { \
if (width > 0) \
{ \
- unsigned int d = _IO_wpadn (s, (Padchar), width); \
- if (__glibc_unlikely (d == EOF)) \
+ _IO_ssize_t written = _IO_wpadn (s, (Padchar), width); \
+ if (__glibc_unlikely (written != width)) \
{ \
done = -1; \
goto all_done; \
} \
- done_add (d); \
+ done_add (written); \
} \
} while (0)
# define PUTC(C, F) _IO_putwc_unlocked (C, F)
diff --git a/libc/stdlib/isomac.c b/libc/stdlib/isomac.c
index 2c9009b32..621b5154d 100644
--- a/libc/stdlib/isomac.c
+++ b/libc/stdlib/isomac.c
@@ -263,6 +263,7 @@ get_null_defines (void)
if (system (command))
{
puts ("system() returned nonzero");
+ free (command);
return NULL;
}
free (command);
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index 91cb626f7..e744cadad 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -1765,7 +1765,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
got_limb;
}
- for (i = densize; num[i] == 0 && i >= 0; --i)
+ for (i = densize; i >= 0 && num[i] == 0; --i)
;
return round_and_return (retval, exponent - 1, negative,
quot, BITS_PER_MP_LIMB - 1 - used,
diff --git a/libc/string/Makefile b/libc/string/Makefile
index 5da0fe983..3bebc75ea 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -63,6 +63,8 @@ tests-$(OPTION_EGLIBC_LOCALE_CODE) \
tests-ifunc := $(strop-tests:%=test-%-ifunc)
tests += $(tests-ifunc)
+xtests = tst-strcoll-overflow
+
include ../Rules
tester-ENV = LANGUAGE=C
diff --git a/libc/string/ffs.c b/libc/string/ffs.c
index a645224f0..916c5c348 100644
--- a/libc/string/ffs.c
+++ b/libc/string/ffs.c
@@ -46,6 +46,7 @@ __ffs (i)
return table[x >> a] + a;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
diff --git a/libc/string/strcoll_l.c b/libc/string/strcoll_l.c
index bfe11c458..b85c1c5e2 100644
--- a/libc/string/strcoll_l.c
+++ b/libc/string/strcoll_l.c
@@ -46,7 +46,7 @@
typedef struct
{
int len; /* Length of the current sequence. */
- int val; /* Position of the sequence relative to the
+ size_t val; /* Position of the sequence relative to the
previous non-ignored sequence. */
size_t idxnow; /* Current index in sequences. */
size_t idxmax; /* Maximum index in sequences. */
@@ -56,6 +56,12 @@ typedef struct
const USTRING_TYPE *us; /* The string. */
int32_t *idxarr; /* Array to cache weight indices. */
unsigned char *rulearr; /* Array to cache rules. */
+ unsigned char rule; /* Saved rule for the first sequence. */
+ int32_t idx; /* Index to weight of the current sequence. */
+ int32_t save_idx; /* Save looked up index of a forward
+ sequence after the last backward
+ sequence. */
+ const USTRING_TYPE *back_us; /* Beginning of the backward sequence. */
} coll_seq;
/* Get next sequence. The weight indices are cached, so we don't need to
@@ -65,7 +71,7 @@ get_next_seq_cached (coll_seq *seq, int nrules, int pass,
const unsigned char *rulesets,
const USTRING_TYPE *weights)
{
- int val = seq->val = 0;
+ size_t val = seq->val = 0;
int len = seq->len;
size_t backw_stop = seq->backw_stop;
size_t backw = seq->backw;
@@ -147,7 +153,7 @@ get_next_seq (coll_seq *seq, int nrules, const unsigned char *rulesets,
const USTRING_TYPE *extra, const int32_t *indirect)
{
#include WEIGHT_H
- int val = seq->val = 0;
+ size_t val = seq->val = 0;
int len = seq->len;
size_t backw_stop = seq->backw_stop;
size_t backw = seq->backw;
@@ -163,7 +169,7 @@ get_next_seq (coll_seq *seq, int nrules, const unsigned char *rulesets,
++val;
if (backw_stop != ~0ul)
{
- /* The is something pushed. */
+ /* There is something pushed. */
if (backw == backw_stop)
{
/* The last pushed character was handled. Continue
@@ -228,15 +234,199 @@ get_next_seq (coll_seq *seq, int nrules, const unsigned char *rulesets,
seq->us = us;
}
-/* Compare two sequences. */
+/* Get next sequence. Traverse the string as required. This function does not
+ set or use any index or rule cache. */
+static void
+get_next_seq_nocache (coll_seq *seq, int nrules, const unsigned char *rulesets,
+ const USTRING_TYPE *weights, const int32_t *table,
+ const USTRING_TYPE *extra, const int32_t *indirect,
+ int pass)
+{
+#include WEIGHT_H
+ size_t val = seq->val = 0;
+ int len = seq->len;
+ size_t backw_stop = seq->backw_stop;
+ size_t backw = seq->backw;
+ size_t idxcnt = seq->idxcnt;
+ size_t idxmax = seq->idxmax;
+ int32_t idx = seq->idx;
+ const USTRING_TYPE *us = seq->us;
+
+ while (len == 0)
+ {
+ ++val;
+ if (backw_stop != ~0ul)
+ {
+ /* There is something pushed. */
+ if (backw == backw_stop)
+ {
+ /* The last pushed character was handled. Continue
+ with forward characters. */
+ if (idxcnt < idxmax)
+ {
+ idx = seq->save_idx;
+ backw_stop = ~0ul;
+ }
+ else
+ {
+ /* Nothing anymore. The backward sequence ended with
+ the last sequence in the string. Note that len is
+ still zero. */
+ idx = 0;
+ break;
+ }
+ }
+ else
+ {
+ /* XXX Traverse BACKW sequences from the beginning of
+ BACKW_STOP to get the next sequence. Is ther a quicker way
+ to do this? */
+ size_t i = backw_stop;
+ us = seq->back_us;
+ while (i < backw)
+ {
+ int32_t tmp = findidx (&us, -1);
+ idx = tmp & 0xffffff;
+ i++;
+ }
+ --backw;
+ us = seq->us;
+ }
+ }
+ else
+ {
+ backw_stop = idxmax;
+ int32_t prev_idx = idx;
+
+ while (*us != L('\0'))
+ {
+ int32_t tmp = findidx (&us, -1);
+ unsigned char rule = tmp >> 24;
+ prev_idx = idx;
+ idx = tmp & 0xffffff;
+ idxcnt = idxmax++;
+
+ /* Save the rule for the first sequence. */
+ if (__glibc_unlikely (idxcnt == 0))
+ seq->rule = rule;
+
+ if ((rulesets[rule * nrules + pass]
+ & sort_backward) == 0)
+ /* No more backward characters to push. */
+ break;
+ ++idxcnt;
+ }
+
+ if (backw_stop >= idxcnt)
+ {
+ /* No sequence at all or just one. */
+ if (idxcnt == idxmax || backw_stop > idxcnt)
+ /* Note that len is still zero. */
+ break;
+
+ backw_stop = ~0ul;
+ }
+ else
+ {
+ /* We pushed backward sequences. If the stream ended with the
+ backward sequence, then we process the last sequence we
+ found. Otherwise we process the sequence before the last
+ one since the last one was a forward sequence. */
+ seq->back_us = seq->us;
+ seq->us = us;
+ backw = idxcnt;
+ if (idxmax > idxcnt)
+ {
+ backw--;
+ seq->save_idx = idx;
+ idx = prev_idx;
+ }
+ if (backw > backw_stop)
+ backw--;
+ }
+ }
+
+ len = weights[idx++];
+ /* Skip over indices of previous levels. */
+ for (int i = 0; i < pass; i++)
+ {
+ idx += len;
+ len = weights[idx];
+ idx++;
+ }
+ }
+
+ /* Update the structure. */
+ seq->val = val;
+ seq->len = len;
+ seq->backw_stop = backw_stop;
+ seq->backw = backw;
+ seq->idxcnt = idxcnt;
+ seq->idxmax = idxmax;
+ seq->us = us;
+ seq->idx = idx;
+}
+
+/* Compare two sequences. This version does not use the index and rules
+ cache. */
+static int
+do_compare_nocache (coll_seq *seq1, coll_seq *seq2, int position,
+ const USTRING_TYPE *weights)
+{
+ int seq1len = seq1->len;
+ int seq2len = seq2->len;
+ size_t val1 = seq1->val;
+ size_t val2 = seq2->val;
+ int idx1 = seq1->idx;
+ int idx2 = seq2->idx;
+ int result = 0;
+
+ /* Test for position if necessary. */
+ if (position && val1 != val2)
+ {
+ result = val1 > val2 ? 1 : -1;
+ goto out;
+ }
+
+ /* Compare the two sequences. */
+ do
+ {
+ if (weights[idx1] != weights[idx2])
+ {
+ /* The sequences differ. */
+ result = weights[idx1] - weights[idx2];
+ goto out;
+ }
+
+ /* Increment the offsets. */
+ ++idx1;
+ ++idx2;
+
+ --seq1len;
+ --seq2len;
+ }
+ while (seq1len > 0 && seq2len > 0);
+
+ if (position && seq1len != seq2len)
+ result = seq1len - seq2len;
+
+out:
+ seq1->len = seq1len;
+ seq2->len = seq2len;
+ seq1->idx = idx1;
+ seq2->idx = idx2;
+ return result;
+}
+
+/* Compare two sequences using the index cache. */
static int
do_compare (coll_seq *seq1, coll_seq *seq2, int position,
const USTRING_TYPE *weights)
{
int seq1len = seq1->len;
int seq2len = seq2->len;
- int val1 = seq1->val;
- int val2 = seq2->val;
+ size_t val1 = seq1->val;
+ size_t val2 = seq2->val;
int32_t *idx1arr = seq1->idxarr;
int32_t *idx2arr = seq2->idxarr;
int idx1now = seq1->idxnow;
@@ -246,7 +436,7 @@ do_compare (coll_seq *seq1, coll_seq *seq2, int position,
/* Test for position if necessary. */
if (position && val1 != val2)
{
- result = val1 - val2;
+ result = val1 > val2 ? 1 : -1;
goto out;
}
@@ -339,57 +529,70 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
memset (&seq1, 0, sizeof (seq1));
seq2 = seq1;
- /* We need the elements of the strings as unsigned values since they
- are used as indices. */
- seq1.us = (const USTRING_TYPE *) s1;
- seq2.us = (const USTRING_TYPE *) s2;
+ size_t size_max = SIZE_MAX / (sizeof (int32_t) + 1);
- if (! __libc_use_alloca ((s1len + s2len) * (sizeof (int32_t) + 1)))
+ if (MIN (s1len, s2len) > size_max
+ || MAX (s1len, s2len) > size_max - MIN (s1len, s2len))
+ {
+ /* If the strings are long enough to cause overflow in the size request,
+ then skip the allocation and proceed with the non-cached routines. */
+ }
+ else if (! __libc_use_alloca ((s1len + s2len) * (sizeof (int32_t) + 1)))
{
seq1.idxarr = (int32_t *) malloc ((s1len + s2len) * (sizeof (int32_t) + 1));
- seq2.idxarr = &seq1.idxarr[s1len];
- seq1.rulearr = (unsigned char *) &seq2.idxarr[s2len];
- seq2.rulearr = &seq1.rulearr[s1len];
-
- if (seq1.idxarr == NULL)
- /* No memory. Well, go with the stack then.
-
- XXX Once this implementation is stable we will handle this
- differently. Instead of precomputing the indices we will
- do this in time. This means, though, that this happens for
- every pass again. */
- goto try_stack;
- use_malloc = true;
+
+ /* If we failed to allocate memory, we leave everything as NULL so that
+ we use the nocache version of traversal and comparison functions. */
+ if (seq1.idxarr != NULL)
+ {
+ seq2.idxarr = &seq1.idxarr[s1len];
+ seq1.rulearr = (unsigned char *) &seq2.idxarr[s2len];
+ seq2.rulearr = &seq1.rulearr[s1len];
+ use_malloc = true;
+ }
}
else
{
- try_stack:
seq1.idxarr = (int32_t *) alloca (s1len * sizeof (int32_t));
seq2.idxarr = (int32_t *) alloca (s2len * sizeof (int32_t));
seq1.rulearr = (unsigned char *) alloca (s1len);
seq2.rulearr = (unsigned char *) alloca (s2len);
}
- seq1.rulearr[0] = 0;
+ int rule = 0;
/* Cache values in the first pass and if needed, use them in subsequent
passes. */
for (int pass = 0; pass < nrules; ++pass)
{
seq1.idxcnt = 0;
+ seq1.idx = 0;
+ seq2.idx = 0;
seq1.backw_stop = ~0ul;
seq1.backw = ~0ul;
seq2.idxcnt = 0;
seq2.backw_stop = ~0ul;
seq2.backw = ~0ul;
+ /* We need the elements of the strings as unsigned values since they
+ are used as indices. */
+ seq1.us = (const USTRING_TYPE *) s1;
+ seq2.us = (const USTRING_TYPE *) s2;
+
/* We assume that if a rule has defined `position' in one section
this is true for all of them. */
- int position = rulesets[seq1.rulearr[0] * nrules + pass] & sort_position;
+ int position = rulesets[rule * nrules + pass] & sort_position;
while (1)
{
- if (pass == 0)
+ if (__glibc_unlikely (seq1.idxarr == NULL))
+ {
+ get_next_seq_nocache (&seq1, nrules, rulesets, weights, table,
+ extra, indirect, pass);
+ get_next_seq_nocache (&seq2, nrules, rulesets, weights, table,
+ extra, indirect, pass);
+ }
+ else if (pass == 0)
{
get_next_seq (&seq1, nrules, rulesets, weights, table, extra,
indirect);
@@ -416,10 +619,18 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
goto free_and_return;
}
- result = do_compare (&seq1, &seq2, position, weights);
+ if (__glibc_unlikely (seq1.idxarr == NULL))
+ result = do_compare_nocache (&seq1, &seq2, position, weights);
+ else
+ result = do_compare (&seq1, &seq2, position, weights);
if (result != 0)
goto free_and_return;
}
+
+ if (__glibc_likely (seq1.rulearr != NULL))
+ rule = seq1.rulearr[0];
+ else
+ rule = seq1.rule;
}
/* Free the memory if needed. */
diff --git a/libc/string/test-memcpy.c b/libc/string/test-memcpy.c
index d121ef02a..b7ebe5f4e 100644
--- a/libc/string/test-memcpy.c
+++ b/libc/string/test-memcpy.c
@@ -63,8 +63,8 @@ do_one_test (impl_t *impl, char *dst, const char *src,
if (memcmp (dst, src, len) != 0)
{
- error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
- impl->name, dst, src);
+ error (0, 0, "Wrong result in function %s dst %p \"%.*s\" src %p \"%.*s\" len %zu",
+ impl->name, dst, (int) len, dst, src, (int) len, src, len);
ret = 1;
return;
}
diff --git a/libc/string/tester.c b/libc/string/tester.c
index 2fe520caf..f1ea4381d 100644
--- a/libc/string/tester.c
+++ b/libc/string/tester.c
@@ -704,7 +704,7 @@ test_memrchr (void)
more than 128 byte chunks: */
{
char buf[128 + sizeof(long)];
- long align, len, i, pos;
+ long align, len, i, pos, n = 9;
for (align = 0; align < (long) sizeof(long); ++align) {
for (len = 0; len < (long) (sizeof(buf) - align); ++len) {
@@ -715,9 +715,9 @@ test_memrchr (void)
#if 0
printf("align %d, len %d, pos %d\n", align, len, pos);
#endif
- check(memrchr(buf + align, 'x', len) == buf + align + pos, 9);
+ check(memrchr(buf + align, 'x', len) == buf + align + pos, n++);
check(memrchr(buf + align + pos + 1, 'x', len - (pos + 1)) == NULL,
- 10);
+ n++);
buf[align + pos] = '-';
}
}
diff --git a/libc/string/tst-strcoll-overflow.c b/libc/string/tst-strcoll-overflow.c
new file mode 100644
index 000000000..bb665ac51
--- /dev/null
+++ b/libc/string/tst-strcoll-overflow.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Verify that strcoll does not crash for large strings for which it cannot
+ cache weight lookup results. The size is large enough to cause integer
+ overflows on 32-bit as well as buffer overflows on 64-bit. The test should
+ work reasonably reliably when overcommit is disabled, but it obviously
+ depends on how much memory the system has. There's a limitation to this
+ test in that it does not run to completion. Actually collating such a
+ large string can take days and we can't have xcheck running that long. For
+ that reason, we run the test for about 5 minutes and then assume that
+ everything is fine if there are no crashes. */
+#define SIZE 0x40000000ul
+
+int
+do_test (void)
+{
+ if (setlocale (LC_COLLATE, "en_GB.UTF-8") == NULL)
+ {
+ puts ("setlocale failed, cannot test for overflow");
+ return 0;
+ }
+
+ char *p = malloc (SIZE);
+
+ if (p == NULL)
+ {
+ puts ("could not allocate memory");
+ return 1;
+ }
+
+ memset (p, 'x', SIZE - 1);
+ p[SIZE - 1] = 0;
+ printf ("%d\n", strcoll (p, p));
+ return 0;
+}
+
+#define TIMEOUT 300
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/sunrpc/rpc/types.h b/libc/sunrpc/rpc/types.h
index 3dca5c40f..beded5255 100644
--- a/libc/sunrpc/rpc/types.h
+++ b/libc/sunrpc/rpc/types.h
@@ -69,6 +69,11 @@ typedef unsigned long rpcport_t;
#include <sys/types.h>
#endif
+#if defined __APPLE_CC__ || defined __FreeBSD__
+# define __u_char_defined
+# define __daddr_t_defined
+#endif
+
#ifndef __u_char_defined
typedef __u_char u_char;
typedef __u_short u_short;
diff --git a/libc/sysdeps/generic/ldconfig.h b/libc/sysdeps/generic/ldconfig.h
index d96089d49..037f95995 100644
--- a/libc/sysdeps/generic/ldconfig.h
+++ b/libc/sysdeps/generic/ldconfig.h
@@ -21,24 +21,27 @@
#include <stdint.h>
-#define FLAG_ANY -1
-#define FLAG_TYPE_MASK 0x00ff
-#define FLAG_LIBC4 0x0000
-#define FLAG_ELF 0x0001
-#define FLAG_ELF_LIBC5 0x0002
-#define FLAG_ELF_LIBC6 0x0003
-#define FLAG_REQUIRED_MASK 0xff00
-#define FLAG_SPARC_LIB64 0x0100
-#define FLAG_IA64_LIB64 0x0200
-#define FLAG_X8664_LIB64 0x0300
-#define FLAG_S390_LIB64 0x0400
-#define FLAG_POWERPC_LIB64 0x0500
-#define FLAG_MIPS64_LIBN32 0x0600
-#define FLAG_MIPS64_LIBN64 0x0700
-#define FLAG_X8664_LIBX32 0x0800
-#define FLAG_ARM_LIBHF 0x0900
-#define FLAG_AARCH64_LIB64 0x0a00
-#define FLAG_ARM_LIBSF 0x0b00
+#define FLAG_ANY -1
+#define FLAG_TYPE_MASK 0x00ff
+#define FLAG_LIBC4 0x0000
+#define FLAG_ELF 0x0001
+#define FLAG_ELF_LIBC5 0x0002
+#define FLAG_ELF_LIBC6 0x0003
+#define FLAG_REQUIRED_MASK 0xff00
+#define FLAG_SPARC_LIB64 0x0100
+#define FLAG_IA64_LIB64 0x0200
+#define FLAG_X8664_LIB64 0x0300
+#define FLAG_S390_LIB64 0x0400
+#define FLAG_POWERPC_LIB64 0x0500
+#define FLAG_MIPS64_LIBN32 0x0600
+#define FLAG_MIPS64_LIBN64 0x0700
+#define FLAG_X8664_LIBX32 0x0800
+#define FLAG_ARM_LIBHF 0x0900
+#define FLAG_AARCH64_LIB64 0x0a00
+#define FLAG_ARM_LIBSF 0x0b00
+#define FLAG_MIPS_LIB32_NAN2008 0x0c00
+#define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
+#define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
/* Name of auxiliary cache. */
#define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/libc/sysdeps/generic/math_private.h b/libc/sysdeps/generic/math_private.h
index c0fc03d38..9b881a3e7 100644
--- a/libc/sysdeps/generic/math_private.h
+++ b/libc/sysdeps/generic/math_private.h
@@ -356,10 +356,8 @@ extern void __dubcos (double __x, double __dx, double __v[]);
extern double __halfulp (double __x, double __y);
extern double __sin32 (double __x, double __res, double __res1);
extern double __cos32 (double __x, double __res, double __res1);
-extern double __mpsin (double __x, double __dx);
-extern double __mpcos (double __x, double __dx);
-extern double __mpsin1 (double __x);
-extern double __mpcos1 (double __x);
+extern double __mpsin (double __x, double __dx, bool __range_reduce);
+extern double __mpcos (double __x, double __dx, bool __range_reduce);
extern double __slowexp (double __x);
extern double __slowpow (double __x, double __y, double __z);
extern void __docos (double __x, double __dx, double __v[]);
diff --git a/libc/sysdeps/generic/stackguard-macros.h b/libc/sysdeps/generic/stackguard-macros.h
index ababf65d3..b4a6b23ff 100644
--- a/libc/sysdeps/generic/stackguard-macros.h
+++ b/libc/sysdeps/generic/stackguard-macros.h
@@ -2,3 +2,11 @@
extern uintptr_t __stack_chk_guard;
#define STACK_CHK_GUARD __stack_chk_guard
+
+#ifdef PTRGUARD_LOCAL
+extern uintptr_t __pointer_chk_guard_local;
+# define POINTER_CHK_GUARD __pointer_chk_guard_local
+#else
+extern uintptr_t __pointer_chk_guard;
+# define POINTER_CHK_GUARD __pointer_chk_guard
+#endif
diff --git a/libc/sysdeps/i386/ffs.c b/libc/sysdeps/i386/ffs.c
index 47496dcf7..77d2e60b7 100644
--- a/libc/sysdeps/i386/ffs.c
+++ b/libc/sysdeps/i386/ffs.c
@@ -41,6 +41,7 @@ __ffs (x)
return cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
diff --git a/libc/sysdeps/i386/i686/ffs.c b/libc/sysdeps/i386/i686/ffs.c
index 5c97050e8..cde1c9956 100644
--- a/libc/sysdeps/i386/i686/ffs.c
+++ b/libc/sysdeps/i386/i686/ffs.c
@@ -39,6 +39,7 @@ __ffs (x)
return cnt + 1;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
diff --git a/libc/sysdeps/i386/stackguard-macros.h b/libc/sysdeps/i386/stackguard-macros.h
index 8c31e197e..039762927 100644
--- a/libc/sysdeps/i386/stackguard-macros.h
+++ b/libc/sysdeps/i386/stackguard-macros.h
@@ -2,3 +2,11 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ \
+ uintptr_t x; \
+ asm ("movl %%gs:%c1, %0" : "=r" (x) \
+ : "i" (offsetof (tcbhead_t, pointer_guard))); \
+ x; \
+ })
diff --git a/libc/sysdeps/ieee754/dbl-64/MathLib.h b/libc/sysdeps/ieee754/dbl-64/MathLib.h
index 23f71980b..cf56606e3 100644
--- a/libc/sysdeps/ieee754/dbl-64/MathLib.h
+++ b/libc/sysdeps/ieee754/dbl-64/MathLib.h
@@ -33,14 +33,14 @@
/* It returns the original status of these modes. */
/* See further explanations of usage in DPChange.h */
/********************************************************************/
-unsigned short Init_Lib(void);
+unsigned short Init_Lib (void);
/********************************************************************/
/* Function that changes the precision and rounding modes to the */
/* specified by the argument received. See further explanations in */
/* DPChange.h */
/********************************************************************/
-void Exit_Lib(unsigned short);
+void Exit_Lib (unsigned short);
/* The asin() function calculates the arc sine of its argument. */
@@ -48,7 +48,7 @@ void Exit_Lib(unsigned short);
/* (between -PI/2 and PI/2). */
/* If the argument is greater than 1 or less than -1 it returns */
/* a NaN. */
-double uasin(double );
+double uasin (double);
/* The acos() function calculates the arc cosine of its argument. */
@@ -56,47 +56,45 @@ double uasin(double );
/* (between -PI/2 and PI/2). */
/* If the argument is greater than 1 or less than -1 it returns */
/* a NaN. */
-double uacos(double );
+double uacos (double);
/* The atan() function calculates the arctanget of its argument. */
/* The function returns the arc tangent in radians */
/* (between -PI/2 and PI/2). */
-double uatan(double );
+double uatan (double);
/* The uatan2() function calculates the arc tangent of the two arguments x */
/* and y (x is the right argument and y is the left one).The signs of both */
/* arguments are used to determine the quadrant of the result. */
/* The function returns the result in radians, which is between -PI and PI */
-double uatan2(double ,double );
+double uatan2 (double, double);
/* Compute log(x). The base of log is e (natural logarithm) */
-double ulog(double );
+double ulog (double);
/* Compute e raised to the power of argument x. */
-double uexp(double );
+double uexp (double);
/* Compute sin(x). The argument x is assumed to be given in radians.*/
-double usin(double );
+double usin (double);
/* Compute cos(x). The argument x is assumed to be given in radians.*/
-double ucos(double );
+double ucos (double);
/* Compute tan(x). The argument x is assumed to be given in radians.*/
-double utan(double );
+double utan (double);
/* Compute the square root of non-negative argument x. */
/* If x is negative the returned value is NaN. */
-double usqrt(double );
+double usqrt (double);
/* Compute x raised to the power of y, where x is the left argument */
/* and y is the right argument. The function returns a NaN if x<0. */
/* If x equals zero it returns -inf */
-double upow(double , double );
+double upow (double, double);
/* Computing x mod y, where x is the left argument and y is the */
/* right one. */
-double uremainder(double , double );
-
-
+double uremainder (double, double);
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/dbl2mpn.c b/libc/sysdeps/ieee754/dbl-64/dbl2mpn.c
index f2294de5a..087d64377 100644
--- a/libc/sysdeps/ieee754/dbl-64/dbl2mpn.c
+++ b/libc/sysdeps/ieee754/dbl-64/dbl2mpn.c
@@ -40,14 +40,14 @@ __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
#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 20 bits. */
- #define N 2
+ # 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] = ((mp_limb_t) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
- #define N 1
+ # define N 1
#else
- #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+ # 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 \
@@ -73,7 +73,7 @@ __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
#if N == 2
res_ptr[N - 1] = res_ptr[1] << cnt
| (N - 1)
- * (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
+ * (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
res_ptr[0] <<= cnt;
#else
res_ptr[N - 1] <<= cnt;
diff --git a/libc/sysdeps/ieee754/dbl-64/dla.h b/libc/sysdeps/ieee754/dbl-64/dla.h
index b09f00ec7..6666982bf 100644
--- a/libc/sysdeps/ieee754/dbl-64/dla.h
+++ b/libc/sysdeps/ieee754/dbl-64/dla.h
@@ -61,13 +61,13 @@
/* storage variables of type double. */
#ifdef DLA_FMS
-# define EMULV(x,y,z,zz,p,hx,tx,hy,ty) \
- z=x*y; zz=DLA_FMS(x,y,z);
+# define EMULV(x, y, z, zz, p, hx, tx, hy, ty) \
+ z = x * y; zz = DLA_FMS (x, y, z);
#else
-# define EMULV(x,y,z,zz,p,hx,tx,hy,ty) \
- p=CN*(x); hx=((x)-p)+p; tx=(x)-hx; \
- p=CN*(y); hy=((y)-p)+p; ty=(y)-hy; \
- z=(x)*(y); zz=(((hx*hy-z)+hx*ty)+tx*hy)+tx*ty;
+# define EMULV(x, y, z, zz, p, hx, tx, hy, ty) \
+ p = CN * (x); hx = ((x) - p) + p; tx = (x) - hx; \
+ p = CN * (y); hy = ((y) - p) + p; ty = (y) - hy; \
+ z = (x) * (y); zz = (((hx * hy - z) + hx * ty) + tx * hy) + tx * ty;
#endif
@@ -93,11 +93,11 @@
/* are assumed to be double-length numbers. r,s are temporary */
/* storage variables of type double. */
-#define ADD2(x,xx,y,yy,z,zz,r,s) \
- r=(x)+(y); s=(ABS(x)>ABS(y)) ? \
- (((((x)-r)+(y))+(yy))+(xx)) : \
- (((((y)-r)+(x))+(xx))+(yy)); \
- z=r+s; zz=(r-z)+s;
+#define ADD2(x, xx, y, yy, z, zz, r, s) \
+ r = (x) + (y); s = (ABS (x) > ABS (y)) ? \
+ (((((x) - r) + (y)) + (yy)) + (xx)) : \
+ (((((y) - r) + (x)) + (xx)) + (yy)); \
+ z = r + s; zz = (r - z) + s;
/* Double-length subtraction, Dekker. The macro produces a double-length */
@@ -106,11 +106,11 @@
/* are assumed to be double-length numbers. r,s are temporary */
/* storage variables of type double. */
-#define SUB2(x,xx,y,yy,z,zz,r,s) \
- r=(x)-(y); s=(ABS(x)>ABS(y)) ? \
- (((((x)-r)-(y))-(yy))+(xx)) : \
- ((((x)-((y)+r))+(xx))-(yy)); \
- z=r+s; zz=(r-z)+s;
+#define SUB2(x, xx, y, yy, z, zz, r, s) \
+ r = (x) - (y); s = (ABS (x) > ABS (y)) ? \
+ (((((x) - r) - (y)) - (yy)) + (xx)) : \
+ ((((x) - ((y) + r)) + (xx)) - (yy)); \
+ z = r + s; zz = (r - z) + s;
/* Double-length multiplication, Dekker. The macro produces a double-length */
@@ -119,9 +119,9 @@
/* are assumed to be double-length numbers. p,hx,tx,hy,ty,q,c,cc are */
/* temporary storage variables of type double. */
-#define MUL2(x,xx,y,yy,z,zz,p,hx,tx,hy,ty,q,c,cc) \
- MUL12(x,y,c,cc,p,hx,tx,hy,ty,q) \
- cc=((x)*(yy)+(xx)*(y))+cc; z=c+cc; zz=(c-z)+cc;
+#define MUL2(x, xx, y, yy, z, zz, p, hx, tx, hy, ty, q, c, cc) \
+ MUL12 (x, y, c, cc, p, hx, tx, hy, ty, q) \
+ cc = ((x) * (yy) + (xx) * (y)) + cc; z = c + cc; zz = (c - z) + cc;
/* Double-length division, Dekker. The macro produces a double-length */
@@ -142,18 +142,18 @@
/* are assumed to be double-length numbers. r,rr,s,ss,u,uu,w */
/* are temporary storage variables of type double. */
-#define ADD2A(x,xx,y,yy,z,zz,r,rr,s,ss,u,uu,w) \
- r=(x)+(y); \
- if (ABS(x)>ABS(y)) { rr=((x)-r)+(y); s=(rr+(yy))+(xx); } \
- else { rr=((y)-r)+(x); s=(rr+(xx))+(yy); } \
- if (rr!=0.0) { \
- z=r+s; zz=(r-z)+s; } \
- else { \
- ss=(ABS(xx)>ABS(yy)) ? (((xx)-s)+(yy)) : (((yy)-s)+(xx)); \
- u=r+s; \
- uu=(ABS(r)>ABS(s)) ? ((r-u)+s) : ((s-u)+r) ; \
- w=uu+ss; z=u+w; \
- zz=(ABS(u)>ABS(w)) ? ((u-z)+w) : ((w-z)+u) ; }
+#define ADD2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w) \
+ r = (x) + (y); \
+ if (ABS (x) > ABS (y)) { rr = ((x) - r) + (y); s = (rr + (yy)) + (xx); } \
+ else { rr = ((y) - r) + (x); s = (rr + (xx)) + (yy); } \
+ if (rr != 0.0) { \
+ z = r + s; zz = (r - z) + s; } \
+ else { \
+ ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) + (yy)) : (((yy) - s) + (xx));\
+ u = r + s; \
+ uu = (ABS (r) > ABS (s)) ? ((r - u) + s) : ((s - u) + r); \
+ w = uu + ss; z = u + w; \
+ zz = (ABS (u) > ABS (w)) ? ((u - z) + w) : ((w - z) + u); }
/* Double-length subtraction, slower but more accurate than SUB2. */
@@ -163,15 +163,15 @@
/* are assumed to be double-length numbers. r,rr,s,ss,u,uu,w */
/* are temporary storage variables of type double. */
-#define SUB2A(x,xx,y,yy,z,zz,r,rr,s,ss,u,uu,w) \
- r=(x)-(y); \
- if (ABS(x)>ABS(y)) { rr=((x)-r)-(y); s=(rr-(yy))+(xx); } \
- else { rr=(x)-((y)+r); s=(rr+(xx))-(yy); } \
- if (rr!=0.0) { \
- z=r+s; zz=(r-z)+s; } \
- else { \
- ss=(ABS(xx)>ABS(yy)) ? (((xx)-s)-(yy)) : ((xx)-((yy)+s)); \
- u=r+s; \
- uu=(ABS(r)>ABS(s)) ? ((r-u)+s) : ((s-u)+r) ; \
- w=uu+ss; z=u+w; \
- zz=(ABS(u)>ABS(w)) ? ((u-z)+w) : ((w-z)+u) ; }
+#define SUB2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w) \
+ r = (x) - (y); \
+ if (ABS (x) > ABS (y)) { rr = ((x) - r) - (y); s = (rr - (yy)) + (xx); } \
+ else { rr = (x) - ((y) + r); s = (rr + (xx)) - (yy); } \
+ if (rr != 0.0) { \
+ z = r + s; zz = (r - z) + s; } \
+ else { \
+ ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) - (yy)) : ((xx) - ((yy) + s)); \
+ u = r + s; \
+ uu = (ABS (r) > ABS (s)) ? ((r - u) + s) : ((s - u) + r); \
+ w = uu + ss; z = u + w; \
+ zz = (ABS (u) > ABS (w)) ? ((u - z) + w) : ((w - z) + u); }
diff --git a/libc/sysdeps/ieee754/dbl-64/dosincos.c b/libc/sysdeps/ieee754/dbl-64/dosincos.c
index 00726285a..e1c8836b7 100644
--- a/libc/sysdeps/ieee754/dbl-64/dosincos.c
+++ b/libc/sysdeps/ieee754/dbl-64/dosincos.c
@@ -57,49 +57,52 @@ extern const union
void
SECTION
-__dubsin(double x, double dx, double v[]) {
- double r,s,c,cc,d,dd,d2,dd2,e,ee,
- sn,ssn,cs,ccs,ds,dss,dc,dcc;
+__dubsin (double x, double dx, double v[])
+{
+ double r, s, c, cc, d, dd, d2, dd2, e, ee,
+ sn, ssn, cs, ccs, ds, dss, dc, dcc;
#ifndef DLA_FMS
- double p,hx,tx,hy,ty,q;
+ double p, hx, tx, hy, ty, q;
#endif
mynumber u;
int4 k;
- u.x=x+big.x;
- k = u.i[LOW_HALF]<<2;
- x=x-(u.x-big.x);
- d=x+dx;
- dd=(x-d)+dx;
- /* sin(x+dx)=sin(Xi+t)=sin(Xi)*cos(t) + cos(Xi)sin(t) where t ->0 */
- MUL2(d,dd,d,dd,d2,dd2,p,hx,tx,hy,ty,q,c,cc);
- sn=__sincostab.x[k]; /* */
- ssn=__sincostab.x[k+1]; /* sin(Xi) and cos(Xi) */
- cs=__sincostab.x[k+2]; /* */
- ccs=__sincostab.x[k+3]; /* */
- MUL2(d2,dd2,s7.x,ss7.x,ds,dss,p,hx,tx,hy,ty,q,c,cc); /* Taylor */
- ADD2(ds,dss,s5.x,ss5.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc); /* series */
- ADD2(ds,dss,s3.x,ss3.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc); /* for sin */
- MUL2(d,dd,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,d,dd,ds,dss,r,s); /* ds=sin(t) */
-
- MUL2(d2,dd2,c8.x,cc8.x,dc,dcc,p,hx,tx,hy,ty,q,c,cc); ;/* Taylor */
- ADD2(dc,dcc,c6.x,cc6.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc); /* series */
- ADD2(dc,dcc,c4.x,cc4.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc); /* for cos */
- ADD2(dc,dcc,c2.x,cc2.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc); /* dc=cos(t) */
-
- MUL2(cs,ccs,ds,dss,e,ee,p,hx,tx,hy,ty,q,c,cc);
- MUL2(dc,dcc,sn,ssn,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- SUB2(e,ee,dc,dcc,e,ee,r,s);
- ADD2(e,ee,sn,ssn,e,ee,r,s); /* e+ee=sin(x+dx) */
-
- v[0]=e;
- v[1]=ee;
+ u.x = x + big.x;
+ k = u.i[LOW_HALF] << 2;
+ x = x - (u.x - big.x);
+ d = x + dx;
+ dd = (x - d) + dx;
+ /* sin(x+dx)=sin(Xi+t)=sin(Xi)*cos(t) + cos(Xi)sin(t) where t ->0 */
+ MUL2 (d, dd, d, dd, d2, dd2, p, hx, tx, hy, ty, q, c, cc);
+ sn = __sincostab.x[k]; /* */
+ ssn = __sincostab.x[k + 1]; /* sin(Xi) and cos(Xi) */
+ cs = __sincostab.x[k + 2]; /* */
+ ccs = __sincostab.x[k + 3]; /* */
+ /* Taylor series for sin ds=sin(t) */
+ MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (d, dd, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, d, dd, ds, dss, r, s);
+
+ /* Taylor series for cos dc=cos(t) */
+ MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+
+ MUL2 (cs, ccs, ds, dss, e, ee, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (dc, dcc, sn, ssn, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ SUB2 (e, ee, dc, dcc, e, ee, r, s);
+ ADD2 (e, ee, sn, ssn, e, ee, r, s); /* e+ee=sin(x+dx) */
+
+ v[0] = e;
+ v[1] = ee;
}
/**********************************************************************/
/* Routine receive Double-Length number (x+dx) and computes cos(x+dx) */
@@ -110,64 +113,65 @@ __dubsin(double x, double dx, double v[]) {
void
SECTION
-__dubcos(double x, double dx, double v[]) {
- double r,s,c,cc,d,dd,d2,dd2,e,ee,
- sn,ssn,cs,ccs,ds,dss,dc,dcc;
+__dubcos (double x, double dx, double v[])
+{
+ double r, s, c, cc, d, dd, d2, dd2, e, ee,
+ sn, ssn, cs, ccs, ds, dss, dc, dcc;
#ifndef DLA_FMS
- double p,hx,tx,hy,ty,q;
+ double p, hx, tx, hy, ty, q;
#endif
mynumber u;
int4 k;
- u.x=x+big.x;
- k = u.i[LOW_HALF]<<2;
- x=x-(u.x-big.x);
- d=x+dx;
- dd=(x-d)+dx; /* cos(x+dx)=cos(Xi+t)=cos(Xi)cos(t) - sin(Xi)sin(t) */
- MUL2(d,dd,d,dd,d2,dd2,p,hx,tx,hy,ty,q,c,cc);
- sn=__sincostab.x[k]; /* */
- ssn=__sincostab.x[k+1]; /* sin(Xi) and cos(Xi) */
- cs=__sincostab.x[k+2]; /* */
- ccs=__sincostab.x[k+3]; /* */
- MUL2(d2,dd2,s7.x,ss7.x,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,s5.x,ss5.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,s3.x,ss3.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- MUL2(d,dd,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,d,dd,ds,dss,r,s);
-
- MUL2(d2,dd2,c8.x,cc8.x,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c6.x,cc6.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c4.x,cc4.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c2.x,cc2.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
-
- MUL2(cs,ccs,ds,dss,e,ee,p,hx,tx,hy,ty,q,c,cc);
- MUL2(dc,dcc,sn,ssn,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
-
- MUL2(d2,dd2,s7.x,ss7.x,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,s5.x,ss5.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,s3.x,ss3.x,ds,dss,r,s);
- MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- MUL2(d,dd,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc);
- ADD2(ds,dss,d,dd,ds,dss,r,s);
- MUL2(d2,dd2,c8.x,cc8.x,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c6.x,cc6.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c4.x,cc4.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(dc,dcc,c2.x,cc2.x,dc,dcc,r,s);
- MUL2(d2,dd2,dc,dcc,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- MUL2(sn,ssn,ds,dss,e,ee,p,hx,tx,hy,ty,q,c,cc);
- MUL2(dc,dcc,cs,ccs,dc,dcc,p,hx,tx,hy,ty,q,c,cc);
- ADD2(e,ee,dc,dcc,e,ee,r,s);
- SUB2(cs,ccs,e,ee,e,ee,r,s);
-
- v[0]=e;
- v[1]=ee;
+ u.x = x + big.x;
+ k = u.i[LOW_HALF] << 2;
+ x = x - (u.x - big.x);
+ d = x + dx;
+ dd = (x - d) + dx; /* cos(x+dx)=cos(Xi+t)=cos(Xi)cos(t) - sin(Xi)sin(t) */
+ MUL2 (d, dd, d, dd, d2, dd2, p, hx, tx, hy, ty, q, c, cc);
+ sn = __sincostab.x[k]; /* */
+ ssn = __sincostab.x[k + 1]; /* sin(Xi) and cos(Xi) */
+ cs = __sincostab.x[k + 2]; /* */
+ ccs = __sincostab.x[k + 3]; /* */
+ MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (d, dd, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, d, dd, ds, dss, r, s);
+
+ MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+
+ MUL2 (cs, ccs, ds, dss, e, ee, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (dc, dcc, sn, ssn, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+
+ MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s);
+ MUL2 (d2, dd2, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (d, dd, ds, dss, ds, dss, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (ds, dss, d, dd, ds, dss, r, s);
+ MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s);
+ MUL2 (d2, dd2, dc, dcc, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (sn, ssn, ds, dss, e, ee, p, hx, tx, hy, ty, q, c, cc);
+ MUL2 (dc, dcc, cs, ccs, dc, dcc, p, hx, tx, hy, ty, q, c, cc);
+ ADD2 (e, ee, dc, dcc, e, ee, r, s);
+ SUB2 (cs, ccs, e, ee, e, ee, r, s);
+
+ v[0] = e;
+ v[1] = ee;
}
/**********************************************************************/
/* Routine receive Double-Length number (x+dx) and computes cos(x+dx) */
@@ -175,29 +179,45 @@ __dubcos(double x, double dx, double v[]) {
/**********************************************************************/
void
SECTION
-__docos(double x, double dx, double v[]) {
- double y,yy,p,w[2];
- if (x>0) {y=x; yy=dx;}
- else {y=-x; yy=-dx;}
- if (y<0.5*hp0.x) /* y< PI/4 */
- {__dubcos(y,yy,w); v[0]=w[0]; v[1]=w[1];}
- else if (y<1.5*hp0.x) { /* y< 3/4 * PI */
- p=hp0.x-y; /* p = PI/2 - y */
- yy=hp1.x-yy;
- y=p+yy;
- yy=(p-y)+yy;
- if (y>0) {__dubsin(y,yy,w); v[0]=w[0]; v[1]=w[1];}
- /* cos(x) = sin ( 90 - x ) */
- else {__dubsin(-y,-yy,w); v[0]=-w[0]; v[1]=-w[1];
- }
- }
- else { /* y>= 3/4 * PI */
- p=2.0*hp0.x-y; /* p = PI- y */
- yy=2.0*hp1.x-yy;
- y=p+yy;
- yy=(p-y)+yy;
- __dubcos(y,yy,w);
- v[0]=-w[0];
- v[1]=-w[1];
- }
+__docos (double x, double dx, double v[])
+{
+ double y, yy, p, w[2];
+ if (x > 0)
+ {
+ y = x; yy = dx;
+ }
+ else
+ {
+ y = -x; yy = -dx;
+ }
+ if (y < 0.5 * hp0.x) /* y< PI/4 */
+ {
+ __dubcos (y, yy, w); v[0] = w[0]; v[1] = w[1];
+ }
+ else if (y < 1.5 * hp0.x) /* y< 3/4 * PI */
+ {
+ p = hp0.x - y; /* p = PI/2 - y */
+ yy = hp1.x - yy;
+ y = p + yy;
+ yy = (p - y) + yy;
+ if (y > 0)
+ {
+ __dubsin (y, yy, w); v[0] = w[0]; v[1] = w[1];
+ }
+ /* cos(x) = sin ( 90 - x ) */
+ else
+ {
+ __dubsin (-y, -yy, w); v[0] = -w[0]; v[1] = -w[1];
+ }
+ }
+ else /* y>= 3/4 * PI */
+ {
+ p = 2.0 * hp0.x - y; /* p = PI- y */
+ yy = 2.0 * hp1.x - yy;
+ y = p + yy;
+ yy = (p - y) + yy;
+ __dubcos (y, yy, w);
+ v[0] = -w[0];
+ v[1] = -w[1];
+ }
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_acosh.c b/libc/sysdeps/ieee754/dbl-64/e_acosh.c
index b24a6f645..c1f3590f7 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_acosh.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_acosh.c
@@ -28,31 +28,42 @@
#include <math_private.h>
static const double
-one = 1.0,
-ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
+ one = 1.0,
+ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
double
-__ieee754_acosh(double x)
+__ieee754_acosh (double x)
{
- double t;
- int32_t hx;
- u_int32_t lx;
- EXTRACT_WORDS(hx,lx,x);
- if(hx<0x3ff00000) { /* x < 1 */
- return (x-x)/(x-x);
- } else if(hx >=0x41b00000) { /* x > 2**28 */
- if(hx >=0x7ff00000) { /* x is inf of NaN */
- return x+x;
- } else
- return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
- } else if(((hx-0x3ff00000)|lx)==0) {
- return 0.0; /* acosh(1) = 0 */
- } else if (hx > 0x40000000) { /* 2**28 > x > 2 */
- t=x*x;
- return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one)));
- } else { /* 1<x<2 */
- t = x-one;
- return __log1p(t+__ieee754_sqrt(2.0*t+t*t));
+ double t;
+ int32_t hx;
+ u_int32_t lx;
+ EXTRACT_WORDS (hx, lx, x);
+ if (hx < 0x3ff00000) /* x < 1 */
+ {
+ return (x - x) / (x - x);
+ }
+ else if (hx >= 0x41b00000) /* x > 2**28 */
+ {
+ if (hx >= 0x7ff00000) /* x is inf of NaN */
+ {
+ return x + x;
}
+ else
+ return __ieee754_log (x) + ln2; /* acosh(huge)=log(2x) */
+ }
+ else if (((hx - 0x3ff00000) | lx) == 0)
+ {
+ return 0.0; /* acosh(1) = 0 */
+ }
+ else if (hx > 0x40000000) /* 2**28 > x > 2 */
+ {
+ t = x * x;
+ return __ieee754_log (2.0 * x - one / (x + __ieee754_sqrt (t - one)));
+ }
+ else /* 1<x<2 */
+ {
+ t = x - one;
+ return __log1p (t + __ieee754_sqrt (2.0 * t + t * t));
+ }
}
strong_alias (__ieee754_acosh, __acosh_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_atan2.c b/libc/sysdeps/ieee754/dbl-64/e_atan2.c
index 4ebe9c01f..e36305cda 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -42,6 +42,7 @@
#include "uatan.tbl"
#include "atnat2.h"
#include <math_private.h>
+#include <stap-probe.h>
#ifndef SECTION
# define SECTION
@@ -71,14 +72,14 @@ __ieee754_atan2 (double y, double x)
int i, de, ux, dx, uy, dy;
static const int pr[MM] = { 6, 8, 10, 20, 32 };
double ax, ay, u, du, u9, ua, v, vv, dv, t1, t2, t3, t7, t8,
- z, zz, cor, s1, ss1, s2, ss2;
+ z, zz, cor, s1, ss1, s2, ss2;
#ifndef DLA_FMS
double t4, t5, t6;
#endif
number num;
- static const int ep = 59768832, /* 57*16**5 */
- em = -59768832; /* -57*16**5 */
+ static const int ep = 59768832, /* 57*16**5 */
+ em = -59768832; /* -57*16**5 */
/* x=NaN or y=NaN */
num.d = x;
@@ -293,17 +294,17 @@ __ieee754_atan2 (double y, double x)
if (i < 112)
{
if (i < 48)
- u9 = u91.d; /* u < 1/4 */
+ u9 = u91.d; /* u < 1/4 */
else
u9 = u92.d;
- } /* 1/4 <= u < 1/2 */
+ } /* 1/4 <= u < 1/2 */
else
{
if (i < 176)
- u9 = u93.d; /* 1/2 <= u < 3/4 */
+ u9 = u93.d; /* 1/2 <= u < 3/4 */
else
u9 = u94.d;
- } /* 3/4 <= u <= 1 */
+ } /* 3/4 <= u <= 1 */
if ((z = t1 + (zz - u9 * t1)) == t1 + (zz + u9 * t1))
return signArctan2 (y, z);
@@ -311,9 +312,9 @@ __ieee754_atan2 (double y, double x)
EADD (t1, du, v, vv);
s1 = v * (hij[i][11].d
+ v * (hij[i][12].d
- + v * (hij[i][13].d
- + v * (hij[i][14].d
- + v * hij[i][15].d))));
+ + v * (hij[i][13].d
+ + v * (hij[i][14].d
+ + v * hij[i][15].d))));
ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2);
MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2, t3, t4, t5, t6, t7, t8);
ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2);
@@ -597,7 +598,11 @@ atan2Mp (double x, double y, const int pr[])
__mp_dbl (&mpz1, &z1, p);
__mp_dbl (&mpz2, &z2, p);
if (z1 == z2)
- return z1;
+ {
+ LIBC_PROBE (slowatan2, 4, &p, &x, &y, &z1);
+ return z1;
+ }
}
+ LIBC_PROBE (slowatan2_inexact, 4, &p, &x, &y, &z1);
return z1; /*if impossible to do exact computing */
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_cosh.c b/libc/sysdeps/ieee754/dbl-64/e_cosh.c
index 229d5a2fb..6caf943ed 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_cosh.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_cosh.c
@@ -34,49 +34,55 @@
#include <math.h>
#include <math_private.h>
-static const double one = 1.0, half=0.5, huge = 1.0e300;
+static const double one = 1.0, half = 0.5, huge = 1.0e300;
double
__ieee754_cosh (double x)
{
- double t,w;
- int32_t ix;
- u_int32_t lx;
+ double t, w;
+ int32_t ix;
+ u_int32_t lx;
- /* High word of |x|. */
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
+ /* High word of |x|. */
+ GET_HIGH_WORD (ix, x);
+ ix &= 0x7fffffff;
- /* |x| in [0,22] */
- if (ix < 0x40360000) {
- /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
- if(ix<0x3fd62e43) {
- t = __expm1(fabs(x));
- w = one+t;
- if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */
- return one+(t*t)/(w+w);
- }
-
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
- t = __ieee754_exp(fabs(x));
- return half*t+half/t;
+ /* |x| in [0,22] */
+ if (ix < 0x40360000)
+ {
+ /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+ if (ix < 0x3fd62e43)
+ {
+ t = __expm1 (fabs (x));
+ w = one + t;
+ if (ix < 0x3c800000)
+ return w; /* cosh(tiny) = 1 */
+ return one + (t * t) / (w + w);
}
- /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
- if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x));
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ t = __ieee754_exp (fabs (x));
+ return half * t + half / t;
+ }
- /* |x| in [log(maxdouble), overflowthresold] */
- GET_LOW_WORD(lx,x);
- if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
- w = __ieee754_exp(half*fabs(x));
- t = half*w;
- return t*w;
- }
+ /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+ if (ix < 0x40862e42)
+ return half * __ieee754_exp (fabs (x));
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ GET_LOW_WORD (lx, x);
+ if (ix < 0x408633ce || ((ix == 0x408633ce) && (lx <= (u_int32_t) 0x8fb9f87d)))
+ {
+ w = __ieee754_exp (half * fabs (x));
+ t = half * w;
+ return t * w;
+ }
- /* x is INF or NaN */
- if(ix>=0x7ff00000) return x*x;
+ /* x is INF or NaN */
+ if (ix >= 0x7ff00000)
+ return x * x;
- /* |x| > overflowthresold, cosh(x) overflow */
- return huge*huge;
+ /* |x| > overflowthresold, cosh(x) overflow */
+ return huge * huge;
}
strong_alias (__ieee754_cosh, __cosh_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_exp.c b/libc/sysdeps/ieee754/dbl-64/e_exp.c
index 07cc4a91b..df3aa5efa 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_exp.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_exp.c
@@ -44,221 +44,299 @@
# define SECTION
#endif
-double __slowexp(double);
+double __slowexp (double);
-/***************************************************************************/
-/* An ultimate exp routine. Given an IEEE double machine number x */
-/* it computes the correctly rounded (to nearest) value of e^x */
-/***************************************************************************/
+/* An ultimate exp routine. Given an IEEE double machine number x it computes
+ the correctly rounded (to nearest) value of e^x. */
double
SECTION
-__ieee754_exp(double x) {
+__ieee754_exp (double x)
+{
double bexp, t, eps, del, base, y, al, bet, res, rem, cor;
- mynumber junk1, junk2, binexp = {{0,0}};
- int4 i,j,m,n,ex;
+ mynumber junk1, junk2, binexp = {{0, 0}};
+ int4 i, j, m, n, ex;
double retval;
SET_RESTORE_ROUND (FE_TONEAREST);
junk1.x = x;
m = junk1.i[HIGH_HALF];
- n = m&hugeint;
-
- if (n > smallint && n < bigint) {
-
- y = x*log2e.x + three51.x;
- bexp = y - three51.x; /* multiply the result by 2**bexp */
-
- junk1.x = y;
-
- eps = bexp*ln_two2.x; /* x = bexp*ln(2) + t - eps */
- t = x - bexp*ln_two1.x;
-
- y = t + three33.x;
- base = y - three33.x; /* t rounded to a multiple of 2**-18 */
- junk2.x = y;
- del = (t - base) - eps; /* x = bexp*ln(2) + base + del */
- eps = del + del*del*(p3.x*del + p2.x);
-
- binexp.i[HIGH_HALF] =(junk1.i[LOW_HALF]+1023)<<20;
-
- i = ((junk2.i[LOW_HALF]>>8)&0xfffffffe)+356;
- j = (junk2.i[LOW_HALF]&511)<<1;
-
- al = coar.x[i]*fine.x[j];
- bet =(coar.x[i]*fine.x[j+1] + coar.x[i+1]*fine.x[j]) + coar.x[i+1]*fine.x[j+1];
-
- rem=(bet + bet*eps)+al*eps;
- res = al + rem;
- cor = (al - res) + rem;
- if (res == (res+cor*err_0)) { retval = res*binexp.x; goto ret; }
- else { retval = __slowexp(x); goto ret; } /*if error is over bound */
- }
+ n = m & hugeint;
+
+ if (n > smallint && n < bigint)
+ {
+ y = x * log2e.x + three51.x;
+ bexp = y - three51.x; /* multiply the result by 2**bexp */
+
+ junk1.x = y;
+
+ eps = bexp * ln_two2.x; /* x = bexp*ln(2) + t - eps */
+ t = x - bexp * ln_two1.x;
+
+ y = t + three33.x;
+ base = y - three33.x; /* t rounded to a multiple of 2**-18 */
+ junk2.x = y;
+ del = (t - base) - eps; /* x = bexp*ln(2) + base + del */
+ eps = del + del * del * (p3.x * del + p2.x);
+
+ binexp.i[HIGH_HALF] = (junk1.i[LOW_HALF] + 1023) << 20;
+
+ i = ((junk2.i[LOW_HALF] >> 8) & 0xfffffffe) + 356;
+ j = (junk2.i[LOW_HALF] & 511) << 1;
+
+ al = coar.x[i] * fine.x[j];
+ bet = ((coar.x[i] * fine.x[j + 1] + coar.x[i + 1] * fine.x[j])
+ + coar.x[i + 1] * fine.x[j + 1]);
+
+ rem = (bet + bet * eps) + al * eps;
+ res = al + rem;
+ cor = (al - res) + rem;
+ if (res == (res + cor * err_0))
+ {
+ retval = res * binexp.x;
+ goto ret;
+ }
+ else
+ {
+ retval = __slowexp (x);
+ goto ret;
+ } /*if error is over bound */
+ }
- if (n <= smallint) { retval = 1.0; goto ret; }
+ if (n <= smallint)
+ {
+ retval = 1.0;
+ goto ret;
+ }
- if (n >= badint) {
- if (n > infint) { retval = x+x; goto ret; } /* x is NaN */
- if (n < infint) { retval = (x>0) ? (hhuge*hhuge) : (tiny*tiny); goto ret; }
- /* x is finite, cause either overflow or underflow */
- if (junk1.i[LOW_HALF] != 0) { retval = x+x; goto ret; } /* x is NaN */
- retval = (x>0)?inf.x:zero; /* |x| = inf; return either inf or 0 */
- goto ret;
- }
+ if (n >= badint)
+ {
+ if (n > infint)
+ {
+ retval = x + x;
+ goto ret;
+ } /* x is NaN */
+ if (n < infint)
+ {
+ retval = (x > 0) ? (hhuge * hhuge) : (tiny * tiny);
+ goto ret;
+ }
+ /* x is finite, cause either overflow or underflow */
+ if (junk1.i[LOW_HALF] != 0)
+ {
+ retval = x + x;
+ goto ret;
+ } /* x is NaN */
+ retval = (x > 0) ? inf.x : zero; /* |x| = inf; return either inf or 0 */
+ goto ret;
+ }
- y = x*log2e.x + three51.x;
+ y = x * log2e.x + three51.x;
bexp = y - three51.x;
junk1.x = y;
- eps = bexp*ln_two2.x;
- t = x - bexp*ln_two1.x;
+ eps = bexp * ln_two2.x;
+ t = x - bexp * ln_two1.x;
y = t + three33.x;
base = y - three33.x;
junk2.x = y;
del = (t - base) - eps;
- eps = del + del*del*(p3.x*del + p2.x);
- i = ((junk2.i[LOW_HALF]>>8)&0xfffffffe)+356;
- j = (junk2.i[LOW_HALF]&511)<<1;
- al = coar.x[i]*fine.x[j];
- bet =(coar.x[i]*fine.x[j+1] + coar.x[i+1]*fine.x[j]) + coar.x[i+1]*fine.x[j+1];
- rem=(bet + bet*eps)+al*eps;
+ eps = del + del * del * (p3.x * del + p2.x);
+ i = ((junk2.i[LOW_HALF] >> 8) & 0xfffffffe) + 356;
+ j = (junk2.i[LOW_HALF] & 511) << 1;
+ al = coar.x[i] * fine.x[j];
+ bet = ((coar.x[i] * fine.x[j + 1] + coar.x[i + 1] * fine.x[j])
+ + coar.x[i + 1] * fine.x[j + 1]);
+ rem = (bet + bet * eps) + al * eps;
res = al + rem;
cor = (al - res) + rem;
- if (m>>31) {
- ex=junk1.i[LOW_HALF];
- if (res < 1.0) {res+=res; cor+=cor; ex-=1;}
- if (ex >=-1022) {
- binexp.i[HIGH_HALF] = (1023+ex)<<20;
- if (res == (res+cor*err_0)) { retval = res*binexp.x; goto ret; }
- else { retval = __slowexp(x); goto ret; } /*if error is over bound */
+ if (m >> 31)
+ {
+ ex = junk1.i[LOW_HALF];
+ if (res < 1.0)
+ {
+ res += res;
+ cor += cor;
+ ex -= 1;
+ }
+ if (ex >= -1022)
+ {
+ binexp.i[HIGH_HALF] = (1023 + ex) << 20;
+ if (res == (res + cor * err_0))
+ {
+ retval = res * binexp.x;
+ goto ret;
+ }
+ else
+ {
+ retval = __slowexp (x);
+ goto ret;
+ } /*if error is over bound */
+ }
+ ex = -(1022 + ex);
+ binexp.i[HIGH_HALF] = (1023 - ex) << 20;
+ res *= binexp.x;
+ cor *= binexp.x;
+ eps = 1.0000000001 + err_0 * binexp.x;
+ t = 1.0 + res;
+ y = ((1.0 - t) + res) + cor;
+ res = t + y;
+ cor = (t - res) + y;
+ if (res == (res + eps * cor))
+ {
+ binexp.i[HIGH_HALF] = 0x00100000;
+ retval = (res - 1.0) * binexp.x;
+ goto ret;
+ }
+ else
+ {
+ retval = __slowexp (x);
+ goto ret;
+ } /* if error is over bound */
}
- ex = -(1022+ex);
- binexp.i[HIGH_HALF] = (1023-ex)<<20;
- res*=binexp.x;
- cor*=binexp.x;
- eps=1.0000000001+err_0*binexp.x;
- t=1.0+res;
- y = ((1.0-t)+res)+cor;
- res=t+y;
- cor = (t-res)+y;
- if (res == (res + eps*cor))
- { binexp.i[HIGH_HALF] = 0x00100000;
- retval = (res-1.0)*binexp.x;
- goto ret;
+ else
+ {
+ binexp.i[HIGH_HALF] = (junk1.i[LOW_HALF] + 767) << 20;
+ if (res == (res + cor * err_0))
+ {
+ retval = res * binexp.x * t256.x;
+ goto ret;
+ }
+ else
+ {
+ retval = __slowexp (x);
+ goto ret;
+ }
}
- else { retval = __slowexp(x); goto ret; } /* if error is over bound */
- }
- else {
- binexp.i[HIGH_HALF] =(junk1.i[LOW_HALF]+767)<<20;
- if (res == (res+cor*err_0)) { retval = res*binexp.x*t256.x; goto ret; }
- else { retval = __slowexp(x); goto ret; }
- }
- ret:
+ret:
return retval;
}
#ifndef __ieee754_exp
strong_alias (__ieee754_exp, __exp_finite)
#endif
-/************************************************************************/
-/* Compute e^(x+xx)(Double-Length number) .The routine also receive */
-/* bound of error of previous calculation .If after computing exp */
-/* error bigger than allows routine return non positive number */
-/*else return e^(x + xx) (always positive ) */
-/************************************************************************/
-
+/* Compute e^(x+xx). The routine also receives bound of error of previous
+ calculation. If after computing exp the error exceeds the allowed bounds,
+ the routine returns a non-positive number. Otherwise it returns the
+ computed result, which is always positive. */
double
SECTION
-__exp1(double x, double xx, double error) {
+__exp1 (double x, double xx, double error)
+{
double bexp, t, eps, del, base, y, al, bet, res, rem, cor;
- mynumber junk1, junk2, binexp = {{0,0}};
- int4 i,j,m,n,ex;
+ mynumber junk1, junk2, binexp = {{0, 0}};
+ int4 i, j, m, n, ex;
junk1.x = x;
m = junk1.i[HIGH_HALF];
- n = m&hugeint; /* no sign */
-
- if (n > smallint && n < bigint) {
- y = x*log2e.x + three51.x;
- bexp = y - three51.x; /* multiply the result by 2**bexp */
+ n = m & hugeint; /* no sign */
- junk1.x = y;
+ if (n > smallint && n < bigint)
+ {
+ y = x * log2e.x + three51.x;
+ bexp = y - three51.x; /* multiply the result by 2**bexp */
- eps = bexp*ln_two2.x; /* x = bexp*ln(2) + t - eps */
- t = x - bexp*ln_two1.x;
+ junk1.x = y;
- y = t + three33.x;
- base = y - three33.x; /* t rounded to a multiple of 2**-18 */
- junk2.x = y;
- del = (t - base) + (xx-eps); /* x = bexp*ln(2) + base + del */
- eps = del + del*del*(p3.x*del + p2.x);
+ eps = bexp * ln_two2.x; /* x = bexp*ln(2) + t - eps */
+ t = x - bexp * ln_two1.x;
- binexp.i[HIGH_HALF] =(junk1.i[LOW_HALF]+1023)<<20;
+ y = t + three33.x;
+ base = y - three33.x; /* t rounded to a multiple of 2**-18 */
+ junk2.x = y;
+ del = (t - base) + (xx - eps); /* x = bexp*ln(2) + base + del */
+ eps = del + del * del * (p3.x * del + p2.x);
- i = ((junk2.i[LOW_HALF]>>8)&0xfffffffe)+356;
- j = (junk2.i[LOW_HALF]&511)<<1;
+ binexp.i[HIGH_HALF] = (junk1.i[LOW_HALF] + 1023) << 20;
- al = coar.x[i]*fine.x[j];
- bet =(coar.x[i]*fine.x[j+1] + coar.x[i+1]*fine.x[j]) + coar.x[i+1]*fine.x[j+1];
+ i = ((junk2.i[LOW_HALF] >> 8) & 0xfffffffe) + 356;
+ j = (junk2.i[LOW_HALF] & 511) << 1;
- rem=(bet + bet*eps)+al*eps;
- res = al + rem;
- cor = (al - res) + rem;
- if (res == (res+cor*(1.0+error+err_1))) return res*binexp.x;
- else return -10.0;
- }
+ al = coar.x[i] * fine.x[j];
+ bet = ((coar.x[i] * fine.x[j + 1] + coar.x[i + 1] * fine.x[j])
+ + coar.x[i + 1] * fine.x[j + 1]);
- if (n <= smallint) return 1.0; /* if x->0 e^x=1 */
+ rem = (bet + bet * eps) + al * eps;
+ res = al + rem;
+ cor = (al - res) + rem;
+ if (res == (res + cor * (1.0 + error + err_1)))
+ return res * binexp.x;
+ else
+ return -10.0;
+ }
- if (n >= badint) {
- if (n > infint) return(zero/zero); /* x is NaN, return invalid */
- if (n < infint) return ( (x>0) ? (hhuge*hhuge) : (tiny*tiny) );
- /* x is finite, cause either overflow or underflow */
- if (junk1.i[LOW_HALF] != 0) return (zero/zero); /* x is NaN */
- return ((x>0)?inf.x:zero ); /* |x| = inf; return either inf or 0 */
- }
+ if (n <= smallint)
+ return 1.0; /* if x->0 e^x=1 */
+
+ if (n >= badint)
+ {
+ if (n > infint)
+ return (zero / zero); /* x is NaN, return invalid */
+ if (n < infint)
+ return ((x > 0) ? (hhuge * hhuge) : (tiny * tiny));
+ /* x is finite, cause either overflow or underflow */
+ if (junk1.i[LOW_HALF] != 0)
+ return (zero / zero); /* x is NaN */
+ return ((x > 0) ? inf.x : zero); /* |x| = inf; return either inf or 0 */
+ }
- y = x*log2e.x + three51.x;
+ y = x * log2e.x + three51.x;
bexp = y - three51.x;
junk1.x = y;
- eps = bexp*ln_two2.x;
- t = x - bexp*ln_two1.x;
+ eps = bexp * ln_two2.x;
+ t = x - bexp * ln_two1.x;
y = t + three33.x;
base = y - three33.x;
junk2.x = y;
- del = (t - base) + (xx-eps);
- eps = del + del*del*(p3.x*del + p2.x);
- i = ((junk2.i[LOW_HALF]>>8)&0xfffffffe)+356;
- j = (junk2.i[LOW_HALF]&511)<<1;
- al = coar.x[i]*fine.x[j];
- bet =(coar.x[i]*fine.x[j+1] + coar.x[i+1]*fine.x[j]) + coar.x[i+1]*fine.x[j+1];
- rem=(bet + bet*eps)+al*eps;
+ del = (t - base) + (xx - eps);
+ eps = del + del * del * (p3.x * del + p2.x);
+ i = ((junk2.i[LOW_HALF] >> 8) & 0xfffffffe) + 356;
+ j = (junk2.i[LOW_HALF] & 511) << 1;
+ al = coar.x[i] * fine.x[j];
+ bet = ((coar.x[i] * fine.x[j + 1] + coar.x[i + 1] * fine.x[j])
+ + coar.x[i + 1] * fine.x[j + 1]);
+ rem = (bet + bet * eps) + al * eps;
res = al + rem;
cor = (al - res) + rem;
- if (m>>31) {
- ex=junk1.i[LOW_HALF];
- if (res < 1.0) {res+=res; cor+=cor; ex-=1;}
- if (ex >=-1022) {
- binexp.i[HIGH_HALF] = (1023+ex)<<20;
- if (res == (res+cor*(1.0+error+err_1))) return res*binexp.x;
- else return -10.0;
+ if (m >> 31)
+ {
+ ex = junk1.i[LOW_HALF];
+ if (res < 1.0)
+ {
+ res += res;
+ cor += cor;
+ ex -= 1;
+ }
+ if (ex >= -1022)
+ {
+ binexp.i[HIGH_HALF] = (1023 + ex) << 20;
+ if (res == (res + cor * (1.0 + error + err_1)))
+ return res * binexp.x;
+ else
+ return -10.0;
+ }
+ ex = -(1022 + ex);
+ binexp.i[HIGH_HALF] = (1023 - ex) << 20;
+ res *= binexp.x;
+ cor *= binexp.x;
+ eps = 1.00000000001 + (error + err_1) * binexp.x;
+ t = 1.0 + res;
+ y = ((1.0 - t) + res) + cor;
+ res = t + y;
+ cor = (t - res) + y;
+ if (res == (res + eps * cor))
+ {
+ binexp.i[HIGH_HALF] = 0x00100000;
+ return (res - 1.0) * binexp.x;
+ }
+ else
+ return -10.0;
+ }
+ else
+ {
+ binexp.i[HIGH_HALF] = (junk1.i[LOW_HALF] + 767) << 20;
+ if (res == (res + cor * (1.0 + error + err_1)))
+ return res * binexp.x * t256.x;
+ else
+ return -10.0;
}
- ex = -(1022+ex);
- binexp.i[HIGH_HALF] = (1023-ex)<<20;
- res*=binexp.x;
- cor*=binexp.x;
- eps=1.00000000001+(error+err_1)*binexp.x;
- t=1.0+res;
- y = ((1.0-t)+res)+cor;
- res=t+y;
- cor = (t-res)+y;
- if (res == (res + eps*cor))
- {binexp.i[HIGH_HALF] = 0x00100000; return (res-1.0)*binexp.x;}
- else return -10.0;
- }
- else {
- binexp.i[HIGH_HALF] =(junk1.i[LOW_HALF]+767)<<20;
- if (res == (res+cor*(1.0+error+err_1)))
- return res*binexp.x*t256.x;
- else return -10.0;
- }
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_exp2.c b/libc/sysdeps/ieee754/dbl-64/e_exp2.c
index 96ec735e3..e1ba940e6 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -46,7 +46,7 @@ __ieee754_exp2 (double x)
if (__builtin_expect (isless (x, himark), 1))
{
/* Exceptional cases: */
- if (__builtin_expect (! isgreaterequal (x, lomark), 0))
+ if (__builtin_expect (!isgreaterequal (x, lomark), 0))
{
if (__isinf (x))
/* e^-inf == 0, with no error. */
@@ -93,7 +93,7 @@ __ieee754_exp2 (double x)
/* 3. Compute ex2 = 2^(t/512+e+ex). */
ex2_u.d = exp2_accuratetable[tval & 511];
tval >>= 9;
- unsafe = abs(tval) >= -DBL_MIN_EXP - 1;
+ unsafe = abs (tval) >= -DBL_MIN_EXP - 1;
ex2_u.ieee.exponent += tval >> unsafe;
scale_u.d = 1.0;
scale_u.ieee.exponent += tval - (tval >> unsafe);
@@ -106,7 +106,7 @@ __ieee754_exp2 (double x)
* x + .055504110254308625)
* x + .240226506959100583)
* x + .69314718055994495) * ex2_u.d;
- math_opt_barrier (x22);
+ math_opt_barrier (x22);
}
/* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */
@@ -119,6 +119,6 @@ __ieee754_exp2 (double x)
}
else
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
- return TWO1023*x;
+ return TWO1023 * x;
}
strong_alias (__ieee754_exp2, __exp2_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_fmod.c b/libc/sysdeps/ieee754/dbl-64/e_fmod.c
index b8548fae4..c83c2aedb 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_fmod.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_fmod.c
@@ -18,111 +18,156 @@
#include <math.h>
#include <math_private.h>
-static const double one = 1.0, Zero[] = {0.0, -0.0,};
+static const double one = 1.0, Zero[] = { 0.0, -0.0, };
double
__ieee754_fmod (double x, double y)
{
- int32_t n,hx,hy,hz,ix,iy,sx,i;
- u_int32_t lx,ly,lz;
+ int32_t n, hx, hy, hz, ix, iy, sx, i;
+ u_int32_t lx, ly, lz;
- EXTRACT_WORDS(hx,lx,x);
- EXTRACT_WORDS(hy,ly,y);
- sx = hx&0x80000000; /* sign of x */
- hx ^=sx; /* |x| */
- hy &= 0x7fffffff; /* |y| */
+ EXTRACT_WORDS (hx, lx, x);
+ EXTRACT_WORDS (hy, ly, y);
+ sx = hx & 0x80000000; /* sign of x */
+ hx ^= sx; /* |x| */
+ hy &= 0x7fffffff; /* |y| */
- /* purge off exception values */
- if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */
- ((hy|((ly|-ly)>>31))>0x7ff00000)) /* 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_int32_t)sx>>31]; /* |x|=|y| return x*0*/
- }
+ /* purge off exception values */
+ if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y=0,or x not finite */
+ ((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* 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_int32_t) sx >> 31]; /* |x|=|y| return x*0*/
+ }
- /* determine ix = ilogb(x) */
- if(__builtin_expect(hx<0x00100000, 0)) { /* subnormal x */
- if(hx==0) {
- for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
- } else {
- for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
- }
- } else ix = (hx>>20)-1023;
+ /* determine ix = ilogb(x) */
+ if (__builtin_expect (hx < 0x00100000, 0)) /* subnormal x */
+ {
+ if (hx == 0)
+ {
+ for (ix = -1043, i = lx; i > 0; i <<= 1)
+ ix -= 1;
+ }
+ else
+ {
+ for (ix = -1022, i = (hx << 11); i > 0; i <<= 1)
+ ix -= 1;
+ }
+ }
+ else
+ ix = (hx >> 20) - 1023;
- /* determine iy = ilogb(y) */
- if(__builtin_expect(hy<0x00100000, 0)) { /* subnormal y */
- if(hy==0) {
- for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
- } else {
- for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
- }
- } else iy = (hy>>20)-1023;
+ /* determine iy = ilogb(y) */
+ if (__builtin_expect (hy < 0x00100000, 0)) /* subnormal y */
+ {
+ if (hy == 0)
+ {
+ for (iy = -1043, i = ly; i > 0; i <<= 1)
+ iy -= 1;
+ }
+ else
+ {
+ for (iy = -1022, i = (hy << 11); i > 0; i <<= 1)
+ iy -= 1;
+ }
+ }
+ else
+ iy = (hy >> 20) - 1023;
- /* set up {hx,lx}, {hy,ly} and align y to x */
- if(__builtin_expect(ix >= -1022, 1))
- hx = 0x00100000|(0x000fffff&hx);
- else { /* subnormal x, shift x to normal */
- n = -1022-ix;
- if(n<=31) {
- hx = (hx<<n)|(lx>>(32-n));
- lx <<= n;
- } else {
- hx = lx<<(n-32);
- lx = 0;
- }
+ /* set up {hx,lx}, {hy,ly} and align y to x */
+ if (__builtin_expect (ix >= -1022, 1))
+ hx = 0x00100000 | (0x000fffff & hx);
+ else /* subnormal x, shift x to normal */
+ {
+ n = -1022 - ix;
+ if (n <= 31)
+ {
+ hx = (hx << n) | (lx >> (32 - n));
+ lx <<= n;
+ }
+ else
+ {
+ hx = lx << (n - 32);
+ lx = 0;
+ }
+ }
+ if (__builtin_expect (iy >= -1022, 1))
+ hy = 0x00100000 | (0x000fffff & hy);
+ else /* subnormal y, shift y to normal */
+ {
+ n = -1022 - iy;
+ if (n <= 31)
+ {
+ hy = (hy << n) | (ly >> (32 - n));
+ ly <<= n;
}
- if(__builtin_expect(iy >= -1022, 1))
- hy = 0x00100000|(0x000fffff&hy);
- else { /* subnormal y, shift y to normal */
- n = -1022-iy;
- if(n<=31) {
- hy = (hy<<n)|(ly>>(32-n));
- ly <<= n;
- } else {
- hy = ly<<(n-32);
- ly = 0;
- }
+ else
+ {
+ hy = ly << (n - 32);
+ 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>>31); lx = lx+lx;}
- else {
- if((hz|lz)==0) /* return sign(x)*0 */
- return Zero[(u_int32_t)sx>>31];
- hx = hz+hz+(lz>>31); lx = lz+lz;
- }
+ /* 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 >> 31); lx = lx + lx;
}
- hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
- if(hz>=0) {hx=hz;lx=lz;}
+ else
+ {
+ if ((hz | lz) == 0) /* return sign(x)*0 */
+ return Zero[(u_int32_t) sx >> 31];
+ hx = hz + hz + (lz >> 31); 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)==0) /* return sign(x)*0 */
- return Zero[(u_int32_t)sx>>31];
- while(hx<0x00100000) { /* normalize x */
- hx = hx+hx+(lx>>31); lx = lx+lx;
- iy -= 1;
+ /* convert back to floating value and restore the sign */
+ if ((hx | lx) == 0) /* return sign(x)*0 */
+ return Zero[(u_int32_t) sx >> 31];
+ while (hx < 0x00100000) /* normalize x */
+ {
+ hx = hx + hx + (lx >> 31); lx = lx + lx;
+ iy -= 1;
+ }
+ if (__builtin_expect (iy >= -1022, 1)) /* normalize output */
+ {
+ hx = ((hx - 0x00100000) | ((iy + 1023) << 20));
+ INSERT_WORDS (x, hx | sx, lx);
+ }
+ else /* subnormal output */
+ {
+ n = -1022 - iy;
+ if (n <= 20)
+ {
+ lx = (lx >> n) | ((u_int32_t) hx << (32 - n));
+ hx >>= n;
+ }
+ else if (n <= 31)
+ {
+ lx = (hx << (32 - n)) | (lx >> n); hx = sx;
}
- if(__builtin_expect(iy>= -1022, 1)) { /* normalize output */
- hx = ((hx-0x00100000)|((iy+1023)<<20));
- INSERT_WORDS(x,hx|sx,lx);
- } else { /* subnormal output */
- n = -1022 - iy;
- if(n<=20) {
- lx = (lx>>n)|((u_int32_t)hx<<(32-n));
- hx >>= n;
- } else if (n<=31) {
- lx = (hx<<(32-n))|(lx>>n); hx = sx;
- } else {
- lx = hx>>(n-32); hx = sx;
- }
- INSERT_WORDS(x,hx|sx,lx);
- x *= one; /* create necessary signal */
+ else
+ {
+ lx = hx >> (n - 32); hx = sx;
}
- return x; /* exact output */
+ INSERT_WORDS (x, hx | sx, lx);
+ x *= one; /* create necessary signal */
+ }
+ return x; /* exact output */
}
strong_alias (__ieee754_fmod, __fmod_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_gamma_r.c b/libc/sysdeps/ieee754/dbl-64/e_gamma_r.c
index 5b17f7b5a..13e389d7c 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_gamma_r.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_gamma_r.c
@@ -135,7 +135,7 @@ __ieee754_gamma_r (double x, int *signgamp)
*signgamp = 0;
return (x - x) / (x - x);
}
- if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx==0, 0))
+ if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx == 0, 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
diff --git a/libc/sysdeps/ieee754/dbl-64/e_hypot.c b/libc/sysdeps/ieee754/dbl-64/e_hypot.c
index 2dd681cf1..9f4321efe 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -46,76 +46,101 @@
#include <math_private.h>
double
-__ieee754_hypot(double x, double y)
+__ieee754_hypot (double x, double y)
{
- double a,b,t1,t2,y1,y2,w;
- int32_t j,k,ha,hb;
+ double a, b, t1, t2, y1, y2, w;
+ int32_t j, k, ha, hb;
- GET_HIGH_WORD(ha,x);
- ha &= 0x7fffffff;
- GET_HIGH_WORD(hb,y);
- hb &= 0x7fffffff;
- if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
- SET_HIGH_WORD(a,ha); /* a <- |a| */
- SET_HIGH_WORD(b,hb); /* b <- |b| */
- if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */
- k=0;
- if(__builtin_expect(ha > 0x5f300000, 0)) { /* a>2**500 */
- if(ha >= 0x7ff00000) { /* Inf or NaN */
- u_int32_t low;
- w = a+b; /* for sNaN */
- GET_LOW_WORD(low,a);
- if(((ha&0xfffff)|low)==0) w = a;
- GET_LOW_WORD(low,b);
- if(((hb^0x7ff00000)|low)==0) w = b;
- return w;
- }
- /* scale a and b by 2**-600 */
- ha -= 0x25800000; hb -= 0x25800000; k += 600;
- SET_HIGH_WORD(a,ha);
- SET_HIGH_WORD(b,hb);
+ GET_HIGH_WORD (ha, x);
+ ha &= 0x7fffffff;
+ GET_HIGH_WORD (hb, y);
+ hb &= 0x7fffffff;
+ if (hb > ha)
+ {
+ a = y; b = x; j = ha; ha = hb; hb = j;
+ }
+ else
+ {
+ a = x; b = y;
+ }
+ SET_HIGH_WORD (a, ha); /* a <- |a| */
+ SET_HIGH_WORD (b, hb); /* b <- |b| */
+ if ((ha - hb) > 0x3c00000)
+ {
+ return a + b;
+ } /* x/y > 2**60 */
+ k = 0;
+ if (__builtin_expect (ha > 0x5f300000, 0)) /* a>2**500 */
+ {
+ if (ha >= 0x7ff00000) /* Inf or NaN */
+ {
+ u_int32_t low;
+ w = a + b; /* for sNaN */
+ GET_LOW_WORD (low, a);
+ if (((ha & 0xfffff) | low) == 0)
+ w = a;
+ GET_LOW_WORD (low, b);
+ if (((hb ^ 0x7ff00000) | low) == 0)
+ w = b;
+ return w;
}
- if(__builtin_expect(hb < 0x20b00000, 0)) { /* b < 2**-500 */
- if(hb <= 0x000fffff) { /* subnormal b or 0 */
- u_int32_t low;
- GET_LOW_WORD(low,b);
- if((hb|low)==0) return a;
- t1=0;
- SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */
- b *= t1;
- a *= t1;
- k -= 1022;
- } else { /* scale a and b by 2^600 */
- ha += 0x25800000; /* a *= 2^600 */
- hb += 0x25800000; /* b *= 2^600 */
- k -= 600;
- SET_HIGH_WORD(a,ha);
- SET_HIGH_WORD(b,hb);
- }
+ /* scale a and b by 2**-600 */
+ ha -= 0x25800000; hb -= 0x25800000; k += 600;
+ SET_HIGH_WORD (a, ha);
+ SET_HIGH_WORD (b, hb);
+ }
+ if (__builtin_expect (hb < 0x20b00000, 0)) /* b < 2**-500 */
+ {
+ if (hb <= 0x000fffff) /* subnormal b or 0 */
+ {
+ u_int32_t low;
+ GET_LOW_WORD (low, b);
+ if ((hb | low) == 0)
+ return a;
+ t1 = 0;
+ SET_HIGH_WORD (t1, 0x7fd00000); /* t1=2^1022 */
+ b *= t1;
+ a *= t1;
+ k -= 1022;
}
- /* medium size a and b */
- w = a-b;
- if (w>b) {
- t1 = 0;
- SET_HIGH_WORD(t1,ha);
- t2 = a-t1;
- w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
- } else {
- a = a+a;
- y1 = 0;
- SET_HIGH_WORD(y1,hb);
- y2 = b - y1;
- t1 = 0;
- SET_HIGH_WORD(t1,ha+0x00100000);
- t2 = a - t1;
- w = __ieee754_sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
+ else /* scale a and b by 2^600 */
+ {
+ ha += 0x25800000; /* a *= 2^600 */
+ hb += 0x25800000; /* b *= 2^600 */
+ k -= 600;
+ SET_HIGH_WORD (a, ha);
+ SET_HIGH_WORD (b, hb);
}
- if(k!=0) {
- u_int32_t high;
- t1 = 1.0;
- GET_HIGH_WORD(high,t1);
- SET_HIGH_WORD(t1,high+(k<<20));
- return t1*w;
- } else return w;
+ }
+ /* medium size a and b */
+ w = a - b;
+ if (w > b)
+ {
+ t1 = 0;
+ SET_HIGH_WORD (t1, ha);
+ t2 = a - t1;
+ w = __ieee754_sqrt (t1 * t1 - (b * (-b) - t2 * (a + t1)));
+ }
+ else
+ {
+ a = a + a;
+ y1 = 0;
+ SET_HIGH_WORD (y1, hb);
+ y2 = b - y1;
+ t1 = 0;
+ SET_HIGH_WORD (t1, ha + 0x00100000);
+ t2 = a - t1;
+ w = __ieee754_sqrt (t1 * y1 - (w * (-w) - (t1 * y2 + t2 * b)));
+ }
+ if (k != 0)
+ {
+ u_int32_t high;
+ t1 = 1.0;
+ GET_HIGH_WORD (high, t1);
+ SET_HIGH_WORD (t1, high + (k << 20));
+ return t1 * w;
+ }
+ else
+ return w;
}
strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_ilogb.c b/libc/sysdeps/ieee754/dbl-64/e_ilogb.c
index 0452a71fb..1e338a59c 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_ilogb.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_ilogb.c
@@ -25,30 +25,39 @@ static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $";
#include <math.h>
#include <math_private.h>
-int __ieee754_ilogb(double x)
+int
+__ieee754_ilogb (double x)
{
- int32_t hx,lx,ix;
+ int32_t hx, lx, ix;
- GET_HIGH_WORD(hx,x);
- hx &= 0x7fffffff;
- if(hx<0x00100000) {
- GET_LOW_WORD(lx,x);
- if((hx|lx)==0)
- return FP_ILOGB0; /* ilogb(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;
+ GET_HIGH_WORD (hx, x);
+ hx &= 0x7fffffff;
+ if (hx < 0x00100000)
+ {
+ GET_LOW_WORD (lx, x);
+ if ((hx | lx) == 0)
+ return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */
+ else /* subnormal x */
+ if (hx == 0)
+ {
+ for (ix = -1043; lx > 0; lx <<= 1)
+ ix -= 1;
}
- else if (hx<0x7ff00000) return (hx>>20)-1023;
- else if (FP_ILOGBNAN != INT_MAX) {
- /* ISO C99 requires ilogb(+-Inf) == INT_MAX. */
- GET_LOW_WORD(lx,x);
- if(((hx^0x7ff00000)|lx) == 0)
- return INT_MAX;
+ else
+ {
+ for (ix = -1022, hx <<= 11; hx > 0; hx <<= 1)
+ ix -= 1;
}
- return FP_ILOGBNAN;
+ return ix;
+ }
+ else if (hx < 0x7ff00000)
+ return (hx >> 20) - 1023;
+ else if (FP_ILOGBNAN != INT_MAX)
+ {
+ /* ISO C99 requires ilogb(+-Inf) == INT_MAX. */
+ GET_LOW_WORD (lx, x);
+ if (((hx ^ 0x7ff00000) | lx) == 0)
+ return INT_MAX;
+ }
+ return FP_ILOGBNAN;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_j0.c b/libc/sysdeps/ieee754/dbl-64/e_j0.c
index d641a0914..d165e8092 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_j0.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_j0.c
@@ -11,7 +11,7 @@
*/
/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26,
for performance improvement on pipelined processors.
-*/
+ */
/* __ieee754_j0(x), __ieee754_y0(x)
* Bessel function of the first and second kinds of order zero.
@@ -61,154 +61,166 @@
#include <math.h>
#include <math_private.h>
-static double pzero(double), qzero(double);
+static double pzero (double), qzero (double);
static const double
-huge = 1e300,
-one = 1.0,
-invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
- /* R0/S0 on [0, 2.00] */
-R[] = {0.0, 0.0, 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */
- -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */
- 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */
- -4.61832688532103189199e-09}, /* 0xBE33D5E7, 0x73D63FCE */
-S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */
- 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */
- 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
- 1.16614003333790000205e-09}; /* 0x3E1408BC, 0xF4745D8F */
+ huge = 1e300,
+ one = 1.0,
+ invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
+ tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+/* R0/S0 on [0, 2.00] */
+ R[] = { 0.0, 0.0, 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */
+ -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */
+ 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */
+ -4.61832688532103189199e-09 }, /* 0xBE33D5E7, 0x73D63FCE */
+ S[] = { 0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */
+ 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */
+ 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
+ 1.16614003333790000205e-09 }; /* 0x3E1408BC, 0xF4745D8F */
static const double zero = 0.0;
double
-__ieee754_j0(double x)
+__ieee754_j0 (double x)
{
- double z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4;
- int32_t hx,ix;
+ double z, s, c, ss, cc, r, u, v, r1, r2, s1, s2, z2, z4;
+ int32_t hx, ix;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return one/(x*x);
- x = fabs(x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- __sincos (x, &s, &c);
- ss = s-c;
- cc = s+c;
- if(ix<0x7fe00000) { /* make sure x+x not overflow */
- z = -__cos(x+x);
- if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
- }
- /*
- * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
- * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
- */
- if(ix>0x48000000) z = (invsqrtpi*cc)/__ieee754_sqrt(x);
- else {
- u = pzero(x); v = qzero(x);
- z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(x);
- }
- return z;
- }
- if(ix<0x3f200000) { /* |x| < 2**-13 */
- math_force_eval(huge+x); /* raise inexact if x != 0 */
- if(ix<0x3e400000) return one; /* |x|<2**-27 */
- else return one - 0.25*x*x;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ if (ix >= 0x7ff00000)
+ return one / (x * x);
+ x = fabs (x);
+ if (ix >= 0x40000000) /* |x| >= 2.0 */
+ {
+ __sincos (x, &s, &c);
+ ss = s - c;
+ cc = s + c;
+ if (ix < 0x7fe00000) /* make sure x+x not overflow */
+ {
+ z = -__cos (x + x);
+ if ((s * c) < zero)
+ cc = z / ss;
+ else
+ ss = z / cc;
}
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- r = z*(R02+z*(R03+z*(R04+z*R05)));
- s = one+z*(S01+z*(S02+z*(S03+z*S04)));
-#else
- r1 = z*R[2]; z2=z*z;
- r2 = R[3]+z*R[4]; z4=z2*z2;
- r = r1 + z2*r2 + z4*R[5];
- s1 = one+z*S[1];
- s2 = S[2]+z*S[3];
- s = s1 + z2*s2 + z4*S[4];
-#endif
- if(ix < 0x3FF00000) { /* |x| < 1.00 */
- return one + z*(-0.25+(r/s));
- } else {
- u = 0.5*x;
- return((one+u)*(one-u)+z*(r/s));
+ /*
+ * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
+ * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
+ */
+ if (ix > 0x48000000)
+ z = (invsqrtpi * cc) / __ieee754_sqrt (x);
+ else
+ {
+ u = pzero (x); v = qzero (x);
+ z = invsqrtpi * (u * cc - v * ss) / __ieee754_sqrt (x);
}
+ return z;
+ }
+ if (ix < 0x3f200000) /* |x| < 2**-13 */
+ {
+ math_force_eval (huge + x); /* raise inexact if x != 0 */
+ if (ix < 0x3e400000)
+ return one; /* |x|<2**-27 */
+ else
+ return one - 0.25 * x * x;
+ }
+ z = x * x;
+ r1 = z * R[2]; z2 = z * z;
+ r2 = R[3] + z * R[4]; z4 = z2 * z2;
+ r = r1 + z2 * r2 + z4 * R[5];
+ s1 = one + z * S[1];
+ s2 = S[2] + z * S[3];
+ s = s1 + z2 * s2 + z4 * S[4];
+ if (ix < 0x3FF00000) /* |x| < 1.00 */
+ {
+ return one + z * (-0.25 + (r / s));
+ }
+ else
+ {
+ u = 0.5 * x;
+ return ((one + u) * (one - u) + z * (r / s));
+ }
}
strong_alias (__ieee754_j0, __j0_finite)
static const double
-U[] = {-7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
- 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
- -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */
- 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */
- -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */
- 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */
- -3.98205194132103398453e-11}, /* 0xBDC5E43D, 0x693FB3C8 */
-V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
- 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
- 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
- 4.41110311332675467403e-10}; /* 0x3DFE5018, 0x3BD6D9EF */
+U[] = { -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
+ 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
+ -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */
+ 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */
+ -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */
+ 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */
+ -3.98205194132103398453e-11 }, /* 0xBDC5E43D, 0x693FB3C8 */
+V[] = { 1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
+ 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
+ 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
+ 4.41110311332675467403e-10 }; /* 0x3DFE5018, 0x3BD6D9EF */
double
-__ieee754_y0(double x)
+__ieee754_y0 (double x)
{
- double z, s,c,ss,cc,u,v,z2,z4,z6,u1,u2,u3,v1,v2;
- int32_t hx,ix,lx;
+ double z, s, c, ss, cc, u, v, z2, z4, z6, u1, u2, u3, v1, v2;
+ int32_t hx, ix, lx;
- EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
- /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */
- if(ix>=0x7ff00000) return one/(x+x*x);
- if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */
- if(hx<0) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
- * where x0 = x-pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
- * = 1/sqrt(2) * (sin(x) + cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
- __sincos (x, &s, &c);
- ss = s-c;
- cc = s+c;
- /*
- * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
- * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
- */
- if(ix<0x7fe00000) { /* make sure x+x not overflow */
- z = -__cos(x+x);
- if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
- }
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
- else {
- u = pzero(x); v = qzero(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
- }
- return z;
+ EXTRACT_WORDS (hx, lx, x);
+ ix = 0x7fffffff & hx;
+ /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */
+ if (ix >= 0x7ff00000)
+ return one / (x + x * x);
+ if ((ix | lx) == 0)
+ return -HUGE_VAL + x; /* -inf and overflow exception. */
+ if (hx < 0)
+ return zero / (zero * x);
+ if (ix >= 0x40000000) /* |x| >= 2.0 */
+ { /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
+ * where x0 = x-pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
+ * = 1/sqrt(2) * (sin(x) + cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
+ __sincos (x, &s, &c);
+ ss = s - c;
+ cc = s + c;
+ /*
+ * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
+ * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
+ */
+ if (ix < 0x7fe00000) /* make sure x+x not overflow */
+ {
+ z = -__cos (x + x);
+ if ((s * c) < zero)
+ cc = z / ss;
+ else
+ ss = z / cc;
}
- if(ix<=0x3e400000) { /* x < 2**-27 */
- return(U[0] + tpi*__ieee754_log(x));
+ if (ix > 0x48000000)
+ z = (invsqrtpi * ss) / __ieee754_sqrt (x);
+ else
+ {
+ u = pzero (x); v = qzero (x);
+ z = invsqrtpi * (u * ss + v * cc) / __ieee754_sqrt (x);
}
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06)))));
- v = one+z*(v01+z*(v02+z*(v03+z*v04)));
-#else
- u1 = U[0]+z*U[1]; z2=z*z;
- u2 = U[2]+z*U[3]; z4=z2*z2;
- u3 = U[4]+z*U[5]; z6=z4*z2;
- u = u1 + z2*u2 + z4*u3 + z6*U[6];
- v1 = one+z*V[0];
- v2 = V[1]+z*V[2];
- v = v1 + z2*v2 + z4*V[3];
-#endif
- return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x)));
+ return z;
+ }
+ if (ix <= 0x3e400000) /* x < 2**-27 */
+ {
+ return (U[0] + tpi * __ieee754_log (x));
+ }
+ z = x * x;
+ u1 = U[0] + z * U[1]; z2 = z * z;
+ u2 = U[2] + z * U[3]; z4 = z2 * z2;
+ u3 = U[4] + z * U[5]; z6 = z4 * z2;
+ u = u1 + z2 * u2 + z4 * u3 + z6 * U[6];
+ v1 = one + z * V[0];
+ v2 = V[1] + z * V[2];
+ v = v1 + z2 * v2 + z4 * V[3];
+ return (u / v + tpi * (__ieee754_j0 (x) * __ieee754_log (x)));
}
strong_alias (__ieee754_y0, __y0_finite)
@@ -286,33 +298,43 @@ static const double pS2[5] = {
};
static double
-pzero(double x)
+pzero (double x)
{
- const double *p,*q;
- double z,r,s,z2,z4,r1,r2,r3,s1,s2,s3;
- int32_t ix;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- if (ix>=0x41b00000) {return one;}
- else if(ix>=0x40200000){p = pR8; q= pS8;}
- else if(ix>=0x40122E8B){p = pR5; q= pS5;}
- else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
- else if(ix>=0x40000000){p = pR2; q= pS2;}
- z = one/(x*x);
-#ifdef DO_NOT_USE_THIS
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
-#else
- r1 = p[0]+z*p[1]; z2=z*z;
- r2 = p[2]+z*p[3]; z4=z2*z2;
- r3 = p[4]+z*p[5];
- r = r1 + z2*r2 + z4*r3;
- s1 = one+z*q[0];
- s2 = q[1]+z*q[2];
- s3 = q[3]+z*q[4];
- s = s1 + z2*s2 + z4*s3;
-#endif
- return one+ r/s;
+ const double *p, *q;
+ double z, r, s, z2, z4, r1, r2, r3, s1, s2, s3;
+ int32_t ix;
+ GET_HIGH_WORD (ix, x);
+ ix &= 0x7fffffff;
+ if (ix >= 0x41b00000)
+ {
+ return one;
+ }
+ else if (ix >= 0x40200000)
+ {
+ p = pR8; q = pS8;
+ }
+ else if (ix >= 0x40122E8B)
+ {
+ p = pR5; q = pS5;
+ }
+ else if (ix >= 0x4006DB6D)
+ {
+ p = pR3; q = pS3;
+ }
+ else if (ix >= 0x40000000)
+ {
+ p = pR2; q = pS2;
+ }
+ z = one / (x * x);
+ r1 = p[0] + z * p[1]; z2 = z * z;
+ r2 = p[2] + z * p[3]; z4 = z2 * z2;
+ r3 = p[4] + z * p[5];
+ r = r1 + z2 * r2 + z4 * r3;
+ s1 = one + z * q[0];
+ s2 = q[1] + z * q[2];
+ s3 = q[3] + z * q[4];
+ s = s1 + z2 * s2 + z4 * s3;
+ return one + r / s;
}
@@ -394,31 +416,41 @@ static const double qS2[6] = {
};
static double
-qzero(double x)
+qzero (double x)
{
- const double *p,*q;
- double s,r,z,z2,z4,z6,r1,r2,r3,s1,s2,s3;
- int32_t ix;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- if (ix>=0x41b00000) {return -.125/x;}
- else if(ix>=0x40200000){p = qR8; q= qS8;}
- else if(ix>=0x40122E8B){p = qR5; q= qS5;}
- else if(ix>=0x4006DB6D){p = qR3; q= qS3;}
- else if(ix>=0x40000000){p = qR2; q= qS2;}
- z = one/(x*x);
-#ifdef DO_NOT_USE_THIS
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
-#else
- r1 = p[0]+z*p[1]; z2=z*z;
- r2 = p[2]+z*p[3]; z4=z2*z2;
- r3 = p[4]+z*p[5]; z6=z4*z2;
- r= r1 + z2*r2 + z4*r3;
- s1 = one+z*q[0];
- s2 = q[1]+z*q[2];
- s3 = q[3]+z*q[4];
- s = s1 + z2*s2 + z4*s3 +z6*q[5];
-#endif
- return (-.125 + r/s)/x;
+ const double *p, *q;
+ double s, r, z, z2, z4, z6, r1, r2, r3, s1, s2, s3;
+ int32_t ix;
+ GET_HIGH_WORD (ix, x);
+ ix &= 0x7fffffff;
+ if (ix >= 0x41b00000)
+ {
+ return -.125 / x;
+ }
+ else if (ix >= 0x40200000)
+ {
+ p = qR8; q = qS8;
+ }
+ else if (ix >= 0x40122E8B)
+ {
+ p = qR5; q = qS5;
+ }
+ else if (ix >= 0x4006DB6D)
+ {
+ p = qR3; q = qS3;
+ }
+ else if (ix >= 0x40000000)
+ {
+ p = qR2; q = qS2;
+ }
+ z = one / (x * x);
+ r1 = p[0] + z * p[1]; z2 = z * z;
+ r2 = p[2] + z * p[3]; z4 = z2 * z2;
+ r3 = p[4] + z * p[5]; z6 = z4 * z2;
+ r = r1 + z2 * r2 + z4 * r3;
+ s1 = one + z * q[0];
+ s2 = q[1] + z * q[2];
+ s3 = q[3] + z * q[4];
+ s = s1 + z2 * s2 + z4 * s3 + z6 * q[5];
+ return (-.125 + r / s) / x;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_j1.c b/libc/sysdeps/ieee754/dbl-64/e_j1.c
index cca5f20b4..ab754c6ee 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_j1.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_j1.c
@@ -11,7 +11,7 @@
*/
/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26,
for performance improvement on pipelined processors.
-*/
+ */
/* __ieee754_j1(x), __ieee754_y1(x)
* Bessel function of the first and second kinds of order zero.
@@ -61,76 +61,81 @@
#include <math.h>
#include <math_private.h>
-static double pone(double), qone(double);
+static double pone (double), qone (double);
static const double
-huge = 1e300,
-one = 1.0,
-invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
- /* R0/S0 on [0,2] */
-R[] = {-6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */
- 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */
- -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */
- 4.96727999609584448412e-08}, /* 0x3E6AAAFA, 0x46CA0BD9 */
-S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */
- 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */
- 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */
- 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */
- 1.23542274426137913908e-11}; /* 0x3DAB2ACF, 0xCFB97ED8 */
+ huge = 1e300,
+ one = 1.0,
+ invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
+ tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+/* R0/S0 on [0,2] */
+ R[] = { -6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */
+ 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */
+ -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */
+ 4.96727999609584448412e-08 }, /* 0x3E6AAAFA, 0x46CA0BD9 */
+ S[] = { 0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */
+ 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */
+ 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */
+ 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */
+ 1.23542274426137913908e-11 }; /* 0x3DAB2ACF, 0xCFB97ED8 */
-static const double zero = 0.0;
+static const double zero = 0.0;
double
-__ieee754_j1(double x)
+__ieee754_j1 (double x)
{
- double z, s,c,ss,cc,r,u,v,y,r1,r2,s1,s2,s3,z2,z4;
- int32_t hx,ix;
+ double z, s, c, ss, cc, r, u, v, y, r1, r2, s1, s2, s3, z2, z4;
+ int32_t hx, ix;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(__builtin_expect(ix>=0x7ff00000, 0)) return one/x;
- y = fabs(x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- __sincos (y, &s, &c);
- ss = -s-c;
- cc = s-c;
- if(ix<0x7fe00000) { /* make sure y+y not overflow */
- z = __cos(y+y);
- if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
- }
- /*
- * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
- * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
- */
- if(ix>0x48000000) z = (invsqrtpi*cc)/__ieee754_sqrt(y);
- else {
- u = pone(y); v = qone(y);
- z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(y);
- }
- if(hx<0) return -z;
- else return z;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ if (__builtin_expect (ix >= 0x7ff00000, 0))
+ return one / x;
+ y = fabs (x);
+ if (ix >= 0x40000000) /* |x| >= 2.0 */
+ {
+ __sincos (y, &s, &c);
+ ss = -s - c;
+ cc = s - c;
+ if (ix < 0x7fe00000) /* make sure y+y not overflow */
+ {
+ z = __cos (y + y);
+ if ((s * c) > zero)
+ cc = z / ss;
+ else
+ ss = z / cc;
}
- if(__builtin_expect(ix<0x3e400000, 0)) { /* |x|<2**-27 */
- if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
+ /*
+ * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
+ * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
+ */
+ if (ix > 0x48000000)
+ z = (invsqrtpi * cc) / __ieee754_sqrt (y);
+ else
+ {
+ u = pone (y); v = qone (y);
+ z = invsqrtpi * (u * cc - v * ss) / __ieee754_sqrt (y);
}
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- r = z*(r00+z*(r01+z*(r02+z*r03)));
- s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
- r *= x;
-#else
- r1 = z*R[0]; z2=z*z;
- r2 = R[1]+z*R[2]; z4=z2*z2;
- r = r1 + z2*r2 + z4*R[3];
- r *= x;
- s1 = one+z*S[1];
- s2 = S[2]+z*S[3];
- s3 = S[4]+z*S[5];
- s = s1 + z2*s2 + z4*s3;
-#endif
- return(x*0.5+r/s);
+ if (hx < 0)
+ return -z;
+ else
+ return z;
+ }
+ if (__builtin_expect (ix < 0x3e400000, 0)) /* |x|<2**-27 */
+ {
+ if (huge + x > one)
+ return 0.5 * x; /* inexact if x!=0 necessary */
+ }
+ z = x * x;
+ r1 = z * R[0]; z2 = z * z;
+ r2 = R[1] + z * R[2]; z4 = z2 * z2;
+ r = r1 + z2 * r2 + z4 * R[3];
+ r *= x;
+ s1 = one + z * S[1];
+ s2 = S[2] + z * S[3];
+ s3 = S[4] + z * S[5];
+ s = s1 + z2 * s2 + z4 * s3;
+ return (x * 0.5 + r / s);
}
strong_alias (__ieee754_j1, __j1_finite)
@@ -150,62 +155,67 @@ static const double V0[5] = {
};
double
-__ieee754_y1(double x)
+__ieee754_y1 (double x)
{
- double z, s,c,ss,cc,u,v,u1,u2,v1,v2,v3,z2,z4;
- int32_t hx,ix,lx;
+ double z, s, c, ss, cc, u, v, u1, u2, v1, v2, v3, z2, z4;
+ int32_t hx, ix, lx;
- EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
- /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if(__builtin_expect(ix>=0x7ff00000, 0)) return one/(x+x*x);
- if(__builtin_expect((ix|lx)==0, 0))
- return -HUGE_VAL+x; /* -inf and overflow exception. */;
- if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- __sincos (x, &s, &c);
- ss = -s-c;
- cc = s-c;
- if(ix<0x7fe00000) { /* make sure x+x not overflow */
- z = __cos(x+x);
- if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
- }
- /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
- * where x0 = x-3pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = -1/sqrt(2) * (cos(x) + sin(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
- else {
- u = pone(x); v = qone(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
- }
- return z;
+ EXTRACT_WORDS (hx, lx, x);
+ ix = 0x7fffffff & hx;
+ /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
+ if (__builtin_expect (ix >= 0x7ff00000, 0))
+ return one / (x + x * x);
+ if (__builtin_expect ((ix | lx) == 0, 0))
+ return -HUGE_VAL + x;
+ /* -inf and overflow exception. */;
+ if (__builtin_expect (hx < 0, 0))
+ return zero / (zero * x);
+ if (ix >= 0x40000000) /* |x| >= 2.0 */
+ {
+ __sincos (x, &s, &c);
+ ss = -s - c;
+ cc = s - c;
+ if (ix < 0x7fe00000) /* make sure x+x not overflow */
+ {
+ z = __cos (x + x);
+ if ((s * c) > zero)
+ cc = z / ss;
+ else
+ ss = z / cc;
}
- if(__builtin_expect(ix<=0x3c900000, 0)) { /* x < 2**-54 */
- return(-tpi/x);
+ /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
+ * where x0 = x-3pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = -1/sqrt(2) * (cos(x) + sin(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
+ if (ix > 0x48000000)
+ z = (invsqrtpi * ss) / __ieee754_sqrt (x);
+ else
+ {
+ u = pone (x); v = qone (x);
+ z = invsqrtpi * (u * ss + v * cc) / __ieee754_sqrt (x);
}
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
- v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
-#else
- u1 = U0[0]+z*U0[1];z2=z*z;
- u2 = U0[2]+z*U0[3];z4=z2*z2;
- u = u1 + z2*u2 + z4*U0[4];
- v1 = one+z*V0[0];
- v2 = V0[1]+z*V0[2];
- v3 = V0[3]+z*V0[4];
- v = v1 + z2*v2 + z4*v3;
-#endif
- return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
+ return z;
+ }
+ if (__builtin_expect (ix <= 0x3c900000, 0)) /* x < 2**-54 */
+ {
+ return (-tpi / x);
+ }
+ z = x * x;
+ u1 = U0[0] + z * U0[1]; z2 = z * z;
+ u2 = U0[2] + z * U0[3]; z4 = z2 * z2;
+ u = u1 + z2 * u2 + z4 * U0[4];
+ v1 = one + z * V0[0];
+ v2 = V0[1] + z * V0[2];
+ v3 = V0[3] + z * V0[4];
+ v = v1 + z2 * v2 + z4 * v3;
+ return (x * (u / v) + tpi * (__ieee754_j1 (x) * __ieee754_log (x) - one / x));
}
strong_alias (__ieee754_y1, __y1_finite)
@@ -267,7 +277,7 @@ static const double ps3[5] = {
1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */
};
-static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
+static const double pr2[6] = { /* for x in [2.8570,2]=1/[0.3499,0.5] */
1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */
1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */
2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */
@@ -284,33 +294,43 @@ static const double ps2[5] = {
};
static double
-pone(double x)
+pone (double x)
{
- const double *p,*q;
- double z,r,s,r1,r2,r3,s1,s2,s3,z2,z4;
- int32_t ix;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- if (ix>=0x41b00000) {return one;}
- else if(ix>=0x40200000){p = pr8; q= ps8;}
- else if(ix>=0x40122E8B){p = pr5; q= ps5;}
- else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
- else if(ix>=0x40000000){p = pr2; q= ps2;}
- z = one/(x*x);
-#ifdef DO_NOT_USE_THIS
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
-#else
- r1 = p[0]+z*p[1]; z2=z*z;
- r2 = p[2]+z*p[3]; z4=z2*z2;
- r3 = p[4]+z*p[5];
- r = r1 + z2*r2 + z4*r3;
- s1 = one+z*q[0];
- s2 = q[1]+z*q[2];
- s3 = q[3]+z*q[4];
- s = s1 + z2*s2 + z4*s3;
-#endif
- return one+ r/s;
+ const double *p, *q;
+ double z, r, s, r1, r2, r3, s1, s2, s3, z2, z4;
+ int32_t ix;
+ GET_HIGH_WORD (ix, x);
+ ix &= 0x7fffffff;
+ if (ix >= 0x41b00000)
+ {
+ return one;
+ }
+ else if (ix >= 0x40200000)
+ {
+ p = pr8; q = ps8;
+ }
+ else if (ix >= 0x40122E8B)
+ {
+ p = pr5; q = ps5;
+ }
+ else if (ix >= 0x4006DB6D)
+ {
+ p = pr3; q = ps3;
+ }
+ else if (ix >= 0x40000000)
+ {
+ p = pr2; q = ps2;
+ }
+ z = one / (x * x);
+ r1 = p[0] + z * p[1]; z2 = z * z;
+ r2 = p[2] + z * p[3]; z4 = z2 * z2;
+ r3 = p[4] + z * p[5];
+ r = r1 + z2 * r2 + z4 * r3;
+ s1 = one + z * q[0];
+ s2 = q[1] + z * q[2];
+ s3 = q[3] + z * q[4];
+ s = s1 + z2 * s2 + z4 * s3;
+ return one + r / s;
}
@@ -375,7 +395,7 @@ static const double qs3[6] = {
-1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */
};
-static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
+static const double qr2[6] = { /* for x in [2.8570,2]=1/[0.3499,0.5] */
-1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */
-1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */
-2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */
@@ -393,31 +413,41 @@ static const double qs2[6] = {
};
static double
-qone(double x)
+qone (double x)
{
- const double *p,*q;
- double s,r,z,r1,r2,r3,s1,s2,s3,z2,z4,z6;
- int32_t ix;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- if (ix>=0x41b00000) {return .375/x;}
- else if(ix>=0x40200000){p = qr8; q= qs8;}
- else if(ix>=0x40122E8B){p = qr5; q= qs5;}
- else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
- else if(ix>=0x40000000){p = qr2; q= qs2;}
- z = one/(x*x);
-#ifdef DO_NOT_USE_THIS
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
-#else
- r1 = p[0]+z*p[1]; z2=z*z;
- r2 = p[2]+z*p[3]; z4=z2*z2;
- r3 = p[4]+z*p[5]; z6=z4*z2;
- r = r1 + z2*r2 + z4*r3;
- s1 = one+z*q[0];
- s2 = q[1]+z*q[2];
- s3 = q[3]+z*q[4];
- s = s1 + z2*s2 + z4*s3 + z6*q[5];
-#endif
- return (.375 + r/s)/x;
+ const double *p, *q;
+ double s, r, z, r1, r2, r3, s1, s2, s3, z2, z4, z6;
+ int32_t ix;
+ GET_HIGH_WORD (ix, x);
+ ix &= 0x7fffffff;
+ if (ix >= 0x41b00000)
+ {
+ return .375 / x;
+ }
+ else if (ix >= 0x40200000)
+ {
+ p = qr8; q = qs8;
+ }
+ else if (ix >= 0x40122E8B)
+ {
+ p = qr5; q = qs5;
+ }
+ else if (ix >= 0x4006DB6D)
+ {
+ p = qr3; q = qs3;
+ }
+ else if (ix >= 0x40000000)
+ {
+ p = qr2; q = qs2;
+ }
+ z = one / (x * x);
+ r1 = p[0] + z * p[1]; z2 = z * z;
+ r2 = p[2] + z * p[3]; z4 = z2 * z2;
+ r3 = p[4] + z * p[5]; z6 = z4 * z2;
+ r = r1 + z2 * r2 + z4 * r3;
+ s1 = one + z * q[0];
+ s2 = q[1] + z * q[2];
+ s3 = q[3] + z * q[4];
+ s = s1 + z2 * s2 + z4 * s3 + z6 * q[5];
+ return (.375 + r / s) / x;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_jn.c b/libc/sysdeps/ieee754/dbl-64/e_jn.c
index 0d2a24c93..f48e43a0d 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_jn.c
@@ -41,246 +41,284 @@
#include <math_private.h>
static const double
-invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
-one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
+ invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
+ two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
+ one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
-static const double zero = 0.00000000000000000000e+00;
+static const double zero = 0.00000000000000000000e+00;
double
-__ieee754_jn(int n, double x)
+__ieee754_jn (int n, double x)
{
- int32_t i,hx,ix,lx, sgn;
- double a, b, temp, di;
- double z, w;
+ int32_t i, hx, ix, lx, sgn;
+ double a, b, temp, di;
+ double z, w;
- /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
- * Thus, J(-n,x) = J(n,-x)
- */
- EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
- /* if J(n,NaN) is NaN */
- if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000, 0))
- return x+x;
- if(n<0){
- n = -n;
- x = -x;
- hx ^= 0x80000000;
+ /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+ * Thus, J(-n,x) = J(n,-x)
+ */
+ EXTRACT_WORDS (hx, lx, x);
+ ix = 0x7fffffff & hx;
+ /* if J(n,NaN) is NaN */
+ if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0))
+ return x + x;
+ if (n < 0)
+ {
+ n = -n;
+ x = -x;
+ hx ^= 0x80000000;
+ }
+ if (n == 0)
+ return (__ieee754_j0 (x));
+ if (n == 1)
+ return (__ieee754_j1 (x));
+ sgn = (n & 1) & (hx >> 31); /* even n -- 0, odd n -- sign(x) */
+ x = fabs (x);
+ if (__builtin_expect ((ix | lx) == 0 || ix >= 0x7ff00000, 0))
+ /* if x is 0 or inf */
+ b = zero;
+ else if ((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 */
+ { /* (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
+ */
+ double s;
+ double c;
+ __sincos (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_sqrt (x);
}
- if(n==0) return(__ieee754_j0(x));
- if(n==1) return(__ieee754_j1(x));
- sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
- x = fabs(x);
- if(__builtin_expect((ix|lx)==0||ix>=0x7ff00000,0))
- /* if x is 0 or inf */
- b = zero;
- else if((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 */
- /* (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
- */
- double s;
- double c;
- __sincos (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_sqrt(x);
- } else {
- a = __ieee754_j0(x);
- b = __ieee754_j1(x);
- for(i=1;i<n;i++){
- temp = b;
- b = b*((double)(i+i)/x) - a; /* avoid underflow */
- a = temp;
- }
+ else
+ {
+ a = __ieee754_j0 (x);
+ b = __ieee754_j1 (x);
+ for (i = 1; i < n; i++)
+ {
+ temp = b;
+ b = b * ((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 */
- b = zero;
- else {
- temp = x*0.5; b = temp;
- for (a=one,i=2;i<=n;i++) {
- a *= (double)i; /* a = n! */
- b *= temp; /* b = (x/2)^n */
- }
- b = b/a;
+ }
+ }
+ 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 */
+ b = zero;
+ else
+ {
+ temp = x * 0.5; b = temp;
+ for (a = one, i = 2; i <= n; i++)
+ {
+ a *= (double) i; /* a = n! */
+ b *= temp; /* b = (x/2)^n */
}
- } 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 */
- double t,v;
- double q0,q1,h,tmp; int32_t k,m;
- w = (n+n)/(double)x; h = 2.0/(double)x;
- q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
- while(q1<1.0e9) {
- k += 1; z += h;
- tmp = z*q1 - q0;
- q0 = q1;
- q1 = tmp;
+ 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 */
+ double t, v;
+ double q0, q1, h, tmp; int32_t k, m;
+ w = (n + n) / (double) x; h = 2.0 / (double) x;
+ q0 = w; z = w + h; q1 = w * z - 1.0; k = 1;
+ while (q1 < 1.0e9)
+ {
+ 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_log (fabs (v * tmp));
+ if (tmp < 7.09782712893383973096e+02)
+ {
+ for (i = n - 1, di = (double) (i + i); i > 0; i--)
+ {
+ temp = b;
+ b *= di;
+ b = b / x - a;
+ a = temp;
+ di -= two;
}
- 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_log(fabs(v*tmp));
- if(tmp<7.09782712893383973096e+02) {
- for(i=n-1,di=(double)(i+i);i>0;i--){
- temp = b;
- b *= di;
- b = b/x - a;
- a = temp;
- di -= two;
- }
- } else {
- for(i=n-1,di=(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>1e100) {
- a /= b;
- t /= b;
- b = one;
- }
+ }
+ else
+ {
+ for (i = n - 1, di = (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 > 1e100)
+ {
+ a /= b;
+ t /= b;
+ b = one;
}
}
- /* j0() and j1() suffer enormous loss of precision at and
- * near zero; however, we know that their zero points never
- * coincide, so just choose the one further away from zero.
- */
- z = __ieee754_j0 (x);
- w = __ieee754_j1 (x);
- if (fabs (z) >= fabs (w))
- b = (t * z / b);
- else
- b = (t * w / a);
}
+ /* j0() and j1() suffer enormous loss of precision at and
+ * near zero; however, we know that their zero points never
+ * coincide, so just choose the one further away from zero.
+ */
+ z = __ieee754_j0 (x);
+ w = __ieee754_j1 (x);
+ if (fabs (z) >= fabs (w))
+ b = (t * z / b);
+ else
+ b = (t * w / a);
}
- if(sgn==1) return -b; else return b;
+ }
+ if (sgn == 1)
+ return -b;
+ else
+ return b;
}
strong_alias (__ieee754_jn, __jn_finite)
double
-__ieee754_yn(int n, double x)
+__ieee754_yn (int n, double x)
{
- int32_t i,hx,ix,lx;
- int32_t sign;
- double a, b, temp;
+ int32_t i, hx, ix, lx;
+ int32_t sign;
+ double a, b, temp;
- EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
- /* if Y(n,NaN) is NaN */
- if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000,0))
- return x+x;
- if(__builtin_expect((ix|lx)==0, 0))
- return -HUGE_VAL+x; /* -inf and overflow exception. */;
- if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
- sign = 1;
- if(n<0){
- n = -n;
- sign = 1 - ((n&1)<<1);
+ EXTRACT_WORDS (hx, lx, x);
+ ix = 0x7fffffff & hx;
+ /* if Y(n,NaN) is NaN */
+ if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0))
+ return x + x;
+ if (__builtin_expect ((ix | lx) == 0, 0))
+ return -HUGE_VAL + x;
+ /* -inf and overflow exception. */;
+ if (__builtin_expect (hx < 0, 0))
+ return zero / (zero * x);
+ sign = 1;
+ if (n < 0)
+ {
+ n = -n;
+ sign = 1 - ((n & 1) << 1);
+ }
+ if (n == 0)
+ return (__ieee754_y0 (x));
+ if (n == 1)
+ return (sign * __ieee754_y1 (x));
+ if (__builtin_expect (ix == 0x7ff00000, 0))
+ return zero;
+ if (ix >= 0x52D00000) /* x > 2**302 */
+ { /* (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
+ */
+ double c;
+ double s;
+ __sincos (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;
}
- if(n==0) return(__ieee754_y0(x));
- if(n==1) return(sign*__ieee754_y1(x));
- if(__builtin_expect(ix==0x7ff00000, 0)) return zero;
- if(ix>=0x52D00000) { /* x > 2**302 */
- /* (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
- */
- double c;
- double s;
- __sincos (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_sqrt(x);
- } else {
- u_int32_t high;
- a = __ieee754_y0(x);
- b = __ieee754_y1(x);
- /* quit if b is -inf */
- GET_HIGH_WORD(high,b);
- for(i=1;i<n&&high!=0xfff00000;i++){
- temp = b;
- b = ((double)(i+i)/x)*b - a;
- GET_HIGH_WORD(high,b);
- a = temp;
- }
- /* If B is +-Inf, set up errno accordingly. */
- if (! __finite (b))
- __set_errno (ERANGE);
+ b = invsqrtpi * temp / __ieee754_sqrt (x);
+ }
+ else
+ {
+ u_int32_t high;
+ a = __ieee754_y0 (x);
+ b = __ieee754_y1 (x);
+ /* quit if b is -inf */
+ GET_HIGH_WORD (high, b);
+ for (i = 1; i < n && high != 0xfff00000; i++)
+ {
+ temp = b;
+ b = ((double) (i + i) / x) * b - a;
+ GET_HIGH_WORD (high, b);
+ a = temp;
}
- if(sign>0) return b; else return -b;
+ /* If B is +-Inf, set up errno accordingly. */
+ if (!__finite (b))
+ __set_errno (ERANGE);
+ }
+ if (sign > 0)
+ return b;
+ else
+ return -b;
}
strong_alias (__ieee754_yn, __yn_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_log.c b/libc/sysdeps/ieee754/dbl-64/e_log.c
index f9300f9ce..a7ab54435 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_log.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_log.c
@@ -39,6 +39,7 @@
#include "mpa.h"
#include "MathLib.h"
#include <math_private.h>
+#include <stap-probe.h>
#ifndef SECTION
# define SECTION
@@ -55,12 +56,12 @@ SECTION
__ieee754_log (double x)
{
#define M 4
- static const int pr[M] = {8, 10, 18, 32};
+ static const int pr[M] = { 8, 10, 18, 32 };
int i, j, n, ux, dx, p;
double dbl_n, u, p0, q, r0, w, nln2a, luai, lubi, lvaj, lvbj,
- sij, ssij, ttij, A, B, B0, y, y1, y2, polI, polII, sa, sb,
- t1, t2, t7, t8, t, ra, rb, ww,
- a0, aa0, s1, s2, ss2, s3, ss3, a1, aa1, a, aa, b, bb, c;
+ sij, ssij, ttij, A, B, B0, y, y1, y2, polI, polII, sa, sb,
+ t1, t2, t7, t8, t, ra, rb, ww,
+ a0, aa0, s1, s2, ss2, s3, ss3, a1, aa1, a, aa, b, bb, c;
#ifndef DLA_FMS
double t3, t4, t5, t6;
#endif
@@ -79,15 +80,15 @@ __ieee754_log (double x)
if (__builtin_expect (ux < 0x00100000, 0))
{
if (__builtin_expect (((ux & 0x7fffffff) | dx) == 0, 0))
- return MHALF / 0.0; /* return -INF */
+ return MHALF / 0.0; /* return -INF */
if (__builtin_expect (ux < 0, 0))
- return (x - x) / 0.0; /* return NaN */
+ return (x - x) / 0.0; /* return NaN */
n -= 54;
- x *= two54.d; /* scale x */
+ x *= two54.d; /* scale x */
num.d = x;
}
if (__builtin_expect (ux >= 0x7ff00000, 0))
- return x + x; /* INF or NaN */
+ return x + x; /* INF or NaN */
/* Regular values of x */
@@ -242,8 +243,12 @@ stage_n:
__mp_dbl (&mpy1, &y1, p);
__mp_dbl (&mpy2, &y2, p);
if (y1 == y2)
- return y1;
+ {
+ LIBC_PROBE (slowlog, 3, &p, &x, &y1);
+ return y1;
+ }
}
+ LIBC_PROBE (slowlog_inexact, 3, &p, &x, &y1);
return y1;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_log10.c b/libc/sysdeps/ieee754/dbl-64/e_log10.c
index ab5069e58..c3d465a4a 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_log10.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_log10.c
@@ -46,10 +46,10 @@
#include <math.h>
#include <math_private.h>
-static const double two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
-static const double ivln10 = 4.34294481903251816668e-01; /* 0x3FDBCB7B, 0x1526E50E */
-static const double log10_2hi = 3.01029995663611771306e-01; /* 0x3FD34413, 0x509F6000 */
-static const double log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
+static const double two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
+static const double ivln10 = 4.34294481903251816668e-01; /* 0x3FDBCB7B, 0x1526E50E */
+static const double log10_2hi = 3.01029995663611771306e-01; /* 0x3FD34413, 0x509F6000 */
+static const double log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
double
__ieee754_log10 (double x)
@@ -62,13 +62,13 @@ __ieee754_log10 (double x)
k = 0;
if (hx < 0x00100000)
- { /* x < 2**-1022 */
+ { /* x < 2**-1022 */
if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
- return -two54 / (x - x); /* log(+-0)=-inf */
+ return -two54 / (x - x); /* log(+-0)=-inf */
if (__builtin_expect (hx < 0, 0))
- return (x - x) / (x - x); /* log(-#) = NaN */
+ return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
- x *= two54; /* subnormal number, scale up x */
+ x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD (hx, x);
}
if (__builtin_expect (hx >= 0x7ff00000, 0))
diff --git a/libc/sysdeps/ieee754/dbl-64/e_log2.c b/libc/sysdeps/ieee754/dbl-64/e_log2.c
index 4d5cab0ed..890a4a2bd 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_log2.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_log2.c
@@ -58,14 +58,14 @@
#include <math_private.h>
static const double ln2 = 0.69314718055994530942;
-static const double two54 = 1.80143985094819840000e+16; /* 43500000 00000000 */
-static const double Lg1 = 6.666666666666735130e-01; /* 3FE55555 55555593 */
-static const double Lg2 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */
-static const double Lg3 = 2.857142874366239149e-01; /* 3FD24924 94229359 */
-static const double Lg4 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */
-static const double Lg5 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
-static const double Lg6 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
-static const double Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
+static const double two54 = 1.80143985094819840000e+16; /* 43500000 00000000 */
+static const double Lg1 = 6.666666666666735130e-01; /* 3FE55555 55555593 */
+static const double Lg2 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */
+static const double Lg3 = 2.857142874366239149e-01; /* 3FD24924 94229359 */
+static const double Lg4 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */
+static const double Lg5 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
+static const double Lg6 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
+static const double Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
static const double zero = 0.0;
@@ -80,13 +80,13 @@ __ieee754_log2 (double x)
k = 0;
if (hx < 0x00100000)
- { /* x < 2**-1022 */
+ { /* x < 2**-1022 */
if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
- return -two54 / (x - x); /* log(+-0)=-inf */
+ return -two54 / (x - x); /* log(+-0)=-inf */
if (__builtin_expect (hx < 0, 0))
- return (x - x) / (x - x); /* log(-#) = NaN */
+ return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
- x *= two54; /* subnormal number, scale up x */
+ x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD (hx, x);
}
if (__builtin_expect (hx >= 0x7ff00000, 0))
@@ -94,12 +94,12 @@ __ieee754_log2 (double x)
k += (hx >> 20) - 1023;
hx &= 0x000fffff;
i = (hx + 0x95f64) & 0x100000;
- SET_HIGH_WORD (x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */
+ SET_HIGH_WORD (x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */
k += (i >> 20);
dk = (double) k;
f = x - 1.0;
if ((0x000fffff & (2 + hx)) < 3)
- { /* |f| < 2**-20 */
+ { /* |f| < 2**-20 */
if (f == zero)
return dk;
R = f * f * (0.5 - 0.33333333333333333 * f);
diff --git a/libc/sysdeps/ieee754/dbl-64/e_pow.c b/libc/sysdeps/ieee754/dbl-64/e_pow.c
index 9a766e722..9cf230917 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_pow.c
@@ -49,354 +49,407 @@
static const double huge = 1.0e300, tiny = 1.0e-300;
-double __exp1(double x, double xx, double error);
-static double log1(double x, double *delta, double *error);
-static double my_log2(double x, double *delta, double *error);
-double __slowpow(double x, double y,double z);
-static double power1(double x, double y);
-static int checkint(double x);
+double __exp1 (double x, double xx, double error);
+static double log1 (double x, double *delta, double *error);
+static double my_log2 (double x, double *delta, double *error);
+double __slowpow (double x, double y, double z);
+static double power1 (double x, double y);
+static int checkint (double x);
-/***************************************************************************/
-/* An ultimate power routine. Given two IEEE double machine numbers y,x */
-/* it computes the correctly rounded (to nearest) value of X^y. */
-/***************************************************************************/
+/* An ultimate power routine. Given two IEEE double machine numbers y, x it
+ computes the correctly rounded (to nearest) value of X^y. */
double
SECTION
-__ieee754_pow(double x, double y) {
- double z,a,aa,error, t,a1,a2,y1,y2;
- mynumber u,v;
+__ieee754_pow (double x, double y)
+{
+ double z, a, aa, error, t, a1, a2, y1, y2;
+ mynumber u, v;
int k;
- int4 qx,qy;
- v.x=y;
- u.x=x;
- if (v.i[LOW_HALF] == 0) { /* of y */
- qx = u.i[HIGH_HALF]&0x7fffffff;
- /* Is x a NaN? */
- if (((qx == 0x7ff00000) && (u.i[LOW_HALF] != 0)) || (qx > 0x7ff00000))
- return x;
- if (y == 1.0) return x;
- if (y == 2.0) return x*x;
- if (y == -1.0) return 1.0/x;
- if (y == 0) return 1.0;
- }
+ int4 qx, qy;
+ v.x = y;
+ u.x = x;
+ if (v.i[LOW_HALF] == 0)
+ { /* of y */
+ qx = u.i[HIGH_HALF] & 0x7fffffff;
+ /* Is x a NaN? */
+ if (((qx == 0x7ff00000) && (u.i[LOW_HALF] != 0)) || (qx > 0x7ff00000))
+ return x;
+ if (y == 1.0)
+ return x;
+ if (y == 2.0)
+ return x * x;
+ if (y == -1.0)
+ return 1.0 / x;
+ if (y == 0)
+ return 1.0;
+ }
/* else */
- if(((u.i[HIGH_HALF]>0 && u.i[HIGH_HALF]<0x7ff00000)|| /* x>0 and not x->0 */
- (u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) &&
- /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */
- (v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */
- double retval;
+ if (((u.i[HIGH_HALF] > 0 && u.i[HIGH_HALF] < 0x7ff00000) || /* x>0 and not x->0 */
+ (u.i[HIGH_HALF] == 0 && u.i[LOW_HALF] != 0)) &&
+ /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */
+ (v.i[HIGH_HALF] & 0x7fffffff) < 0x4ff00000)
+ { /* if y<-1 or y>1 */
+ double retval;
- SET_RESTORE_ROUND (FE_TONEAREST);
+ SET_RESTORE_ROUND (FE_TONEAREST);
- /* Avoid internal underflow for tiny y. The exact value of y does
- not matter if |y| <= 2**-64. */
- if (ABS (y) < 0x1p-64)
- y = y < 0 ? -0x1p-64 : 0x1p-64;
- z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */
- t = y*CN;
- y1 = t - (t-y);
- y2 = y - y1;
- t = z*CN;
- a1 = t - (t-z);
- a2 = (z - a1)+aa;
- a = y1*a1;
- aa = y2*a1 + y*a2;
- a1 = a+aa;
- a2 = (a-a1)+aa;
- error = error*ABS(y);
- t = __exp1(a1,a2,1.9e16*error); /* return -10 or 0 if wasn't computed exactly */
- retval = (t>0)?t:power1(x,y);
+ /* Avoid internal underflow for tiny y. The exact value of y does
+ not matter if |y| <= 2**-64. */
+ if (ABS (y) < 0x1p-64)
+ y = y < 0 ? -0x1p-64 : 0x1p-64;
+ z = log1 (x, &aa, &error); /* x^y =e^(y log (X)) */
+ t = y * CN;
+ y1 = t - (t - y);
+ y2 = y - y1;
+ t = z * CN;
+ a1 = t - (t - z);
+ a2 = (z - a1) + aa;
+ a = y1 * a1;
+ aa = y2 * a1 + y * a2;
+ a1 = a + aa;
+ a2 = (a - a1) + aa;
+ error = error * ABS (y);
+ t = __exp1 (a1, a2, 1.9e16 * error); /* return -10 or 0 if wasn't computed exactly */
+ retval = (t > 0) ? t : power1 (x, y);
- return retval;
- }
+ return retval;
+ }
- if (x == 0) {
- if (((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] != 0)
- || (v.i[HIGH_HALF] & 0x7fffffff) > 0x7ff00000) /* NaN */
- return y;
- if (ABS(y) > 1.0e20) return (y>0)?0:1.0/0.0;
- k = checkint(y);
- if (k == -1)
- return y < 0 ? 1.0/x : x;
- else
- return y < 0 ? 1.0/0.0 : 0.0; /* return 0 */
- }
+ if (x == 0)
+ {
+ if (((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] != 0)
+ || (v.i[HIGH_HALF] & 0x7fffffff) > 0x7ff00000) /* NaN */
+ return y;
+ if (ABS (y) > 1.0e20)
+ return (y > 0) ? 0 : 1.0 / 0.0;
+ k = checkint (y);
+ if (k == -1)
+ return y < 0 ? 1.0 / x : x;
+ else
+ return y < 0 ? 1.0 / 0.0 : 0.0; /* return 0 */
+ }
- qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */
- qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */
+ 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)) /* NaN */
+ if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) /* NaN */
return x;
- if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0)) /* NaN */
+ if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0)) /* NaN */
return x == 1.0 ? 1.0 : y;
/* if x<0 */
- if (u.i[HIGH_HALF] < 0) {
- k = checkint(y);
- if (k==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;
- }
+ if (u.i[HIGH_HALF] < 0)
+ {
+ k = checkint (y);
+ if (k == 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 (qx == 0x7ff00000)
+ return y < 0 ? 0.0 : INF.x;
+ return (x - x) / (x - x); /* y not integer and x<0 */
+ }
else if (qx == 0x7ff00000)
- return y < 0 ? 0.0 : INF.x;
- return (x - x) / (x - x); /* y not integer and x<0 */
+ {
+ if (k < 0)
+ return y < 0 ? nZERO.x : nINF.x;
+ else
+ return y < 0 ? 0.0 : INF.x;
+ }
+ /* if y even or odd */
+ return (k == 1) ? __ieee754_pow (-x, y) : -__ieee754_pow (-x, y);
}
- else if (qx == 0x7ff00000)
- {
- if (k < 0)
- return y < 0 ? nZERO.x : nINF.x;
- else
- return y < 0 ? 0.0 : INF.x;
- }
- return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */
- }
/* x>0 */
- if (qx == 0x7ff00000) /* x= 2^-0x3ff */
+ if (qx == 0x7ff00000) /* x= 2^-0x3ff */
return y > 0 ? x : 0;
- if (qy > 0x45f00000 && qy < 0x7ff00000) {
- if (x == 1.0) return 1.0;
- if (y>0) return (x>1.0)?huge*huge:tiny*tiny;
- if (y<0) return (x<1.0)?huge*huge:tiny*tiny;
- }
+ if (qy > 0x45f00000 && qy < 0x7ff00000)
+ {
+ if (x == 1.0)
+ return 1.0;
+ if (y > 0)
+ return (x > 1.0) ? huge * huge : tiny * tiny;
+ if (y < 0)
+ return (x < 1.0) ? huge * huge : tiny * tiny;
+ }
- if (x == 1.0) return 1.0;
- if (y>0) return (x>1.0)?INF.x:0;
- if (y<0) return (x<1.0)?INF.x:0;
- return 0; /* unreachable, to make the compiler happy */
+ if (x == 1.0)
+ return 1.0;
+ if (y > 0)
+ return (x > 1.0) ? INF.x : 0;
+ if (y < 0)
+ return (x < 1.0) ? INF.x : 0;
+ return 0; /* unreachable, to make the compiler happy */
}
+
#ifndef __ieee754_pow
strong_alias (__ieee754_pow, __pow_finite)
#endif
-/**************************************************************************/
-/* Computing x^y using more accurate but more slow log routine */
-/**************************************************************************/
+/* Compute x^y using more accurate but more slow log routine. */
static double
SECTION
-power1(double x, double y) {
- double z,a,aa,error, t,a1,a2,y1,y2;
- z = my_log2(x,&aa,&error);
- t = y*CN;
- y1 = t - (t-y);
+power1 (double x, double y)
+{
+ double z, a, aa, error, t, a1, a2, y1, y2;
+ z = my_log2 (x, &aa, &error);
+ t = y * CN;
+ y1 = t - (t - y);
y2 = y - y1;
- t = z*CN;
- a1 = t - (t-z);
+ t = z * CN;
+ a1 = t - (t - z);
a2 = z - a1;
- a = y*z;
- aa = ((y1*a1-a)+y1*a2+y2*a1)+y2*a2+aa*y;
- a1 = a+aa;
- a2 = (a-a1)+aa;
- error = error*ABS(y);
- t = __exp1(a1,a2,1.9e16*error);
- return (t >= 0)?t:__slowpow(x,y,z);
+ a = y * z;
+ aa = ((y1 * a1 - a) + y1 * a2 + y2 * a1) + y2 * a2 + aa * y;
+ a1 = a + aa;
+ a2 = (a - a1) + aa;
+ error = error * ABS (y);
+ t = __exp1 (a1, a2, 1.9e16 * error);
+ return (t >= 0) ? t : __slowpow (x, y, z);
}
-/****************************************************************************/
-/* Computing log(x) (x is left argument). The result is the returned double */
-/* + the parameter delta. */
-/* The result is bounded by error (rightmost argument) */
-/****************************************************************************/
+/* Compute log(x) (x is left argument). The result is the returned double + the
+ parameter DELTA. The result is bounded by ERROR. */
static double
SECTION
-log1(double x, double *delta, double *error) {
- int i,j,m;
- double uu,vv,eps,nx,e,e1,e2,t,t1,t2,res,add=0;
- mynumber u,v;
+log1 (double x, double *delta, double *error)
+{
+ int i, j, m;
+ double uu, vv, eps, nx, e, e1, e2, t, t1, t2, res, add = 0;
+ mynumber u, v;
#ifdef BIG_ENDI
- mynumber
-/**/ two52 = {{0x43300000, 0x00000000}}; /* 2**52 */
+ mynumber /**/ two52 = {{0x43300000, 0x00000000}}; /* 2**52 */
#else
-#ifdef LITTLE_ENDI
- mynumber
-/**/ two52 = {{0x00000000, 0x43300000}}; /* 2**52 */
-#endif
+# ifdef LITTLE_ENDI
+ mynumber /**/ two52 = {{0x00000000, 0x43300000}}; /* 2**52 */
+# endif
#endif
u.x = x;
m = u.i[HIGH_HALF];
*error = 0;
*delta = 0;
- if (m < 0x00100000) /* 1<x<2^-1007 */
- { x = x*t52.x; add = -52.0; u.x = x; m = u.i[HIGH_HALF];}
+ if (m < 0x00100000) /* 1<x<2^-1007 */
+ {
+ x = x * t52.x;
+ add = -52.0;
+ u.x = x;
+ m = u.i[HIGH_HALF];
+ }
- if ((m&0x000fffff) < 0x0006a09e)
- {u.i[HIGH_HALF] = (m&0x000fffff)|0x3ff00000; two52.i[LOW_HALF]=(m>>20); }
+ if ((m & 0x000fffff) < 0x0006a09e)
+ {
+ u.i[HIGH_HALF] = (m & 0x000fffff) | 0x3ff00000;
+ two52.i[LOW_HALF] = (m >> 20);
+ }
else
- {u.i[HIGH_HALF] = (m&0x000fffff)|0x3fe00000; two52.i[LOW_HALF]=(m>>20)+1; }
+ {
+ u.i[HIGH_HALF] = (m & 0x000fffff) | 0x3fe00000;
+ two52.i[LOW_HALF] = (m >> 20) + 1;
+ }
v.x = u.x + bigu.x;
uu = v.x - bigu.x;
- i = (v.i[LOW_HALF]&0x000003ff)<<2;
- if (two52.i[LOW_HALF] == 1023) /* nx = 0 */
- {
- if (i > 1192 && i < 1208) /* |x-1| < 1.5*2**-10 */
- {
+ i = (v.i[LOW_HALF] & 0x000003ff) << 2;
+ if (two52.i[LOW_HALF] == 1023) /* nx = 0 */
+ {
+ if (i > 1192 && i < 1208) /* |x-1| < 1.5*2**-10 */
+ {
t = x - 1.0;
- t1 = (t+5.0e6)-5.0e6;
- t2 = t-t1;
- e1 = t - 0.5*t1*t1;
- e2 = t*t*t*(r3+t*(r4+t*(r5+t*(r6+t*(r7+t*r8)))))-0.5*t2*(t+t1);
- res = e1+e2;
- *error = 1.0e-21*ABS(t);
- *delta = (e1-res)+e2;
+ t1 = (t + 5.0e6) - 5.0e6;
+ t2 = t - t1;
+ e1 = t - 0.5 * t1 * t1;
+ e2 = (t * t * t * (r3 + t * (r4 + t * (r5 + t * (r6 + t
+ * (r7 + t * r8)))))
+ - 0.5 * t2 * (t + t1));
+ res = e1 + e2;
+ *error = 1.0e-21 * ABS (t);
+ *delta = (e1 - res) + e2;
return res;
- } /* |x-1| < 1.5*2**-10 */
+ } /* |x-1| < 1.5*2**-10 */
else
- {
- v.x = u.x*(ui.x[i]+ui.x[i+1])+bigv.x;
- vv = v.x-bigv.x;
- j = v.i[LOW_HALF]&0x0007ffff;
- j = j+j+j;
- eps = u.x - uu*vv;
- e1 = eps*ui.x[i];
- e2 = eps*(ui.x[i+1]+vj.x[j]*(ui.x[i]+ui.x[i+1]));
- e = e1+e2;
- e2 = ((e1-e)+e2);
- t=ui.x[i+2]+vj.x[j+1];
- t1 = t+e;
- t2 = (((t-t1)+e)+(ui.x[i+3]+vj.x[j+2]))+e2+e*e*(p2+e*(p3+e*p4));
- res=t1+t2;
+ {
+ v.x = u.x * (ui.x[i] + ui.x[i + 1]) + bigv.x;
+ vv = v.x - bigv.x;
+ j = v.i[LOW_HALF] & 0x0007ffff;
+ j = j + j + j;
+ eps = u.x - uu * vv;
+ e1 = eps * ui.x[i];
+ e2 = eps * (ui.x[i + 1] + vj.x[j] * (ui.x[i] + ui.x[i + 1]));
+ e = e1 + e2;
+ e2 = ((e1 - e) + e2);
+ t = ui.x[i + 2] + vj.x[j + 1];
+ t1 = t + e;
+ t2 = ((((t - t1) + e) + (ui.x[i + 3] + vj.x[j + 2])) + e2 + e * e
+ * (p2 + e * (p3 + e * p4)));
+ res = t1 + t2;
*error = 1.0e-24;
- *delta = (t1-res)+t2;
+ *delta = (t1 - res) + t2;
return res;
- }
- } /* nx = 0 */
- else /* nx != 0 */
- {
+ }
+ } /* nx = 0 */
+ else /* nx != 0 */
+ {
eps = u.x - uu;
- nx = (two52.x - two52e.x)+add;
- e1 = eps*ui.x[i];
- e2 = eps*ui.x[i+1];
- e=e1+e2;
- e2 = (e1-e)+e2;
- t=nx*ln2a.x+ui.x[i+2];
- t1=t+e;
- t2=(((t-t1)+e)+nx*ln2b.x+ui.x[i+3]+e2)+e*e*(q2+e*(q3+e*(q4+e*(q5+e*q6))));
- res = t1+t2;
+ nx = (two52.x - two52e.x) + add;
+ e1 = eps * ui.x[i];
+ e2 = eps * ui.x[i + 1];
+ e = e1 + e2;
+ e2 = (e1 - e) + e2;
+ t = nx * ln2a.x + ui.x[i + 2];
+ t1 = t + e;
+ t2 = ((((t - t1) + e) + nx * ln2b.x + ui.x[i + 3] + e2) + e * e
+ * (q2 + e * (q3 + e * (q4 + e * (q5 + e * q6)))));
+ res = t1 + t2;
*error = 1.0e-21;
- *delta = (t1-res)+t2;
+ *delta = (t1 - res) + t2;
return res;
- } /* nx != 0 */
+ } /* nx != 0 */
}
-/****************************************************************************/
-/* More slow but more accurate routine of log */
-/* Computing log(x)(x is left argument).The result is return double + delta.*/
-/* The result is bounded by error (right argument) */
-/****************************************************************************/
+/* Slower but more accurate routine of log. The returned result is double +
+ DELTA. The result is bounded by ERROR. */
static double
SECTION
-my_log2(double x, double *delta, double *error) {
- int i,j,m;
- double uu,vv,eps,nx,e,e1,e2,t,t1,t2,res,add=0;
- double ou1,ou2,lu1,lu2,ov,lv1,lv2,a,a1,a2;
- double y,yy,z,zz,j1,j2,j7,j8;
+my_log2 (double x, double *delta, double *error)
+{
+ int i, j, m;
+ double uu, vv, eps, nx, e, e1, e2, t, t1, t2, res, add = 0;
+ double ou1, ou2, lu1, lu2, ov, lv1, lv2, a, a1, a2;
+ double y, yy, z, zz, j1, j2, j7, j8;
#ifndef DLA_FMS
- double j3,j4,j5,j6;
+ double j3, j4, j5, j6;
#endif
- mynumber u,v;
+ mynumber u, v;
#ifdef BIG_ENDI
- mynumber
-/**/ two52 = {{0x43300000, 0x00000000}}; /* 2**52 */
+ mynumber /**/ two52 = {{0x43300000, 0x00000000}}; /* 2**52 */
#else
-#ifdef LITTLE_ENDI
- mynumber
-/**/ two52 = {{0x00000000, 0x43300000}}; /* 2**52 */
-#endif
+# ifdef LITTLE_ENDI
+ mynumber /**/ two52 = {{0x00000000, 0x43300000}}; /* 2**52 */
+# endif
#endif
u.x = x;
m = u.i[HIGH_HALF];
*error = 0;
*delta = 0;
- add=0;
- if (m<0x00100000) { /* x < 2^-1022 */
- x = x*t52.x; add = -52.0; u.x = x; m = u.i[HIGH_HALF]; }
+ add = 0;
+ if (m < 0x00100000)
+ { /* x < 2^-1022 */
+ x = x * t52.x;
+ add = -52.0;
+ u.x = x;
+ m = u.i[HIGH_HALF];
+ }
- if ((m&0x000fffff) < 0x0006a09e)
- {u.i[HIGH_HALF] = (m&0x000fffff)|0x3ff00000; two52.i[LOW_HALF]=(m>>20); }
+ if ((m & 0x000fffff) < 0x0006a09e)
+ {
+ u.i[HIGH_HALF] = (m & 0x000fffff) | 0x3ff00000;
+ two52.i[LOW_HALF] = (m >> 20);
+ }
else
- {u.i[HIGH_HALF] = (m&0x000fffff)|0x3fe00000; two52.i[LOW_HALF]=(m>>20)+1; }
+ {
+ u.i[HIGH_HALF] = (m & 0x000fffff) | 0x3fe00000;
+ two52.i[LOW_HALF] = (m >> 20) + 1;
+ }
v.x = u.x + bigu.x;
uu = v.x - bigu.x;
- i = (v.i[LOW_HALF]&0x000003ff)<<2;
+ i = (v.i[LOW_HALF] & 0x000003ff) << 2;
/*------------------------------------- |x-1| < 2**-11------------------------------- */
- if ((two52.i[LOW_HALF] == 1023) && (i == 1200))
- {
+ if ((two52.i[LOW_HALF] == 1023) && (i == 1200))
+ {
t = x - 1.0;
- EMULV(t,s3,y,yy,j1,j2,j3,j4,j5);
- ADD2(-0.5,0,y,yy,z,zz,j1,j2);
- MUL2(t,0,z,zz,y,yy,j1,j2,j3,j4,j5,j6,j7,j8);
- MUL2(t,0,y,yy,z,zz,j1,j2,j3,j4,j5,j6,j7,j8);
+ EMULV (t, s3, y, yy, j1, j2, j3, j4, j5);
+ ADD2 (-0.5, 0, y, yy, z, zz, j1, j2);
+ MUL2 (t, 0, z, zz, y, yy, j1, j2, j3, j4, j5, j6, j7, j8);
+ MUL2 (t, 0, y, yy, z, zz, j1, j2, j3, j4, j5, j6, j7, j8);
- e1 = t+z;
- e2 = (((t-e1)+z)+zz)+t*t*t*(ss3+t*(s4+t*(s5+t*(s6+t*(s7+t*s8)))));
- res = e1+e2;
- *error = 1.0e-25*ABS(t);
- *delta = (e1-res)+e2;
+ e1 = t + z;
+ e2 = ((((t - e1) + z) + zz) + t * t * t
+ * (ss3 + t * (s4 + t * (s5 + t * (s6 + t * (s7 + t * s8))))));
+ res = e1 + e2;
+ *error = 1.0e-25 * ABS (t);
+ *delta = (e1 - res) + e2;
return res;
- }
+ }
/*----------------------------- |x-1| > 2**-11 -------------------------- */
else
- { /*Computing log(x) according to log table */
- nx = (two52.x - two52e.x)+add;
+ { /*Computing log(x) according to log table */
+ nx = (two52.x - two52e.x) + add;
ou1 = ui.x[i];
- ou2 = ui.x[i+1];
- lu1 = ui.x[i+2];
- lu2 = ui.x[i+3];
- v.x = u.x*(ou1+ou2)+bigv.x;
- vv = v.x-bigv.x;
- j = v.i[LOW_HALF]&0x0007ffff;
- j = j+j+j;
- eps = u.x - uu*vv;
- ov = vj.x[j];
- lv1 = vj.x[j+1];
- lv2 = vj.x[j+2];
- a = (ou1+ou2)*(1.0+ov);
- a1 = (a+1.0e10)-1.0e10;
- a2 = a*(1.0-a1*uu*vv);
- e1 = eps*a1;
- e2 = eps*a2;
- e = e1+e2;
- e2 = (e1-e)+e2;
- t=nx*ln2a.x+lu1+lv1;
- t1 = t+e;
- t2 = (((t-t1)+e)+(lu2+lv2+nx*ln2b.x+e2))+e*e*(p2+e*(p3+e*p4));
- res=t1+t2;
+ ou2 = ui.x[i + 1];
+ lu1 = ui.x[i + 2];
+ lu2 = ui.x[i + 3];
+ v.x = u.x * (ou1 + ou2) + bigv.x;
+ vv = v.x - bigv.x;
+ j = v.i[LOW_HALF] & 0x0007ffff;
+ j = j + j + j;
+ eps = u.x - uu * vv;
+ ov = vj.x[j];
+ lv1 = vj.x[j + 1];
+ lv2 = vj.x[j + 2];
+ a = (ou1 + ou2) * (1.0 + ov);
+ a1 = (a + 1.0e10) - 1.0e10;
+ a2 = a * (1.0 - a1 * uu * vv);
+ e1 = eps * a1;
+ e2 = eps * a2;
+ e = e1 + e2;
+ e2 = (e1 - e) + e2;
+ t = nx * ln2a.x + lu1 + lv1;
+ t1 = t + e;
+ t2 = ((((t - t1) + e) + (lu2 + lv2 + nx * ln2b.x + e2)) + e * e
+ * (p2 + e * (p3 + e * p4)));
+ res = t1 + t2;
*error = 1.0e-27;
- *delta = (t1-res)+t2;
+ *delta = (t1 - res) + t2;
return res;
- }
+ }
}
-/**********************************************************************/
-/* Routine receives a double x and checks if it is an integer. If not */
-/* it returns 0, else it returns 1 if even or -1 if odd. */
-/**********************************************************************/
+/* This function receives a double x and checks if it is an integer. If not,
+ it returns 0, else it returns 1 if even or -1 if odd. */
static int
SECTION
-checkint(double x) {
- union {int4 i[2]; double x;} u;
- int k,m,n;
+checkint (double x)
+{
+ union
+ {
+ int4 i[2];
+ double x;
+ } u;
+ int k, m, n;
u.x = x;
- m = u.i[HIGH_HALF]&0x7fffffff; /* no sign */
- if (m >= 0x7ff00000) return 0; /* x is +/-inf or NaN */
- if (m >= 0x43400000) return 1; /* |x| >= 2**53 */
- if (m < 0x40000000) return 0; /* |x| < 2, can not be 0 or 1 */
+ m = u.i[HIGH_HALF] & 0x7fffffff; /* no sign */
+ if (m >= 0x7ff00000)
+ return 0; /* x is +/-inf or NaN */
+ if (m >= 0x43400000)
+ return 1; /* |x| >= 2**53 */
+ if (m < 0x40000000)
+ return 0; /* |x| < 2, can not be 0 or 1 */
n = u.i[LOW_HALF];
- k = (m>>20)-1023; /* 1 <= k <= 52 */
- if (k == 52) return (n&1)? -1:1; /* odd or even*/
- if (k>20) {
- if (n<<(k-20)) return 0; /* if not integer */
- return (n<<(k-21))?-1:1;
- }
- if (n) return 0; /*if not integer*/
- if (k == 20) return (m&1)? -1:1;
- if (m<<(k+12)) return 0;
- return (m<<(k+11))?-1:1;
+ k = (m >> 20) - 1023; /* 1 <= k <= 52 */
+ if (k == 52)
+ return (n & 1) ? -1 : 1; /* odd or even */
+ if (k > 20)
+ {
+ if (n << (k - 20))
+ return 0; /* if not integer */
+ return (n << (k - 21)) ? -1 : 1;
+ }
+ if (n)
+ return 0; /*if not integer */
+ if (k == 20)
+ return (m & 1) ? -1 : 1;
+ if (m << (k + 12))
+ return 0;
+ return (m << (k + 11)) ? -1 : 1;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/e_rem_pio2.c b/libc/sysdeps/ieee754/dbl-64/e_rem_pio2.c
index 4478be0b0..2f55ca294 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_rem_pio2.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_rem_pio2.c
@@ -57,110 +57,137 @@ static const int32_t npio2_hw[] = {
*/
static const double
-zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
-half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
-two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
-invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
-pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
-pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
-pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
-pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
-pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
-pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
+ zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
+ half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
+ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
+ invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+ pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
+ pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
+ pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
+ pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
+ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
+ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
int32_t
-__ieee754_rem_pio2(double x, double *y)
+__ieee754_rem_pio2 (double x, double *y)
{
- double z,w,t,r,fn;
- double tx[3];
- int32_t e0,i,j,nx,n,ix,hx;
- u_int32_t low;
+ double z, w, t, r, fn;
+ double tx[3];
+ int32_t e0, i, j, nx, n, ix, hx;
+ u_int32_t low;
- GET_HIGH_WORD(hx,x); /* high word of x */
- ix = hx&0x7fffffff;
- if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
- {y[0] = x; y[1] = 0; return 0;}
- if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */
- if(hx>0) {
- z = x - pio2_1;
- if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
- y[0] = z - pio2_1t;
- y[1] = (z-y[0])-pio2_1t;
- } else { /* near pi/2, use 33+33+53 bit pi */
- z -= pio2_2;
- y[0] = z - pio2_2t;
- y[1] = (z-y[0])-pio2_2t;
- }
- return 1;
- } else { /* negative x */
- z = x + pio2_1;
- if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
- y[0] = z + pio2_1t;
- y[1] = (z-y[0])+pio2_1t;
- } else { /* near pi/2, use 33+33+53 bit pi */
- z += pio2_2;
- y[0] = z + pio2_2t;
- y[1] = (z-y[0])+pio2_2t;
- }
- return -1;
+ GET_HIGH_WORD (hx, x); /* high word of x */
+ ix = hx & 0x7fffffff;
+ if (ix <= 0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
+ {
+ y[0] = x; y[1] = 0; return 0;
+ }
+ if (ix < 0x4002d97c) /* |x| < 3pi/4, special case with n=+-1 */
+ {
+ if (hx > 0)
+ {
+ z = x - pio2_1;
+ if (ix != 0x3ff921fb) /* 33+53 bit pi is good enough */
+ {
+ y[0] = z - pio2_1t;
+ y[1] = (z - y[0]) - pio2_1t;
+ }
+ else /* near pi/2, use 33+33+53 bit pi */
+ {
+ z -= pio2_2;
+ y[0] = z - pio2_2t;
+ y[1] = (z - y[0]) - pio2_2t;
}
+ return 1;
}
- if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
- t = fabs(x);
- n = (int32_t) (t*invpio2+half);
- fn = (double)n;
- r = t-fn*pio2_1;
- w = fn*pio2_1t; /* 1st round good to 85 bit */
- if(n<32&&ix!=npio2_hw[n-1]) {
- y[0] = r-w; /* quick check no cancellation */
- } else {
- u_int32_t high;
- j = ix>>20;
- y[0] = r-w;
- GET_HIGH_WORD(high,y[0]);
- i = j-((high>>20)&0x7ff);
- if(i>16) { /* 2nd iteration needed, good to 118 */
- t = r;
- w = fn*pio2_2;
- r = t-w;
- w = fn*pio2_2t-((t-r)-w);
- y[0] = r-w;
- GET_HIGH_WORD(high,y[0]);
- i = j-((high>>20)&0x7ff);
- if(i>49) { /* 3rd iteration need, 151 bits acc */
- t = r; /* will cover all possible cases */
- w = fn*pio2_3;
- r = t-w;
- w = fn*pio2_3t-((t-r)-w);
- y[0] = r-w;
- }
- }
+ else /* negative x */
+ {
+ z = x + pio2_1;
+ if (ix != 0x3ff921fb) /* 33+53 bit pi is good enough */
+ {
+ y[0] = z + pio2_1t;
+ y[1] = (z - y[0]) + pio2_1t;
+ }
+ else /* near pi/2, use 33+33+53 bit pi */
+ {
+ z += pio2_2;
+ y[0] = z + pio2_2t;
+ y[1] = (z - y[0]) + pio2_2t;
}
- y[1] = (r-y[0])-w;
- if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
- else return n;
+ return -1;
}
- /*
- * all other (large) arguments
- */
- if(ix>=0x7ff00000) { /* x is inf or NaN */
- y[0]=y[1]=x-x; return 0;
+ }
+ if (ix <= 0x413921fb) /* |x| ~<= 2^19*(pi/2), medium size */
+ {
+ t = fabs (x);
+ n = (int32_t) (t * invpio2 + half);
+ fn = (double) n;
+ r = t - fn * pio2_1;
+ w = fn * pio2_1t; /* 1st round good to 85 bit */
+ if (n < 32 && ix != npio2_hw[n - 1])
+ {
+ y[0] = r - w; /* quick check no cancellation */
}
- /* set z = scalbn(|x|,ilogb(x)-23) */
- GET_LOW_WORD(low,x);
- SET_LOW_WORD(z,low);
- e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */
- SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20)));
- for(i=0;i<2;i++) {
- tx[i] = (double)((int32_t)(z));
- z = (z-tx[i])*two24;
+ else
+ {
+ u_int32_t high;
+ j = ix >> 20;
+ y[0] = r - w;
+ GET_HIGH_WORD (high, y[0]);
+ i = j - ((high >> 20) & 0x7ff);
+ if (i > 16) /* 2nd iteration needed, good to 118 */
+ {
+ t = r;
+ w = fn * pio2_2;
+ r = t - w;
+ w = fn * pio2_2t - ((t - r) - w);
+ y[0] = r - w;
+ GET_HIGH_WORD (high, y[0]);
+ i = j - ((high >> 20) & 0x7ff);
+ if (i > 49) /* 3rd iteration need, 151 bits acc */
+ {
+ t = r; /* will cover all possible cases */
+ w = fn * pio2_3;
+ r = t - w;
+ w = fn * pio2_3t - ((t - r) - w);
+ y[0] = r - w;
+ }
+ }
}
- tx[2] = z;
- nx = 3;
- while(tx[nx-1]==zero) nx--; /* skip zero term */
- n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi);
- if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
+ y[1] = (r - y[0]) - w;
+ if (hx < 0)
+ {
+ y[0] = -y[0]; y[1] = -y[1]; return -n;
+ }
+ else
return n;
+ }
+ /*
+ * all other (large) arguments
+ */
+ if (ix >= 0x7ff00000) /* x is inf or NaN */
+ {
+ y[0] = y[1] = x - x; return 0;
+ }
+ /* set z = scalbn(|x|,ilogb(x)-23) */
+ GET_LOW_WORD (low, x);
+ SET_LOW_WORD (z, low);
+ e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */
+ SET_HIGH_WORD (z, ix - ((int32_t) (e0 << 20)));
+ for (i = 0; i < 2; i++)
+ {
+ tx[i] = (double) ((int32_t) (z));
+ z = (z - tx[i]) * two24;
+ }
+ tx[2] = z;
+ nx = 3;
+ while (tx[nx - 1] == zero)
+ nx--; /* skip zero term */
+ n = __kernel_rem_pio2 (tx, y, e0, nx, 2, two_over_pi);
+ if (hx < 0)
+ {
+ y[0] = -y[0]; y[1] = -y[1]; return -n;
+ }
+ return n;
}
-
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/e_remainder.c b/libc/sysdeps/ieee754/dbl-64/e_remainder.c
index 2d20bb1df..c6a1901b1 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -39,89 +39,111 @@
/* An ultimate remainder routine. Given two IEEE double machine numbers x */
/* ,y it computes the correctly rounded (to nearest) value of remainder */
/**************************************************************************/
-double __ieee754_remainder(double x, double y)
+double
+__ieee754_remainder (double x, double y)
{
- double z,d,xx;
- int4 kx,ky,n,nn,n1,m1,l;
- mynumber u,t,w={{0,0}},v={{0,0}},ww={{0,0}},r;
- u.x=x;
- t.x=y;
- kx=u.i[HIGH_HALF]&0x7fffffff; /* no sign for x*/
- t.i[HIGH_HALF]&=0x7fffffff; /*no sign for y */
- ky=t.i[HIGH_HALF];
+ double z, d, xx;
+ int4 kx, ky, n, nn, n1, m1, l;
+ mynumber u, t, w = { { 0, 0 } }, v = { { 0, 0 } }, ww = { { 0, 0 } }, r;
+ u.x = x;
+ t.x = y;
+ kx = u.i[HIGH_HALF] & 0x7fffffff; /* no sign for x*/
+ t.i[HIGH_HALF] &= 0x7fffffff; /*no sign for y */
+ ky = t.i[HIGH_HALF];
/*------ |x| < 2^1023 and 2^-970 < |y| < 2^1024 ------------------*/
- if (kx<0x7fe00000 && ky<0x7ff00000 && ky>=0x03500000) {
- SET_RESTORE_ROUND_NOEX (FE_TONEAREST);
- if (kx+0x00100000<ky) return x;
- if ((kx-0x01500000)<ky) {
- z=x/t.x;
- v.i[HIGH_HALF]=t.i[HIGH_HALF];
- d=(z+big.x)-big.x;
- xx=(x-d*v.x)-d*(t.x-v.x);
- if (d-z!=0.5&&d-z!=-0.5) return (xx!=0)?xx:((x>0)?ZERO.x:nZERO.x);
- else {
- if (ABS(xx)>0.5*t.x) return (z>d)?xx-t.x:xx+t.x;
- else return xx;
- }
- } /* (kx<(ky+0x01500000)) */
- else {
- r.x=1.0/t.x;
- n=t.i[HIGH_HALF];
- nn=(n&0x7ff00000)+0x01400000;
- w.i[HIGH_HALF]=n;
- ww.x=t.x-w.x;
- l=(kx-nn)&0xfff00000;
- n1=ww.i[HIGH_HALF];
- m1=r.i[HIGH_HALF];
- while (l>0) {
- r.i[HIGH_HALF]=m1-l;
- z=u.x*r.x;
- w.i[HIGH_HALF]=n+l;
- ww.i[HIGH_HALF]=(n1)?n1+l:n1;
- d=(z+big.x)-big.x;
- u.x=(u.x-d*w.x)-d*ww.x;
- l=(u.i[HIGH_HALF]&0x7ff00000)-nn;
- }
- r.i[HIGH_HALF]=m1;
- w.i[HIGH_HALF]=n;
- ww.i[HIGH_HALF]=n1;
- z=u.x*r.x;
- d=(z+big.x)-big.x;
- u.x=(u.x-d*w.x)-d*ww.x;
- if (ABS(u.x)<0.5*t.x) return (u.x!=0)?u.x:((x>0)?ZERO.x:nZERO.x);
+ if (kx < 0x7fe00000 && ky < 0x7ff00000 && ky >= 0x03500000)
+ {
+ SET_RESTORE_ROUND_NOEX (FE_TONEAREST);
+ if (kx + 0x00100000 < ky)
+ return x;
+ if ((kx - 0x01500000) < ky)
+ {
+ z = x / t.x;
+ v.i[HIGH_HALF] = t.i[HIGH_HALF];
+ d = (z + big.x) - big.x;
+ xx = (x - d * v.x) - d * (t.x - v.x);
+ if (d - z != 0.5 && d - z != -0.5)
+ return (xx != 0) ? xx : ((x > 0) ? ZERO.x : nZERO.x);
+ else
+ {
+ if (ABS (xx) > 0.5 * t.x)
+ return (z > d) ? xx - t.x : xx + t.x;
+ else
+ return xx;
+ }
+ } /* (kx<(ky+0x01500000)) */
else
- if (ABS(u.x)>0.5*t.x) return (d>z)?u.x+t.x:u.x-t.x;
- else
- {z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);}
- }
-
- } /* (kx<0x7fe00000&&ky<0x7ff00000&&ky>=0x03500000) */
- else {
- if (kx<0x7fe00000&&ky<0x7ff00000&&(ky>0||t.i[LOW_HALF]!=0)) {
- y=ABS(y)*t128.x;
- z=__ieee754_remainder(x,y)*t128.x;
- z=__ieee754_remainder(z,y)*tm128.x;
- return z;
- }
- else {
- if ((kx&0x7ff00000)==0x7fe00000&&ky<0x7ff00000&&(ky>0||t.i[LOW_HALF]!=0)) {
- y=ABS(y);
- z=2.0*__ieee754_remainder(0.5*x,y);
- d = ABS(z);
- if (d <= ABS(d-y)) return z;
- else return (z>0)?z-y:z+y;
- }
- else { /* if x is too big */
- if (ky==0 && t.i[LOW_HALF] == 0) /* y = 0 */
- return (x * y) / (x * y);
- else if (kx >= 0x7ff00000 /* x not finite */
- || (ky>0x7ff00000 /* y is NaN */
- || (ky == 0x7ff00000 && t.i[LOW_HALF] != 0)))
- return (x * y) / (x * y);
+ {
+ r.x = 1.0 / t.x;
+ n = t.i[HIGH_HALF];
+ nn = (n & 0x7ff00000) + 0x01400000;
+ w.i[HIGH_HALF] = n;
+ ww.x = t.x - w.x;
+ l = (kx - nn) & 0xfff00000;
+ n1 = ww.i[HIGH_HALF];
+ m1 = r.i[HIGH_HALF];
+ while (l > 0)
+ {
+ r.i[HIGH_HALF] = m1 - l;
+ z = u.x * r.x;
+ w.i[HIGH_HALF] = n + l;
+ ww.i[HIGH_HALF] = (n1) ? n1 + l : n1;
+ d = (z + big.x) - big.x;
+ u.x = (u.x - d * w.x) - d * ww.x;
+ l = (u.i[HIGH_HALF] & 0x7ff00000) - nn;
+ }
+ r.i[HIGH_HALF] = m1;
+ w.i[HIGH_HALF] = n;
+ ww.i[HIGH_HALF] = n1;
+ z = u.x * r.x;
+ d = (z + big.x) - big.x;
+ u.x = (u.x - d * w.x) - d * ww.x;
+ if (ABS (u.x) < 0.5 * t.x)
+ return (u.x != 0) ? u.x : ((x > 0) ? ZERO.x : nZERO.x);
+ else
+ if (ABS (u.x) > 0.5 * t.x)
+ return (d > z) ? u.x + t.x : u.x - t.x;
+ else
+ {
+ z = u.x / t.x; d = (z + big.x) - big.x;
+ return ((u.x - d * w.x) - d * ww.x);
+ }
+ }
+ } /* (kx<0x7fe00000&&ky<0x7ff00000&&ky>=0x03500000) */
+ else
+ {
+ if (kx < 0x7fe00000 && ky < 0x7ff00000 && (ky > 0 || t.i[LOW_HALF] != 0))
+ {
+ y = ABS (y) * t128.x;
+ z = __ieee754_remainder (x, y) * t128.x;
+ z = __ieee754_remainder (z, y) * tm128.x;
+ return z;
+ }
else
- return x;
+ {
+ if ((kx & 0x7ff00000) == 0x7fe00000 && ky < 0x7ff00000 &&
+ (ky > 0 || t.i[LOW_HALF] != 0))
+ {
+ y = ABS (y);
+ z = 2.0 * __ieee754_remainder (0.5 * x, y);
+ d = ABS (z);
+ if (d <= ABS (d - y))
+ return z;
+ else
+ return (z > 0) ? z - y : z + y;
+ }
+ else /* if x is too big */
+ {
+ if (ky == 0 && t.i[LOW_HALF] == 0) /* y = 0 */
+ return (x * y) / (x * y);
+ else if (kx >= 0x7ff00000 /* x not finite */
+ || (ky > 0x7ff00000 /* y is NaN */
+ || (ky == 0x7ff00000 && t.i[LOW_HALF] != 0)))
+ return (x * y) / (x * y);
+ else
+ return x;
+ }
+ }
}
- }
- }
}
strong_alias (__ieee754_remainder, __remainder_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_sinh.c b/libc/sysdeps/ieee754/dbl-64/e_sinh.c
index b954100ba..851b510aa 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_sinh.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_sinh.c
@@ -38,43 +38,50 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
static const double one = 1.0, shuge = 1.0e307;
double
-__ieee754_sinh(double x)
+__ieee754_sinh (double x)
{
- double t,w,h;
- int32_t ix,jx;
- u_int32_t lx;
+ double t, w, h;
+ int32_t ix, jx;
+ u_int32_t lx;
- /* High word of |x|. */
- GET_HIGH_WORD(jx,x);
- ix = jx&0x7fffffff;
+ /* High word of |x|. */
+ GET_HIGH_WORD (jx, x);
+ ix = jx & 0x7fffffff;
- /* x is INF or NaN */
- if(__builtin_expect(ix>=0x7ff00000, 0)) return x+x;
+ /* x is INF or NaN */
+ if (__builtin_expect (ix >= 0x7ff00000, 0))
+ 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 < 0x40360000) { /* |x|<22 */
- if (__builtin_expect(ix<0x3e300000, 0)) /* |x|<2**-28 */
- if(shuge+x>one)
- return x;/* sinh(tiny) = tiny with inexact */
- t = __expm1(fabs(x));
- if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
- return h*(t+t/(t+one));
- }
+ h = 0.5;
+ if (jx < 0)
+ h = -h;
+ /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
+ if (ix < 0x40360000) /* |x|<22 */
+ {
+ if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */
+ if (shuge + x > one)
+ return x;
+ /* sinh(tiny) = tiny with inexact */
+ t = __expm1 (fabs (x));
+ if (ix < 0x3ff00000)
+ 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 < 0x40862e42) return h*__ieee754_exp(fabs(x));
+ /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
+ if (ix < 0x40862e42)
+ return h * __ieee754_exp (fabs (x));
- /* |x| in [log(maxdouble), overflowthresold] */
- GET_LOW_WORD(lx,x);
- if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
- w = __ieee754_exp(0.5*fabs(x));
- t = h*w;
- return t*w;
- }
+ /* |x| in [log(maxdouble), overflowthresold] */
+ GET_LOW_WORD (lx, x);
+ if (ix < 0x408633ce || ((ix == 0x408633ce) && (lx <= (u_int32_t) 0x8fb9f87d)))
+ {
+ w = __ieee754_exp (0.5 * fabs (x));
+ t = h * w;
+ return t * w;
+ }
- /* |x| > overflowthresold, sinh(x) overflow */
- return x*shuge;
+ /* |x| > overflowthresold, sinh(x) overflow */
+ return x * shuge;
}
strong_alias (__ieee754_sinh, __sinh_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/e_sqrt.c b/libc/sysdeps/ieee754/dbl-64/e_sqrt.c
index 54610eeea..854ae38c4 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -44,58 +44,67 @@
/* it computes the correctly rounded (to nearest) value of square */
/* root of x. */
/*********************************************************************/
-double __ieee754_sqrt(double x) {
+double
+__ieee754_sqrt (double x)
+{
#include "uroot.h"
static const double
rt0 = 9.99999999859990725855365213134618E-01,
rt1 = 4.99999999495955425917856814202739E-01,
rt2 = 3.75017500867345182581453026130850E-01,
rt3 = 3.12523626554518656309172508769531E-01;
- static const double big = 134217728.0;
- double y,t,del,res,res1,hy,z,zz,p,hx,tx,ty,s;
- mynumber a,c={{0,0}};
+ static const double big = 134217728.0;
+ double y, t, del, res, res1, hy, z, zz, p, hx, tx, ty, s;
+ mynumber a, c = { { 0, 0 } };
int4 k;
- a.x=x;
- k=a.i[HIGH_HALF];
- a.i[HIGH_HALF]=(k&0x001fffff)|0x3fe00000;
- t=inroot[(k&0x001fffff)>>14];
- s=a.x;
+ a.x = x;
+ k = a.i[HIGH_HALF];
+ a.i[HIGH_HALF] = (k & 0x001fffff) | 0x3fe00000;
+ t = inroot[(k & 0x001fffff) >> 14];
+ s = a.x;
/*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
- if (k>0x000fffff && k<0x7ff00000) {
- fenv_t env;
- libc_feholdexcept (&env);
- double ret;
- y=1.0-t*(t*s);
- t=t*(rt0+y*(rt1+y*(rt2+y*rt3)));
- c.i[HIGH_HALF]=0x20000000+((k&0x7fe00000)>>1);
- y=t*s;
- hy=(y+big)-big;
- del=0.5*t*((s-hy*hy)-(y-hy)*(y+hy));
- res=y+del;
- if (res == (res+1.002*((y-res)+del))) ret = res*c.x;
- else {
- res1=res+1.5*((y-res)+del);
- EMULV(res,res1,z,zz,p,hx,tx,hy,ty); /* (z+zz)=res*res1 */
- ret = ((((z-s)+zz)<0)?max(res,res1):min(res,res1))*c.x;
+ if (k > 0x000fffff && k < 0x7ff00000)
+ {
+ fenv_t env;
+ libc_feholdexcept (&env);
+ double ret;
+ y = 1.0 - t * (t * s);
+ t = t * (rt0 + y * (rt1 + y * (rt2 + y * rt3)));
+ c.i[HIGH_HALF] = 0x20000000 + ((k & 0x7fe00000) >> 1);
+ y = t * s;
+ hy = (y + big) - big;
+ del = 0.5 * t * ((s - hy * hy) - (y - hy) * (y + hy));
+ res = y + del;
+ if (res == (res + 1.002 * ((y - res) + del)))
+ ret = res * c.x;
+ else
+ {
+ res1 = res + 1.5 * ((y - res) + del);
+ EMULV (res, res1, z, zz, p, hx, tx, hy, ty); /* (z+zz)=res*res1 */
+ ret = ((((z - s) + zz) < 0) ? max (res, res1) :
+ min (res, res1)) * c.x;
+ }
+ math_force_eval (ret);
+ libc_fesetenv (&env);
+ if (x / ret != ret)
+ {
+ double force_inexact = 1.0 / 3.0;
+ math_force_eval (force_inexact);
+ }
+ /* Otherwise (x / ret == ret), either the square root was exact or
+ the division was inexact. */
+ return ret;
+ }
+ else
+ {
+ if ((k & 0x7ff00000) == 0x7ff00000)
+ return x * x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf, sqrt(-inf)=sNaN */
+ if (x == 0)
+ return x; /* sqrt(+0)=+0, sqrt(-0)=-0 */
+ if (k < 0)
+ return (x - x) / (x - x); /* sqrt(-ve)=sNaN */
+ return tm256.x * __ieee754_sqrt (x * t512.x);
}
- math_force_eval (ret);
- libc_fesetenv (&env);
- if (x / ret != ret)
- {
- double force_inexact = 1.0 / 3.0;
- math_force_eval (force_inexact);
- }
- /* Otherwise (x / ret == ret), either the square root was exact or
- the division was inexact. */
- return ret;
- }
- else {
- if ((k & 0x7ff00000) == 0x7ff00000)
- return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf, sqrt(-inf)=sNaN */
- if (x==0) return x; /* sqrt(+0)=+0, sqrt(-0)=-0 */
- if (k<0) return (x-x)/(x-x); /* sqrt(-ve)=sNaN */
- return tm256.x*__ieee754_sqrt(x*t512.x);
- }
}
strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/halfulp.c b/libc/sysdeps/ieee754/dbl-64/halfulp.c
index 8c5a9312a..382ad7aad 100644
--- a/libc/sysdeps/ieee754/dbl-64/halfulp.c
+++ b/libc/sysdeps/ieee754/dbl-64/halfulp.c
@@ -44,86 +44,109 @@
#endif
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,
- 3, 3, 3, 3, 3, 3, 3, 3 };
+ 262143, 11585, 1782, 511, 210, 107, 63, 42,
+ 30, 22, 17, 14, 12, 10, 9, 7,
+ 7, 6, 5, 5, 5, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3
+};
double
SECTION
-__halfulp(double x, double y)
+__halfulp (double x, double y)
{
mynumber v;
- double z,u,uu;
+ double z, u, uu;
#ifndef DLA_FMS
- double j1,j2,j3,j4,j5;
+ double j1, j2, j3, j4, j5;
#endif
- int4 k,l,m,n;
- if (y <= 0) { /*if power is negative or zero */
- v.x = y;
- if (v.i[LOW_HALF] != 0) return -10.0;
- v.x = x;
- if (v.i[LOW_HALF] != 0) return -10.0;
- if ((v.i[HIGH_HALF]&0x000fffff) != 0) return -10; /* if x =2 ^ n */
- k = ((v.i[HIGH_HALF]&0x7fffffff)>>20)-1023; /* find this n */
- z = (double) k;
- return (z*y == -1075.0)?0: -10.0;
- }
- /* if y > 0 */
+ int4 k, l, m, n;
+ if (y <= 0) /*if power is negative or zero */
+ {
+ v.x = y;
+ if (v.i[LOW_HALF] != 0)
+ return -10.0;
+ v.x = x;
+ if (v.i[LOW_HALF] != 0)
+ return -10.0;
+ if ((v.i[HIGH_HALF] & 0x000fffff) != 0)
+ return -10; /* if x =2 ^ n */
+ k = ((v.i[HIGH_HALF] & 0x7fffffff) >> 20) - 1023; /* find this n */
+ z = (double) k;
+ return (z * y == -1075.0) ? 0 : -10.0;
+ }
+ /* if y > 0 */
v.x = y;
- if (v.i[LOW_HALF] != 0) return -10.0;
+ if (v.i[LOW_HALF] != 0)
+ return -10.0;
- v.x=x;
- /* case where x = 2**n for some integer n */
- if (((v.i[HIGH_HALF]&0x000fffff)|v.i[LOW_HALF]) == 0) {
- k=(v.i[HIGH_HALF]>>20)-1023;
- return (((double) k)*y == -1075.0)?0:-10.0;
- }
+ v.x = x;
+ /* case where x = 2**n for some integer n */
+ if (((v.i[HIGH_HALF] & 0x000fffff) | v.i[LOW_HALF]) == 0)
+ {
+ k = (v.i[HIGH_HALF] >> 20) - 1023;
+ return (((double) k) * y == -1075.0) ? 0 : -10.0;
+ }
v.x = y;
k = v.i[HIGH_HALF];
- m = k<<12;
+ m = k << 12;
l = 0;
while (m)
- {m = m<<1; l++; }
- n = (k&0x000fffff)|0x00100000;
- n = n>>(20-l); /* n is the odd integer of y */
- k = ((k>>20) -1023)-l; /* y = n*2**k */
- if (k>5) return -10.0;
- if (k>0) for (;k>0;k--) n *= 2;
- if (n > 34) return -10.0;
+ {
+ m = m << 1; l++;
+ }
+ n = (k & 0x000fffff) | 0x00100000;
+ n = n >> (20 - l); /* n is the odd integer of y */
+ k = ((k >> 20) - 1023) - l; /* y = n*2**k */
+ if (k > 5)
+ return -10.0;
+ if (k > 0)
+ for (; k > 0; k--)
+ n *= 2;
+ if (n > 34)
+ return -10.0;
k = -k;
- if (k>5) return -10.0;
+ if (k > 5)
+ return -10.0;
- /* now treat x */
- while (k>0) {
- z = __ieee754_sqrt(x);
- EMULV(z,z,u,uu,j1,j2,j3,j4,j5);
- if (((u-x)+uu) != 0) break;
- x = z;
- k--;
- }
- if (k) return -10.0;
+ /* now treat x */
+ while (k > 0)
+ {
+ z = __ieee754_sqrt (x);
+ EMULV (z, z, u, uu, j1, j2, j3, j4, j5);
+ if (((u - x) + uu) != 0)
+ break;
+ x = z;
+ k--;
+ }
+ if (k)
+ return -10.0;
/* it is impossible that n == 2, so the mantissa of x must be short */
v.x = x;
- if (v.i[LOW_HALF]) return -10.0;
+ if (v.i[LOW_HALF])
+ return -10.0;
k = v.i[HIGH_HALF];
- m = k<<12;
+ m = k << 12;
l = 0;
- while (m) {m = m<<1; l++; }
- m = (k&0x000fffff)|0x00100000;
- m = m>>(20-l); /* m is the odd integer of x */
+ while (m)
+ {
+ m = m << 1; l++;
+ }
+ m = (k & 0x000fffff) | 0x00100000;
+ m = m >> (20 - l); /* m is the odd integer of x */
- /* now check whether the length of m**n is at most 54 bits */
+ /* now check whether the length of m**n is at most 54 bits */
- if (m > tab54[n-3]) return -10.0;
+ if (m > tab54[n - 3])
+ return -10.0;
- /* yes, it is - now compute x**n by simple multiplications */
+ /* yes, it is - now compute x**n by simple multiplications */
u = x;
- for (k=1;k<n;k++) u = u*x;
+ for (k = 1; k < n; k++)
+ u = u * x;
return u;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/libc/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index ec4b4cf60..047c6c288 100644
--- a/libc/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/libc/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -147,166 +147,215 @@ static const double PIo2[] = {
};
static const double
-zero = 0.0,
-one = 1.0,
-two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
-twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
+ zero = 0.0,
+ one = 1.0,
+ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
+ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
-int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
+int
+__kernel_rem_pio2 (double *x, double *y, int e0, int nx, int prec,
+ const int32_t *ipio2)
{
- int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
- double z,fw,f[20],fq[20],q[20];
+ int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih;
+ double z, fw, f[20], fq[20], q[20];
- /* initialize jk*/
- jk = init_jk[prec];
- jp = jk;
+ /* initialize jk*/
+ jk = init_jk[prec];
+ jp = jk;
- /* determine jx,jv,q0, note that 3>q0 */
- jx = nx-1;
- jv = (e0-3)/24; if(jv<0) jv=0;
- q0 = e0-24*(jv+1);
+ /* determine jx,jv,q0, note that 3>q0 */
+ jx = nx - 1;
+ jv = (e0 - 3) / 24; if (jv < 0)
+ jv = 0;
+ q0 = e0 - 24 * (jv + 1);
- /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */
- j = jv-jx; m = jx+jk;
- for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j];
+ /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */
+ j = jv - jx; m = jx + jk;
+ for (i = 0; i <= m; i++, j++)
+ f[i] = (j < 0) ? zero : (double) ipio2[j];
- /* compute q[0],q[1],...q[jk] */
- for (i=0;i<=jk;i++) {
- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
- }
+ /* compute q[0],q[1],...q[jk] */
+ for (i = 0; i <= jk; i++)
+ {
+ for (j = 0, fw = 0.0; j <= jx; j++)
+ fw += x[j] * f[jx + i - j];
+ q[i] = fw;
+ }
- jz = jk;
+ jz = jk;
recompute:
- /* distill q[] into iq[] reversingly */
- for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
- fw = (double)((int32_t)(twon24* z));
- iq[i] = (int32_t)(z-two24*fw);
- z = q[j-1]+fw;
- }
+ /* distill q[] into iq[] reversingly */
+ for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)
+ {
+ fw = (double) ((int32_t) (twon24 * z));
+ iq[i] = (int32_t) (z - two24 * fw);
+ z = q[j - 1] + fw;
+ }
- /* compute n */
- z = __scalbn(z,q0); /* actual value of z */
- z -= 8.0*__floor(z*0.125); /* trim off integer >= 8 */
- n = (int32_t) z;
- z -= (double)n;
- ih = 0;
- if(q0>0) { /* need iq[jz-1] to determine n */
- i = (iq[jz-1]>>(24-q0)); n += i;
- iq[jz-1] -= i<<(24-q0);
- ih = iq[jz-1]>>(23-q0);
- }
- else if(q0==0) ih = iq[jz-1]>>23;
- else if(z>=0.5) ih=2;
+ /* compute n */
+ z = __scalbn (z, q0); /* actual value of z */
+ z -= 8.0 * __floor (z * 0.125); /* trim off integer >= 8 */
+ n = (int32_t) z;
+ z -= (double) n;
+ ih = 0;
+ if (q0 > 0) /* need iq[jz-1] to determine n */
+ {
+ i = (iq[jz - 1] >> (24 - q0)); n += i;
+ iq[jz - 1] -= i << (24 - q0);
+ ih = iq[jz - 1] >> (23 - q0);
+ }
+ else if (q0 == 0)
+ ih = iq[jz - 1] >> 23;
+ else if (z >= 0.5)
+ ih = 2;
- if(ih>0) { /* q > 0.5 */
- n += 1; carry = 0;
- for(i=0;i<jz ;i++) { /* compute 1-q */
- j = iq[i];
- if(carry==0) {
- if(j!=0) {
- carry = 1; iq[i] = 0x1000000- j;
- }
- } else iq[i] = 0xffffff - j;
- }
- if(q0>0) { /* rare case: chance is 1 in 12 */
- switch(q0) {
- case 1:
- iq[jz-1] &= 0x7fffff; break;
- case 2:
- iq[jz-1] &= 0x3fffff; break;
- }
+ if (ih > 0) /* q > 0.5 */
+ {
+ n += 1; carry = 0;
+ for (i = 0; i < jz; i++) /* compute 1-q */
+ {
+ j = iq[i];
+ if (carry == 0)
+ {
+ if (j != 0)
+ {
+ carry = 1; iq[i] = 0x1000000 - j;
+ }
}
- if(ih==2) {
- z = one - z;
- if(carry!=0) z -= __scalbn(one,q0);
+ else
+ iq[i] = 0xffffff - j;
+ }
+ if (q0 > 0) /* rare case: chance is 1 in 12 */
+ {
+ switch (q0)
+ {
+ case 1:
+ iq[jz - 1] &= 0x7fffff; break;
+ case 2:
+ iq[jz - 1] &= 0x3fffff; break;
}
}
+ if (ih == 2)
+ {
+ z = one - z;
+ if (carry != 0)
+ z -= __scalbn (one, q0);
+ }
+ }
- /* check if recomputation is needed */
- if(z==zero) {
- j = 0;
- for (i=jz-1;i>=jk;i--) j |= iq[i];
- if(j==0) { /* need recomputation */
- for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */
+ /* check if recomputation is needed */
+ if (z == zero)
+ {
+ j = 0;
+ for (i = jz - 1; i >= jk; i--)
+ j |= iq[i];
+ if (j == 0) /* need recomputation */
+ {
+ for (k = 1; iq[jk - k] == 0; k++)
+ ; /* k = no. of terms needed */
- for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */
- f[jx+i] = (double) ipio2[jv+i];
- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
- q[i] = fw;
- }
- jz += k;
- goto recompute;
+ for (i = jz + 1; i <= jz + k; i++) /* add q[jz+1] to q[jz+k] */
+ {
+ f[jx + i] = (double) ipio2[jv + i];
+ for (j = 0, fw = 0.0; j <= jx; j++)
+ fw += x[j] * f[jx + i - j];
+ q[i] = fw;
}
+ jz += k;
+ goto recompute;
}
+ }
- /* chop off zero terms */
- if(z==0.0) {
- jz -= 1; q0 -= 24;
- while(iq[jz]==0) { jz--; q0-=24;}
- } else { /* break z into 24-bit if necessary */
- z = __scalbn(z,-q0);
- if(z>=two24) {
- fw = (double)((int32_t)(twon24*z));
- iq[jz] = (int32_t)(z-two24*fw);
- jz += 1; q0 += 24;
- iq[jz] = (int32_t) fw;
- } else iq[jz] = (int32_t) z ;
+ /* chop off zero terms */
+ if (z == 0.0)
+ {
+ jz -= 1; q0 -= 24;
+ while (iq[jz] == 0)
+ {
+ jz--; q0 -= 24;
}
-
- /* convert integer "bit" chunk to floating-point value */
- fw = __scalbn(one,q0);
- for(i=jz;i>=0;i--) {
- q[i] = fw*(double)iq[i]; fw*=twon24;
+ }
+ else /* break z into 24-bit if necessary */
+ {
+ z = __scalbn (z, -q0);
+ if (z >= two24)
+ {
+ fw = (double) ((int32_t) (twon24 * z));
+ iq[jz] = (int32_t) (z - two24 * fw);
+ jz += 1; q0 += 24;
+ iq[jz] = (int32_t) fw;
}
+ else
+ iq[jz] = (int32_t) z;
+ }
- /* compute PIo2[0,...,jp]*q[jz,...,0] */
- for(i=jz;i>=0;i--) {
- for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k];
- fq[jz-i] = fw;
- }
+ /* convert integer "bit" chunk to floating-point value */
+ fw = __scalbn (one, q0);
+ for (i = jz; i >= 0; i--)
+ {
+ q[i] = fw * (double) iq[i]; fw *= twon24;
+ }
- /* compress fq[] into y[] */
- switch(prec) {
- case 0:
- fw = 0.0;
- for (i=jz;i>=0;i--) fw += fq[i];
- y[0] = (ih==0)? fw: -fw;
- break;
- case 1:
- case 2:;
+ /* compute PIo2[0,...,jp]*q[jz,...,0] */
+ for (i = jz; i >= 0; i--)
+ {
+ for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++)
+ fw += PIo2[k] * q[i + k];
+ fq[jz - i] = fw;
+ }
+
+ /* compress fq[] into y[] */
+ switch (prec)
+ {
+ case 0:
+ fw = 0.0;
+ for (i = jz; i >= 0; i--)
+ fw += fq[i];
+ y[0] = (ih == 0) ? fw : -fw;
+ break;
+ case 1:
+ case 2:;
#if __FLT_EVAL_METHOD__ != 0
- volatile
+ volatile
#endif
- double fv = 0.0;
- for (i=jz;i>=0;i--) fv += fq[i];
- y[0] = (ih==0)? fv: -fv;
- fv = fq[0]-fv;
- for (i=1;i<=jz;i++) fv += fq[i];
- y[1] = (ih==0)? fv: -fv;
- break;
- case 3: /* painful */
- for (i=jz;i>0;i--) {
+ double fv = 0.0;
+ for (i = jz; i >= 0; i--)
+ fv += fq[i];
+ y[0] = (ih == 0) ? fv : -fv;
+ fv = fq[0] - fv;
+ for (i = 1; i <= jz; i++)
+ fv += fq[i];
+ y[1] = (ih == 0) ? fv : -fv;
+ break;
+ case 3: /* painful */
+ for (i = jz; i > 0; i--)
+ {
#if __FLT_EVAL_METHOD__ != 0
- volatile
+ volatile
#endif
- double fv = (double)(fq[i-1]+fq[i]);
- fq[i] += fq[i-1]-fv;
- fq[i-1] = fv;
- }
- for (i=jz;i>1;i--) {
+ double fv = (double) (fq[i - 1] + fq[i]);
+ fq[i] += fq[i - 1] - fv;
+ fq[i - 1] = fv;
+ }
+ for (i = jz; i > 1; i--)
+ {
#if __FLT_EVAL_METHOD__ != 0
- volatile
+ volatile
#endif
- double fv = (double)(fq[i-1]+fq[i]);
- fq[i] += fq[i-1]-fv;
- fq[i-1] = fv;
- }
- for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
- if(ih==0) {
- y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
- } else {
- y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw;
- }
+ double fv = (double) (fq[i - 1] + fq[i]);
+ fq[i] += fq[i - 1] - fv;
+ fq[i - 1] = fv;
+ }
+ for (fw = 0.0, i = jz; i >= 2; i--)
+ fw += fq[i];
+ if (ih == 0)
+ {
+ y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
+ }
+ else
+ {
+ y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw;
}
- return n&7;
+ }
+ return n & 7;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/mpa-arch.h b/libc/sysdeps/ieee754/dbl-64/mpa-arch.h
index 7de9d51ae..779a43d9b 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpa-arch.h
+++ b/libc/sysdeps/ieee754/dbl-64/mpa-arch.h
@@ -22,15 +22,15 @@ typedef int64_t mantissa_store_t;
#define TWOPOW(i) (1L << i)
#define RADIX_EXP 24
-#define RADIX TWOPOW (RADIX_EXP) /* 2^24 */
+#define RADIX TWOPOW (RADIX_EXP) /* 2^24 */
/* Divide D by RADIX and put the remainder in R. D must be a non-negative
integral value. */
#define DIV_RADIX(d, r) \
- ({ \
- r = d & (RADIX - 1); \
- d >>= RADIX_EXP; \
- })
+ ({ \
+ r = d & (RADIX - 1); \
+ d >>= RADIX_EXP; \
+ })
/* Put the integer component of a double X in R and retain the fraction in
X. This is used in extracting mantissa digits for MP_NO by using the
@@ -38,10 +38,10 @@ typedef int64_t mantissa_store_t;
digit and then scaling by RADIX to get the next mantissa digit in the same
manner. */
#define INTEGER_OF(x, i) \
- ({ \
- i = (mantissa_t) x; \
- x -= i; \
- })
+ ({ \
+ i = (mantissa_t) x; \
+ x -= i; \
+ })
/* Align IN down to F. The code assumes that F is a power of two. */
-#define ALIGN_DOWN_TO(in, f) ((in) & -(f))
+#define ALIGN_DOWN_TO(in, f) ((in) & - (f))
diff --git a/libc/sysdeps/ieee754/dbl-64/mpa.c b/libc/sysdeps/ieee754/dbl-64/mpa.c
index a3feb175e..190e8a637 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpa.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpa.c
@@ -50,8 +50,8 @@
#endif
#ifndef NO__CONST
-const mp_no mpone = {1, {1.0, 1.0}};
-const mp_no mptwo = {1, {1.0, 2.0}};
+const mp_no mpone = { 1, { 1.0, 1.0 } };
+const mp_no mptwo = { 1, { 1.0, 2.0 } };
#endif
#ifndef NO___ACR
@@ -123,7 +123,7 @@ __cpy (const mp_no *x, mp_no *y, int p)
static void
norm (const mp_no *x, double *y, int p)
{
-#define R RADIXI
+# define R RADIXI
long i;
double c;
mantissa_t a, u, v, z[5];
@@ -140,7 +140,7 @@ norm (const mp_no *x, double *y, int p)
}
else
{
- for (a = 1, z[1] = X[1]; z[1] < TWO23;)
+ for (a = 1, z[1] = X[1]; z[1] < TWO23; )
{
a *= 2;
z[1] *= 2;
@@ -188,7 +188,7 @@ norm (const mp_no *x, double *y, int p)
c *= RADIXI;
*y = c;
-#undef R
+# undef R
}
/* Convert a multiple precision number *X into a double precision
@@ -201,7 +201,7 @@ denorm (const mp_no *x, double *y, int p)
double c;
mantissa_t u, z[5];
-#define R RADIXI
+# define R RADIXI
if (EX < -44 || (EX == -44 && X[1] < TWO5))
{
*y = 0;
@@ -298,7 +298,7 @@ denorm (const mp_no *x, double *y, int p)
c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10);
*y = c * TWOM1032;
-#undef R
+# undef R
}
/* Convert multiple precision number *X into double precision number *Y. The
@@ -394,7 +394,7 @@ add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
zk = 1;
}
else
- {
+ {
Z[k--] = zk;
zk = 0;
}
@@ -409,7 +409,7 @@ add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
zk = 1;
}
else
- {
+ {
Z[k--] = zk;
zk = 0;
}
@@ -471,7 +471,7 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
zk = -1;
}
else
- {
+ {
Z[k--] = zk;
zk = 0;
}
@@ -487,18 +487,19 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
zk = -1;
}
else
- {
+ {
Z[k--] = zk;
zk = 0;
}
}
/* Normalize. */
- for (i = 1; Z[i] == 0; i++);
+ for (i = 1; Z[i] == 0; i++)
+ ;
EZ = EZ - i + 1;
- for (k = 1; i <= p2 + 1;)
+ for (k = 1; i <= p2 + 1; )
Z[k++] = Z[i++];
- for (; k <= p2;)
+ for (; k <= p2; )
Z[k++] = 0;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan.c b/libc/sysdeps/ieee754/dbl-64/mpatan.c
index 807b16a9b..a6ae61195 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpatan.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpatan.c
@@ -43,7 +43,6 @@ void
SECTION
__mpatan (mp_no *x, mp_no *y, int p)
{
-
int i, m, n;
double dx;
mp_no mptwoim1 =
diff --git a/libc/sysdeps/ieee754/dbl-64/mpn2dbl.c b/libc/sysdeps/ieee754/dbl-64/mpn2dbl.c
index 8a2f45b9d..0fada79a0 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpn2dbl.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpn2dbl.c
@@ -40,7 +40,7 @@ __mpn_construct_double (mp_srcptr frac_ptr, int expt, int negative)
u.ieee.mantissa0 = (frac_ptr[0] >> 32) & (((mp_limb_t) 1
<< (DBL_MANT_DIG - 32)) - 1);
#else
- #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+ # error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
#endif
return u.d;
diff --git a/libc/sysdeps/ieee754/dbl-64/mptan.c b/libc/sysdeps/ieee754/dbl-64/mptan.c
index 281bfca1c..a5c3fb36c 100644
--- a/libc/sysdeps/ieee754/dbl-64/mptan.c
+++ b/libc/sysdeps/ieee754/dbl-64/mptan.c
@@ -44,7 +44,6 @@ void
SECTION
__mptan (double x, mp_no *mpy, int p)
{
-
int n;
mp_no mpw, mpc, mps;
diff --git a/libc/sysdeps/ieee754/dbl-64/mydefs.h b/libc/sysdeps/ieee754/dbl-64/mydefs.h
index 89ca965c6..a430397c6 100644
--- a/libc/sysdeps/ieee754/dbl-64/mydefs.h
+++ b/libc/sysdeps/ieee754/dbl-64/mydefs.h
@@ -28,10 +28,9 @@
#define MY_H
typedef int int4;
-typedef union {int4 i[2]; double x;} mynumber;
-
-#define ABS(x) (((x)>0)?(x):-(x))
-#define max(x,y) (((y)>(x))?(y):(x))
-#define min(x,y) (((y)<(x))?(y):(x))
+typedef union { int4 i[2]; double x; } mynumber;
+#define ABS(x) (((x) > 0) ? (x) : -(x))
+#define max(x, y) (((y) > (x)) ? (y) : (x))
+#define min(x, y) (((y) < (x)) ? (y) : (x))
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/s_asinh.c b/libc/sysdeps/ieee754/dbl-64/s_asinh.c
index 68e854f5f..550074684 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_asinh.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_asinh.c
@@ -25,33 +25,43 @@
#include <math_private.h>
static const double
-one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
-ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
-huge= 1.00000000000000000000e+300;
+ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+ ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
+ huge = 1.00000000000000000000e+300;
double
-__asinh(double x)
+__asinh (double x)
{
- double w;
- int32_t hx,ix;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(__builtin_expect(ix< 0x3e300000, 0)) { /* |x|<2**-28 */
- if(huge+x>one) return x; /* return x inexact except 0 */
+ double w;
+ int32_t hx, ix;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */
+ {
+ if (huge + x > one)
+ return x; /* return x inexact except 0 */
+ }
+ if (__builtin_expect (ix > 0x41b00000, 0)) /* |x| > 2**28 */
+ {
+ if (ix >= 0x7ff00000)
+ return x + x; /* x is inf or NaN */
+ w = __ieee754_log (fabs (x)) + ln2;
+ }
+ else
+ {
+ double xa = fabs (x);
+ if (ix > 0x40000000) /* 2**28 > |x| > 2.0 */
+ {
+ w = __ieee754_log (2.0 * xa + one / (__ieee754_sqrt (xa * xa + one) +
+ xa));
}
- if(__builtin_expect(ix>0x41b00000, 0)) { /* |x| > 2**28 */
- if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
- w = __ieee754_log(fabs(x))+ln2;
- } else {
- double xa = fabs(x);
- if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
- w = __ieee754_log(2.0*xa+one/(__ieee754_sqrt(xa*xa+one)+xa));
- } else { /* 2.0 > |x| > 2**-28 */
- double t = xa*xa;
- w =__log1p(xa+t/(one+__ieee754_sqrt(one+t)));
- }
+ else /* 2.0 > |x| > 2**-28 */
+ {
+ double t = xa * xa;
+ w = __log1p (xa + t / (one + __ieee754_sqrt (one + t)));
}
- return __copysign(w, x);
+ }
+ return __copysign (w, x);
}
weak_alias (__asinh, asinh)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_atan.c b/libc/sysdeps/ieee754/dbl-64/s_atan.c
index 7b6c83ffb..744e96146 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_atan.c
@@ -42,6 +42,7 @@
#include "uatan.tbl"
#include "atnat.h"
#include <math.h>
+#include <stap-probe.h>
void __mpatan (mp_no *, mp_no *, int); /* see definition in mpatan.c */
static double atanMp (double, const int[]);
@@ -60,7 +61,7 @@ double
atan (double x)
{
double cor, s1, ss1, s2, ss2, t1, t2, t3, t7, t8, t9, t10, u, u2, u3,
- v, vv, w, ww, y, yy, z, zz;
+ v, vv, w, ww, y, yy, z, zz;
#ifndef DLA_FMS
double t4, t5, t6;
#endif
@@ -190,17 +191,17 @@ atan (double x)
yy = cij[i][4].d + z * yy;
yy = cij[i][3].d + z * yy;
yy = cij[i][2].d + z * yy;
- yy = HPI1 - z * yy;
+ yy = HPI1 - z * yy;
t1 = HPI - cij[i][1].d;
if (i < 112)
- u3 = U31; /* w < 1/2 */
+ u3 = U31; /* w < 1/2 */
else
- u3 = U32; /* w >= 1/2 */
+ u3 = U32; /* w >= 1/2 */
if ((y = t1 + (yy - u3)) == t1 + (yy + u3))
return __signArctan (x, y);
- DIV2 (1 , 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8, t9,
+ DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8, t9,
t10);
t1 = w - hij[i][0].d;
EADD (t1, ww, z, zz);
@@ -229,7 +230,7 @@ atan (double x)
else
{
if (u < E)
- { /* D <= u < E */
+ { /* D <= u < E */
w = 1 / u;
v = w * w;
EMULV (w, u, t1, t2, t3, t4, t5, t6, t7);
@@ -247,7 +248,7 @@ atan (double x)
if ((y = t3 + (yy - U4)) == t3 + (yy + U4))
return __signArctan (x, y);
- DIV2 (1 , 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8,
+ DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8,
t9, t10);
MUL2 (w, ww, w, ww, v, vv, t1, t2, t3, t4, t5, t6, t7, t8);
@@ -306,8 +307,12 @@ atanMp (double x, const int pr[])
__mp_dbl (&mpy1, &y1, p);
__mp_dbl (&mpy2, &y2, p);
if (y1 == y2)
- return y1;
+ {
+ LIBC_PROBE (slowatan, 3, &p, &x, &y1);
+ return y1;
+ }
}
+ LIBC_PROBE (slowatan_inexact, 3, &p, &x, &y1);
return y1; /*if impossible to do exact computing */
}
diff --git a/libc/sysdeps/ieee754/dbl-64/s_cbrt.c b/libc/sysdeps/ieee754/dbl-64/s_cbrt.c
index a7120e1e1..208a369a6 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_cbrt.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_cbrt.c
@@ -51,16 +51,17 @@ __cbrt (double x)
if (xe == 0 && fpclassify (x) <= FP_ZERO)
return x + x;
- u = (0.354895765043919860
- + ((1.50819193781584896
- + ((-2.11499494167371287
- + ((2.44693122563534430
- + ((-1.83469277483613086
- + (0.784932344976639262 - 0.145263899385486377 * xm) * xm)
+ u = (0.354895765043919860
+ + ((1.50819193781584896
+ + ((-2.11499494167371287
+ + ((2.44693122563534430
+ + ((-1.83469277483613086
+ + (0.784932344976639262 - 0.145263899385486377 * xm)
+ * xm)
+ * xm))
* xm))
- * xm))
- * xm))
- * xm));
+ * xm))
+ * xm));
t2 = u * u * u;
diff --git a/libc/sysdeps/ieee754/dbl-64/s_ceil.c b/libc/sysdeps/ieee754/dbl-64/s_ceil.c
index e048c81c2..b2154b407 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_ceil.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_ceil.c
@@ -25,44 +25,67 @@
static const double huge = 1.0e300;
double
-__ceil(double x)
+__ceil (double x)
{
- int32_t i0,i1,j0;
- u_int32_t i,j;
- EXTRACT_WORDS(i0,i1,x);
- j0 = ((i0>>20)&0x7ff)-0x3ff;
- if(j0<20) {
- if(j0<0) { /* raise inexact if x != 0 */
- math_force_eval(huge+x);
- /* return 0*sign(x) if |x|<1 */
- if(i0<0) {i0=0x80000000;i1=0;}
- else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
- } else {
- i = (0x000fffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
- if(i0>0) i0 += (0x00100000)>>j0;
- i0 &= (~i); i1=0;
+ int32_t i0, i1, j0;
+ u_int32_t i, j;
+ EXTRACT_WORDS (i0, i1, x);
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ if (j0 < 20)
+ {
+ if (j0 < 0) /* raise inexact if x != 0 */
+ {
+ math_force_eval (huge + x);
+ /* return 0*sign(x) if |x|<1 */
+ if (i0 < 0)
+ {
+ i0 = 0x80000000; i1 = 0;
}
- } else if (j0>51) {
- if(j0==0x400) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-20);
- if((i1&i)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
- if(i0>0) {
- if(j0==20) i0+=1;
- else {
- j = i1 + (1<<(52-j0));
- if(j<i1) i0+=1; /* got a carry */
- i1 = j;
- }
+ else if ((i0 | i1) != 0)
+ {
+ i0 = 0x3ff00000; i1 = 0;
}
- i1 &= (~i);
}
- INSERT_WORDS(x,i0,i1);
- return x;
+ else
+ {
+ i = (0x000fffff) >> j0;
+ if (((i0 & i) | i1) == 0)
+ return x; /* x is integral */
+ math_force_eval (huge + x); /* raise inexact flag */
+ if (i0 > 0)
+ i0 += (0x00100000) >> j0;
+ i0 &= (~i); i1 = 0;
+ }
+ }
+ else if (j0 > 51)
+ {
+ if (j0 == 0x400)
+ return x + x; /* inf or NaN */
+ else
+ return x; /* x is integral */
+ }
+ else
+ {
+ i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
+ if ((i1 & i) == 0)
+ return x; /* x is integral */
+ math_force_eval (huge + x); /* raise inexact flag */
+ if (i0 > 0)
+ {
+ if (j0 == 20)
+ i0 += 1;
+ else
+ {
+ j = i1 + (1 << (52 - j0));
+ if (j < i1)
+ i0 += 1; /* got a carry */
+ i1 = j;
+ }
+ }
+ i1 &= (~i);
+ }
+ INSERT_WORDS (x, i0, i1);
+ return x;
}
#ifndef __ceil
weak_alias (__ceil, ceil)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_copysign.c b/libc/sysdeps/ieee754/dbl-64/s_copysign.c
index a541ceb05..9caf24e8f 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_copysign.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_copysign.c
@@ -23,13 +23,14 @@ static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $
#include <math.h>
#include <math_private.h>
-double __copysign(double x, double y)
+double
+__copysign (double x, double y)
{
- u_int32_t hx,hy;
- GET_HIGH_WORD(hx,x);
- GET_HIGH_WORD(hy,y);
- SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
- return x;
+ u_int32_t hx, hy;
+ GET_HIGH_WORD (hx, x);
+ GET_HIGH_WORD (hy, y);
+ SET_HIGH_WORD (x, (hx & 0x7fffffff) | (hy & 0x80000000));
+ return x;
}
weak_alias (__copysign, copysign)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_erf.c b/libc/sysdeps/ieee754/dbl-64/s_erf.c
index e25e28d9d..aab4ed593 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_erf.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_erf.c
@@ -116,181 +116,176 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
#include <math_private.h>
static const double
-tiny = 1e-300,
-half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
-one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
-two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
- /* c = (float)0.84506291151 */
-erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */
+ tiny = 1e-300,
+ half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
+ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+ two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
+/* c = (float)0.84506291151 */
+ erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */
/*
* Coefficients for approximation to erf on [0,0.84375]
*/
-efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */
-efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */
-pp[] = {1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */
- -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */
- -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */
- -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */
- -2.37630166566501626084e-05}, /* 0xBEF8EAD6, 0x120016AC */
-qq[] = {0.0, 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */
- 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */
- 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */
- 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */
- -3.96022827877536812320e-06}, /* 0xBED09C43, 0x42A26120 */
+ efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */
+ efx8 = 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */
+ pp[] = { 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */
+ -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */
+ -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */
+ -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */
+ -2.37630166566501626084e-05 }, /* 0xBEF8EAD6, 0x120016AC */
+ qq[] = { 0.0, 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */
+ 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */
+ 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */
+ 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */
+ -3.96022827877536812320e-06 }, /* 0xBED09C43, 0x42A26120 */
/*
* Coefficients for approximation to erf in [0.84375,1.25]
*/
-pa[] = {-2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */
- 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */
- -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */
- 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */
- -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */
- 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */
- -2.16637559486879084300e-03}, /* 0xBF61BF38, 0x0A96073F */
-qa[] = {0.0, 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */
- 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */
- 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */
- 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */
- 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */
- 1.19844998467991074170e-02}, /* 0x3F888B54, 0x5735151D */
+ pa[] = { -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */
+ 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */
+ -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */
+ 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */
+ -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */
+ 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */
+ -2.16637559486879084300e-03 }, /* 0xBF61BF38, 0x0A96073F */
+ qa[] = { 0.0, 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */
+ 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */
+ 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */
+ 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */
+ 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */
+ 1.19844998467991074170e-02 }, /* 0x3F888B54, 0x5735151D */
/*
* Coefficients for approximation to erfc in [1.25,1/0.35]
*/
-ra[] = {-9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */
- -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */
- -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */
- -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */
- -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */
- -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */
- -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */
- -9.81432934416914548592e+00}, /* 0xC023A0EF, 0xC69AC25C */
-sa[] = {0.0,1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */
- 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */
- 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */
- 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */
- 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */
- 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */
- 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */
- -6.04244152148580987438e-02}, /* 0xBFAEEFF2, 0xEE749A62 */
+ ra[] = { -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */
+ -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */
+ -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */
+ -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */
+ -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */
+ -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */
+ -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */
+ -9.81432934416914548592e+00 }, /* 0xC023A0EF, 0xC69AC25C */
+ sa[] = { 0.0, 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */
+ 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */
+ 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */
+ 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */
+ 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */
+ 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */
+ 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */
+ -6.04244152148580987438e-02 }, /* 0xBFAEEFF2, 0xEE749A62 */
/*
* Coefficients for approximation to erfc in [1/.35,28]
*/
-rb[] = {-9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */
- -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */
- -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */
- -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */
- -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */
- -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */
- -4.83519191608651397019e+02}, /* 0xC07E384E, 0x9BDC383F */
-sb[] = {0.0,3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */
- 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */
- 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */
- 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */
- 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */
- 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */
- -2.24409524465858183362e+01}; /* 0xC03670E2, 0x42712D62 */
+ rb[] = { -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */
+ -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */
+ -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */
+ -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */
+ -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */
+ -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */
+ -4.83519191608651397019e+02 }, /* 0xC07E384E, 0x9BDC383F */
+ sb[] = { 0.0, 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */
+ 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */
+ 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */
+ 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */
+ 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */
+ 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */
+ -2.24409524465858183362e+01 }; /* 0xC03670E2, 0x42712D62 */
-double __erf(double x)
+double
+__erf (double x)
{
- int32_t hx,ix,i;
- double R,S,P,Q,s,y,z,r;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) { /* erf(nan)=nan */
- i = ((u_int32_t)hx>>31)<<1;
- return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
- }
+ int32_t hx, ix, i;
+ double R, S, P, Q, s, y, z, r;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ if (ix >= 0x7ff00000) /* erf(nan)=nan */
+ {
+ i = ((u_int32_t) hx >> 31) << 1;
+ return (double) (1 - i) + one / x; /* erf(+-inf)=+-1 */
+ }
- if(ix < 0x3feb0000) { /* |x|<0.84375 */
- double r1,r2,s1,s2,s3,z2,z4;
- if(ix < 0x3e300000) { /* |x|<2**-28 */
- if (ix < 0x00800000)
- return 0.125*(8.0*x+efx8*x); /*avoid underflow */
- return x + efx*x;
- }
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
- s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
-#else
- r1 = pp[0]+z*pp[1]; z2=z*z;
- r2 = pp[2]+z*pp[3]; z4=z2*z2;
- s1 = one+z*qq[1];
- s2 = qq[2]+z*qq[3];
- s3 = qq[4]+z*qq[5];
- r = r1 + z2*r2 + z4*pp[4];
- s = s1 + z2*s2 + z4*s3;
-#endif
- y = r/s;
- return x + x*y;
- }
- if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
- double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4;
- s = fabs(x)-one;
-#ifdef DO_NOT_USE_THIS
- P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
- Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
-#else
- P1 = pa[0]+s*pa[1]; s2=s*s;
- Q1 = one+s*qa[1]; s4=s2*s2;
- P2 = pa[2]+s*pa[3]; s6=s4*s2;
- Q2 = qa[2]+s*qa[3];
- P3 = pa[4]+s*pa[5];
- Q3 = qa[4]+s*qa[5];
- P4 = pa[6];
- Q4 = qa[6];
- P = P1 + s2*P2 + s4*P3 + s6*P4;
- Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4;
-#endif
- if(hx>=0) return erx + P/Q; else return -erx - P/Q;
- }
- if (ix >= 0x40180000) { /* inf>|x|>=6 */
- if(hx>=0) return one-tiny; else return tiny-one;
- }
- x = fabs(x);
- s = one/(x*x);
- if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */
-#ifdef DO_NOT_USE_THIS
- R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
- ra5+s*(ra6+s*ra7))))));
- S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
- sa5+s*(sa6+s*(sa7+s*sa8)))))));
-#else
- double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8;
- R1 = ra[0]+s*ra[1];s2 = s*s;
- S1 = one+s*sa[1]; s4 = s2*s2;
- R2 = ra[2]+s*ra[3];s6 = s4*s2;
- S2 = sa[2]+s*sa[3];s8 = s4*s4;
- R3 = ra[4]+s*ra[5];
- S3 = sa[4]+s*sa[5];
- R4 = ra[6]+s*ra[7];
- S4 = sa[6]+s*sa[7];
- R = R1 + s2*R2 + s4*R3 + s6*R4;
- S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8];
-#endif
- } else { /* |x| >= 1/0.35 */
-#ifdef DO_NOT_USE_THIS
- R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
- rb5+s*rb6)))));
- S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
- sb5+s*(sb6+s*sb7))))));
-#else
- double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6;
- R1 = rb[0]+s*rb[1];s2 = s*s;
- S1 = one+s*sb[1]; s4 = s2*s2;
- R2 = rb[2]+s*rb[3];s6 = s4*s2;
- S2 = sb[2]+s*sb[3];
- R3 = rb[4]+s*rb[5];
- S3 = sb[4]+s*sb[5];
- S4 = sb[6]+s*sb[7];
- R = R1 + s2*R2 + s4*R3 + s6*rb[6];
- S = S1 + s2*S2 + s4*S3 + s6*S4;
-#endif
+ if (ix < 0x3feb0000) /* |x|<0.84375 */
+ {
+ double r1, r2, s1, s2, s3, z2, z4;
+ if (ix < 0x3e300000) /* |x|<2**-28 */
+ {
+ if (ix < 0x00800000)
+ return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */
+ return x + efx * x;
}
- z = x;
- SET_LOW_WORD(z,0);
- r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
- if(hx>=0) return one-r/x; else return r/x-one;
+ z = x * x;
+ r1 = pp[0] + z * pp[1]; z2 = z * z;
+ r2 = pp[2] + z * pp[3]; z4 = z2 * z2;
+ s1 = one + z * qq[1];
+ s2 = qq[2] + z * qq[3];
+ s3 = qq[4] + z * qq[5];
+ r = r1 + z2 * r2 + z4 * pp[4];
+ s = s1 + z2 * s2 + z4 * s3;
+ y = r / s;
+ return x + x * y;
+ }
+ if (ix < 0x3ff40000) /* 0.84375 <= |x| < 1.25 */
+ {
+ double s2, s4, s6, P1, P2, P3, P4, Q1, Q2, Q3, Q4;
+ s = fabs (x) - one;
+ P1 = pa[0] + s * pa[1]; s2 = s * s;
+ Q1 = one + s * qa[1]; s4 = s2 * s2;
+ P2 = pa[2] + s * pa[3]; s6 = s4 * s2;
+ Q2 = qa[2] + s * qa[3];
+ P3 = pa[4] + s * pa[5];
+ Q3 = qa[4] + s * qa[5];
+ P4 = pa[6];
+ Q4 = qa[6];
+ P = P1 + s2 * P2 + s4 * P3 + s6 * P4;
+ Q = Q1 + s2 * Q2 + s4 * Q3 + s6 * Q4;
+ if (hx >= 0)
+ return erx + P / Q;
+ else
+ return -erx - P / Q;
+ }
+ if (ix >= 0x40180000) /* inf>|x|>=6 */
+ {
+ if (hx >= 0)
+ return one - tiny;
+ else
+ return tiny - one;
+ }
+ x = fabs (x);
+ s = one / (x * x);
+ if (ix < 0x4006DB6E) /* |x| < 1/0.35 */
+ {
+ double R1, R2, R3, R4, S1, S2, S3, S4, s2, s4, s6, s8;
+ R1 = ra[0] + s * ra[1]; s2 = s * s;
+ S1 = one + s * sa[1]; s4 = s2 * s2;
+ R2 = ra[2] + s * ra[3]; s6 = s4 * s2;
+ S2 = sa[2] + s * sa[3]; s8 = s4 * s4;
+ R3 = ra[4] + s * ra[5];
+ S3 = sa[4] + s * sa[5];
+ R4 = ra[6] + s * ra[7];
+ S4 = sa[6] + s * sa[7];
+ R = R1 + s2 * R2 + s4 * R3 + s6 * R4;
+ S = S1 + s2 * S2 + s4 * S3 + s6 * S4 + s8 * sa[8];
+ }
+ else /* |x| >= 1/0.35 */
+ {
+ double R1, R2, R3, S1, S2, S3, S4, s2, s4, s6;
+ R1 = rb[0] + s * rb[1]; s2 = s * s;
+ S1 = one + s * sb[1]; s4 = s2 * s2;
+ R2 = rb[2] + s * rb[3]; s6 = s4 * s2;
+ S2 = sb[2] + s * sb[3];
+ R3 = rb[4] + s * rb[5];
+ S3 = sb[4] + s * sb[5];
+ S4 = sb[6] + s * sb[7];
+ R = R1 + s2 * R2 + s4 * R3 + s6 * rb[6];
+ S = S1 + s2 * S2 + s4 * S3 + s6 * S4;
+ }
+ z = x;
+ SET_LOW_WORD (z, 0);
+ r = __ieee754_exp (-z * z - 0.5625) *
+ __ieee754_exp ((z - x) * (z + x) + R / S);
+ if (hx >= 0)
+ return one - r / x;
+ else
+ return r / x - one;
}
weak_alias (__erf, erf)
#ifdef NO_LONG_DOUBLE
@@ -298,117 +293,115 @@ strong_alias (__erf, __erfl)
weak_alias (__erf, erfl)
#endif
-double __erfc(double x)
+double
+__erfc (double x)
{
- int32_t hx,ix;
- double R,S,P,Q,s,y,z,r;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) { /* erfc(nan)=nan */
- /* erfc(+-inf)=0,2 */
- return (double)(((u_int32_t)hx>>31)<<1)+one/x;
- }
+ int32_t hx, ix;
+ double R, S, P, Q, s, y, z, r;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ if (ix >= 0x7ff00000) /* erfc(nan)=nan */
+ { /* erfc(+-inf)=0,2 */
+ return (double) (((u_int32_t) hx >> 31) << 1) + one / x;
+ }
- if(ix < 0x3feb0000) { /* |x|<0.84375 */
- double r1,r2,s1,s2,s3,z2,z4;
- if(ix < 0x3c700000) /* |x|<2**-56 */
- return one-x;
- z = x*x;
-#ifdef DO_NOT_USE_THIS
- r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
- s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
-#else
- r1 = pp[0]+z*pp[1]; z2=z*z;
- r2 = pp[2]+z*pp[3]; z4=z2*z2;
- s1 = one+z*qq[1];
- s2 = qq[2]+z*qq[3];
- s3 = qq[4]+z*qq[5];
- r = r1 + z2*r2 + z4*pp[4];
- s = s1 + z2*s2 + z4*s3;
-#endif
- y = r/s;
- if(hx < 0x3fd00000) { /* x<1/4 */
- return one-(x+x*y);
- } else {
- r = x*y;
- r += (x-half);
- return half - r ;
- }
+ if (ix < 0x3feb0000) /* |x|<0.84375 */
+ {
+ double r1, r2, s1, s2, s3, z2, z4;
+ if (ix < 0x3c700000) /* |x|<2**-56 */
+ return one - x;
+ z = x * x;
+ r1 = pp[0] + z * pp[1]; z2 = z * z;
+ r2 = pp[2] + z * pp[3]; z4 = z2 * z2;
+ s1 = one + z * qq[1];
+ s2 = qq[2] + z * qq[3];
+ s3 = qq[4] + z * qq[5];
+ r = r1 + z2 * r2 + z4 * pp[4];
+ s = s1 + z2 * s2 + z4 * s3;
+ y = r / s;
+ if (hx < 0x3fd00000) /* x<1/4 */
+ {
+ return one - (x + x * y);
}
- if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
- double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4;
- s = fabs(x)-one;
-#ifdef DO_NOT_USE_THIS
- P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
- Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
-#else
- P1 = pa[0]+s*pa[1]; s2=s*s;
- Q1 = one+s*qa[1]; s4=s2*s2;
- P2 = pa[2]+s*pa[3]; s6=s4*s2;
- Q2 = qa[2]+s*qa[3];
- P3 = pa[4]+s*pa[5];
- Q3 = qa[4]+s*qa[5];
- P4 = pa[6];
- Q4 = qa[6];
- P = P1 + s2*P2 + s4*P3 + s6*P4;
- Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4;
-#endif
- if(hx>=0) {
- z = one-erx; return z - P/Q;
- } else {
- z = erx+P/Q; return one+z;
- }
+ else
+ {
+ r = x * y;
+ r += (x - half);
+ return half - r;
}
- if (ix < 0x403c0000) { /* |x|<28 */
- x = fabs(x);
- s = one/(x*x);
- if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/
-#ifdef DO_NOT_USE_THIS
- R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
- ra5+s*(ra6+s*ra7))))));
- S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
- sa5+s*(sa6+s*(sa7+s*sa8)))))));
-#else
- double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8;
- R1 = ra[0]+s*ra[1];s2 = s*s;
- S1 = one+s*sa[1]; s4 = s2*s2;
- R2 = ra[2]+s*ra[3];s6 = s4*s2;
- S2 = sa[2]+s*sa[3];s8 = s4*s4;
- R3 = ra[4]+s*ra[5];
- S3 = sa[4]+s*sa[5];
- R4 = ra[6]+s*ra[7];
- S4 = sa[6]+s*sa[7];
- R = R1 + s2*R2 + s4*R3 + s6*R4;
- S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8];
-#endif
- } else { /* |x| >= 1/.35 ~ 2.857143 */
- double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6;
- if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */
-#ifdef DO_NOT_USE_THIS
- R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
- rb5+s*rb6)))));
- S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
- sb5+s*(sb6+s*sb7))))));
-#else
- R1 = rb[0]+s*rb[1];s2 = s*s;
- S1 = one+s*sb[1]; s4 = s2*s2;
- R2 = rb[2]+s*rb[3];s6 = s4*s2;
- S2 = sb[2]+s*sb[3];
- R3 = rb[4]+s*rb[5];
- S3 = sb[4]+s*sb[5];
- S4 = sb[6]+s*sb[7];
- R = R1 + s2*R2 + s4*R3 + s6*rb[6];
- S = S1 + s2*S2 + s4*S3 + s6*S4;
-#endif
- }
- z = x;
- SET_LOW_WORD(z,0);
- r = __ieee754_exp(-z*z-0.5625)*
- __ieee754_exp((z-x)*(z+x)+R/S);
- if(hx>0) return r/x; else return two-r/x;
- } else {
- if(hx>0) return tiny*tiny; else return two-tiny;
+ }
+ if (ix < 0x3ff40000) /* 0.84375 <= |x| < 1.25 */
+ {
+ double s2, s4, s6, P1, P2, P3, P4, Q1, Q2, Q3, Q4;
+ s = fabs (x) - one;
+ P1 = pa[0] + s * pa[1]; s2 = s * s;
+ Q1 = one + s * qa[1]; s4 = s2 * s2;
+ P2 = pa[2] + s * pa[3]; s6 = s4 * s2;
+ Q2 = qa[2] + s * qa[3];
+ P3 = pa[4] + s * pa[5];
+ Q3 = qa[4] + s * qa[5];
+ P4 = pa[6];
+ Q4 = qa[6];
+ P = P1 + s2 * P2 + s4 * P3 + s6 * P4;
+ Q = Q1 + s2 * Q2 + s4 * Q3 + s6 * Q4;
+ if (hx >= 0)
+ {
+ z = one - erx; return z - P / Q;
+ }
+ else
+ {
+ z = erx + P / Q; return one + z;
+ }
+ }
+ if (ix < 0x403c0000) /* |x|<28 */
+ {
+ x = fabs (x);
+ s = one / (x * x);
+ if (ix < 0x4006DB6D) /* |x| < 1/.35 ~ 2.857143*/
+ {
+ double R1, R2, R3, R4, S1, S2, S3, S4, s2, s4, s6, s8;
+ R1 = ra[0] + s * ra[1]; s2 = s * s;
+ S1 = one + s * sa[1]; s4 = s2 * s2;
+ R2 = ra[2] + s * ra[3]; s6 = s4 * s2;
+ S2 = sa[2] + s * sa[3]; s8 = s4 * s4;
+ R3 = ra[4] + s * ra[5];
+ S3 = sa[4] + s * sa[5];
+ R4 = ra[6] + s * ra[7];
+ S4 = sa[6] + s * sa[7];
+ R = R1 + s2 * R2 + s4 * R3 + s6 * R4;
+ S = S1 + s2 * S2 + s4 * S3 + s6 * S4 + s8 * sa[8];
+ }
+ else /* |x| >= 1/.35 ~ 2.857143 */
+ {
+ double R1, R2, R3, S1, S2, S3, S4, s2, s4, s6;
+ if (hx < 0 && ix >= 0x40180000)
+ return two - tiny; /* x < -6 */
+ R1 = rb[0] + s * rb[1]; s2 = s * s;
+ S1 = one + s * sb[1]; s4 = s2 * s2;
+ R2 = rb[2] + s * rb[3]; s6 = s4 * s2;
+ S2 = sb[2] + s * sb[3];
+ R3 = rb[4] + s * rb[5];
+ S3 = sb[4] + s * sb[5];
+ S4 = sb[6] + s * sb[7];
+ R = R1 + s2 * R2 + s4 * R3 + s6 * rb[6];
+ S = S1 + s2 * S2 + s4 * S3 + s6 * S4;
}
+ z = x;
+ SET_LOW_WORD (z, 0);
+ r = __ieee754_exp (-z * z - 0.5625) *
+ __ieee754_exp ((z - x) * (z + x) + R / S);
+ if (hx > 0)
+ return r / x;
+ else
+ return two - r / x;
+ }
+ else
+ {
+ if (hx > 0)
+ return tiny * tiny;
+ else
+ return two - tiny;
+ }
}
weak_alias (__erfc, erfc)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_expm1.c b/libc/sysdeps/ieee754/dbl-64/s_expm1.c
index 1a4bcd979..9c9bb3455 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_expm1.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_expm1.c
@@ -11,7 +11,7 @@
*/
/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25,
for performance improvement on pipelined processors.
-*/
+ */
/* expm1(x)
* Returns exp(x)-1, the exponential of x minus 1.
@@ -113,120 +113,145 @@
#include <math_private.h>
#define one Q[0]
static const double
-huge = 1.0e+300,
-tiny = 1.0e-300,
-o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */
-ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */
-ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */
-invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */
- /* scaled coefficients related to expm1 */
-Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */
- 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */
- -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */
- 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */
- -2.01099218183624371326e-07}; /* BE8AFDB7 6E09C32D */
+ huge = 1.0e+300,
+ tiny = 1.0e-300,
+ o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
+ ln2_hi = 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
+ ln2_lo = 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
+ invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
+/* scaled coefficients related to expm1 */
+ Q[] = { 1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */
+ 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */
+ -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */
+ 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */
+ -2.01099218183624371326e-07 }; /* BE8AFDB7 6E09C32D */
double
-__expm1(double x)
+__expm1 (double x)
{
- double y,hi,lo,c,t,e,hxs,hfx,r1,h2,h4,R1,R2,R3;
- int32_t k,xsb;
- u_int32_t hx;
+ double y, hi, lo, c, t, e, hxs, hfx, r1, h2, h4, R1, R2, R3;
+ int32_t k, xsb;
+ u_int32_t hx;
- GET_HIGH_WORD(hx,x);
- xsb = hx&0x80000000; /* sign bit of x */
- if(xsb==0) y=x; else y= -x; /* y = |x| */
- hx &= 0x7fffffff; /* high word of |x| */
+ GET_HIGH_WORD (hx, x);
+ xsb = hx & 0x80000000; /* sign bit of x */
+ if (xsb == 0)
+ y = x;
+ else
+ y = -x; /* y = |x| */
+ hx &= 0x7fffffff; /* high word of |x| */
- /* filter out huge and non-finite argument */
- if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */
- if(hx >= 0x40862E42) { /* if |x|>=709.78... */
- if(hx>=0x7ff00000) {
- u_int32_t low;
- GET_LOW_WORD(low,x);
- if(((hx&0xfffff)|low)!=0)
- return x+x; /* NaN */
- else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
- }
- if(x > o_threshold) {
- __set_errno (ERANGE);
- return huge*huge; /* overflow */
- }
+ /* filter out huge and non-finite argument */
+ if (hx >= 0x4043687A) /* if |x|>=56*ln2 */
+ {
+ if (hx >= 0x40862E42) /* if |x|>=709.78... */
+ {
+ if (hx >= 0x7ff00000)
+ {
+ u_int32_t low;
+ GET_LOW_WORD (low, x);
+ if (((hx & 0xfffff) | low) != 0)
+ return x + x; /* NaN */
+ else
+ return (xsb == 0) ? x : -1.0; /* exp(+-inf)={inf,-1} */
}
- if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
- math_force_eval(x+tiny); /* raise inexact */
- return tiny-one; /* return -1 */
+ if (x > o_threshold)
+ {
+ __set_errno (ERANGE);
+ return huge * huge; /* overflow */
}
}
+ if (xsb != 0) /* x < -56*ln2, return -1.0 with inexact */
+ {
+ math_force_eval (x + tiny); /* raise inexact */
+ return tiny - one; /* return -1 */
+ }
+ }
- /* argument reduction */
- if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
- if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
- if(xsb==0)
- {hi = x - ln2_hi; lo = ln2_lo; k = 1;}
- else
- {hi = x + ln2_hi; lo = -ln2_lo; k = -1;}
- } else {
- k = invln2*x+((xsb==0)?0.5:-0.5);
- t = k;
- hi = x - t*ln2_hi; /* t*ln2_hi is exact here */
- lo = t*ln2_lo;
+ /* argument reduction */
+ if (hx > 0x3fd62e42) /* if |x| > 0.5 ln2 */
+ {
+ if (hx < 0x3FF0A2B2) /* and |x| < 1.5 ln2 */
+ {
+ if (xsb == 0)
+ {
+ hi = x - ln2_hi; lo = ln2_lo; k = 1;
+ }
+ else
+ {
+ hi = x + ln2_hi; lo = -ln2_lo; k = -1;
}
- x = hi - lo;
- c = (hi-x)-lo;
}
- else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */
- t = huge+x; /* return x with inexact flags when x!=0 */
- return x - (t-(huge+x));
+ else
+ {
+ k = invln2 * x + ((xsb == 0) ? 0.5 : -0.5);
+ t = k;
+ hi = x - t * ln2_hi; /* t*ln2_hi is exact here */
+ lo = t * ln2_lo;
}
- else k = 0;
+ x = hi - lo;
+ c = (hi - x) - lo;
+ }
+ else if (hx < 0x3c900000) /* when |x|<2**-54, return x */
+ {
+ t = huge + x; /* return x with inexact flags when x!=0 */
+ return x - (t - (huge + x));
+ }
+ else
+ k = 0;
- /* x is now in primary range */
- hfx = 0.5*x;
- hxs = x*hfx;
-#ifdef DO_NOT_USE_THIS
- r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5))));
-#else
- R1 = one+hxs*Q[1]; h2 = hxs*hxs;
- R2 = Q[2]+hxs*Q[3]; h4 = h2*h2;
- R3 = Q[4]+hxs*Q[5];
- r1 = R1 + h2*R2 + h4*R3;
-#endif
- t = 3.0-r1*hfx;
- e = hxs*((r1-t)/(6.0 - x*t));
- if(k==0) return x - (x*e-hxs); /* c is 0 */
- else {
- e = (x*(e-c)-c);
- e -= hxs;
- if(k== -1) return 0.5*(x-e)-0.5;
- if(k==1) {
- if(x < -0.25) return -2.0*(e-(x+0.5));
- else return one+2.0*(x-e);
- }
- if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
- u_int32_t high;
- y = one-(e-x);
- GET_HIGH_WORD(high,y);
- SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */
- return y-one;
- }
- t = one;
- if(k<20) {
- u_int32_t high;
- SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
- y = t-(e-x);
- GET_HIGH_WORD(high,y);
- SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */
- } else {
- u_int32_t high;
- SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */
- y = x-(e+t);
- y += one;
- GET_HIGH_WORD(high,y);
- SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */
- }
+ /* x is now in primary range */
+ hfx = 0.5 * x;
+ hxs = x * hfx;
+ R1 = one + hxs * Q[1]; h2 = hxs * hxs;
+ R2 = Q[2] + hxs * Q[3]; h4 = h2 * h2;
+ R3 = Q[4] + hxs * Q[5];
+ r1 = R1 + h2 * R2 + h4 * R3;
+ t = 3.0 - r1 * hfx;
+ e = hxs * ((r1 - t) / (6.0 - x * t));
+ if (k == 0)
+ return x - (x * e - hxs); /* c is 0 */
+ else
+ {
+ e = (x * (e - c) - c);
+ e -= hxs;
+ if (k == -1)
+ return 0.5 * (x - e) - 0.5;
+ if (k == 1)
+ {
+ if (x < -0.25)
+ return -2.0 * (e - (x + 0.5));
+ else
+ return one + 2.0 * (x - e);
+ }
+ if (k <= -2 || k > 56) /* suffice to return exp(x)-1 */
+ {
+ u_int32_t high;
+ y = one - (e - x);
+ GET_HIGH_WORD (high, y);
+ SET_HIGH_WORD (y, high + (k << 20)); /* add k to y's exponent */
+ return y - one;
+ }
+ t = one;
+ if (k < 20)
+ {
+ u_int32_t high;
+ SET_HIGH_WORD (t, 0x3ff00000 - (0x200000 >> k)); /* t=1-2^-k */
+ y = t - (e - x);
+ GET_HIGH_WORD (high, y);
+ SET_HIGH_WORD (y, high + (k << 20)); /* add k to y's exponent */
+ }
+ else
+ {
+ u_int32_t high;
+ SET_HIGH_WORD (t, ((0x3ff - k) << 20)); /* 2^-k */
+ y = x - (e + t);
+ y += one;
+ GET_HIGH_WORD (high, y);
+ SET_HIGH_WORD (y, high + (k << 20)); /* add k to y's exponent */
}
- return y;
+ }
+ return y;
}
weak_alias (__expm1, expm1)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_fabs.c b/libc/sysdeps/ieee754/dbl-64/s_fabs.c
index 86f1d52be..c82c4210e 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_fabs.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_fabs.c
@@ -21,12 +21,13 @@ static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $";
#include <math.h>
#include <math_private.h>
-double __fabs(double x)
+double
+__fabs (double x)
{
- u_int32_t high;
- GET_HIGH_WORD(high,x);
- SET_HIGH_WORD(x,high&0x7fffffff);
- return x;
+ u_int32_t high;
+ GET_HIGH_WORD (high, x);
+ SET_HIGH_WORD (x, high & 0x7fffffff);
+ return x;
}
weak_alias (__fabs, fabs)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_finite.c b/libc/sysdeps/ieee754/dbl-64/s_finite.c
index 47dad5df2..5dc398efc 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_finite.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_finite.c
@@ -23,11 +23,12 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
#include <math_private.h>
#undef __finite
-int __finite(double x)
+int
+__finite (double x)
{
- int32_t hx;
- GET_HIGH_WORD(hx,x);
- return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
+ int32_t hx;
+ GET_HIGH_WORD (hx, x);
+ return (int) ((u_int32_t) ((hx & 0x7fffffff) - 0x7ff00000) >> 31);
}
hidden_def (__finite)
weak_alias (__finite, finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_floor.c b/libc/sysdeps/ieee754/dbl-64/s_floor.c
index 5c7297842..bd6afa72e 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_floor.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_floor.c
@@ -24,44 +24,67 @@
static const double huge = 1.0e300;
-double __floor(double x)
+double
+__floor (double x)
{
- int32_t i0,i1,j0;
- u_int32_t i,j;
- EXTRACT_WORDS(i0,i1,x);
- j0 = ((i0>>20)&0x7ff)-0x3ff;
- if(j0<20) {
- if(j0<0) { /* raise inexact if x != 0 */
- math_force_eval(huge+x);/* return 0*sign(x) if |x|<1 */
- if(i0>=0) {i0=i1=0;}
- else if(((i0&0x7fffffff)|i1)!=0)
- { i0=0xbff00000;i1=0;}
- } else {
- i = (0x000fffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
- if(i0<0) i0 += (0x00100000)>>j0;
- i0 &= (~i); i1=0;
+ int32_t i0, i1, j0;
+ u_int32_t i, j;
+ EXTRACT_WORDS (i0, i1, x);
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ if (j0 < 20)
+ {
+ if (j0 < 0) /* raise inexact if x != 0 */
+ {
+ math_force_eval (huge + x); /* return 0*sign(x) if |x|<1 */
+ if (i0 >= 0)
+ {
+ i0 = i1 = 0;
}
- } else if (j0>51) {
- if(j0==0x400) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-20);
- if((i1&i)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
- if(i0<0) {
- if(j0==20) i0+=1;
- else {
- j = i1+(1<<(52-j0));
- if(j<i1) i0 +=1 ; /* got a carry */
- i1=j;
- }
+ else if (((i0 & 0x7fffffff) | i1) != 0)
+ {
+ i0 = 0xbff00000; i1 = 0;
}
- i1 &= (~i);
}
- INSERT_WORDS(x,i0,i1);
- return x;
+ else
+ {
+ i = (0x000fffff) >> j0;
+ if (((i0 & i) | i1) == 0)
+ return x; /* x is integral */
+ math_force_eval (huge + x); /* raise inexact flag */
+ if (i0 < 0)
+ i0 += (0x00100000) >> j0;
+ i0 &= (~i); i1 = 0;
+ }
+ }
+ else if (j0 > 51)
+ {
+ if (j0 == 0x400)
+ return x + x; /* inf or NaN */
+ else
+ return x; /* x is integral */
+ }
+ else
+ {
+ i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
+ if ((i1 & i) == 0)
+ return x; /* x is integral */
+ math_force_eval (huge + x); /* raise inexact flag */
+ if (i0 < 0)
+ {
+ if (j0 == 20)
+ i0 += 1;
+ else
+ {
+ j = i1 + (1 << (52 - j0));
+ if (j < i1)
+ i0 += 1; /* got a carry */
+ i1 = j;
+ }
+ }
+ i1 &= (~i);
+ }
+ INSERT_WORDS (x, i0, i1);
+ return x;
}
#ifndef __floor
weak_alias (__floor, floor)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_frexp.c b/libc/sysdeps/ieee754/dbl-64/s_frexp.c
index 516f561a1..1b8d8500b 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_frexp.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_frexp.c
@@ -28,25 +28,28 @@ static char rcsid[] = "$NetBSD: s_frexp.c,v 1.9 1995/05/10 20:47:24 jtc Exp $";
#include <math_private.h>
static const double
-two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
+ two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
-double __frexp(double x, int *eptr)
+double
+__frexp (double x, int *eptr)
{
- int32_t hx, ix, lx;
- EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
- *eptr = 0;
- if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */
- if (ix<0x00100000) { /* subnormal */
- x *= two54;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- *eptr = -54;
- }
- *eptr += (ix>>20)-1022;
- hx = (hx&0x800fffff)|0x3fe00000;
- SET_HIGH_WORD(x,hx);
- return x;
+ int32_t hx, ix, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ ix = 0x7fffffff & hx;
+ *eptr = 0;
+ if (ix >= 0x7ff00000 || ((ix | lx) == 0))
+ return x; /* 0,inf,nan */
+ if (ix < 0x00100000) /* subnormal */
+ {
+ x *= two54;
+ GET_HIGH_WORD (hx, x);
+ ix = hx & 0x7fffffff;
+ *eptr = -54;
+ }
+ *eptr += (ix >> 20) - 1022;
+ hx = (hx & 0x800fffff) | 0x3fe00000;
+ SET_HIGH_WORD (x, hx);
+ return x;
}
weak_alias (__frexp, frexp)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_isinf.c b/libc/sysdeps/ieee754/dbl-64/s_isinf.c
index 886b346f5..46a7266e7 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_isinf.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_isinf.c
@@ -19,11 +19,11 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
int
__isinf (double x)
{
- int32_t hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
- lx |= -lx;
- return ~(lx >> 31) & (hx >> 30);
+ int32_t hx, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
+ lx |= -lx;
+ return ~(lx >> 31) & (hx >> 30);
}
hidden_def (__isinf)
weak_alias (__isinf, isinf)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_isinf_ns.c b/libc/sysdeps/ieee754/dbl-64/s_isinf_ns.c
index 0ce50352c..d8142bcf6 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_isinf_ns.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_isinf_ns.c
@@ -14,7 +14,7 @@
int
__isinf_ns (double x)
{
- int32_t hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- return !(lx | ((hx & 0x7fffffff) ^ 0x7ff00000));
+ int32_t hx, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ return !(lx | ((hx & 0x7fffffff) ^ 0x7ff00000));
}
diff --git a/libc/sysdeps/ieee754/dbl-64/s_isnan.c b/libc/sysdeps/ieee754/dbl-64/s_isnan.c
index f8958dcbb..5d9f31be2 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_isnan.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_isnan.c
@@ -23,14 +23,15 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
#include <math_private.h>
#undef __isnan
-int __isnan(double x)
+int
+__isnan (double x)
{
- int32_t hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- hx &= 0x7fffffff;
- hx |= (u_int32_t)(lx|(-lx))>>31;
- hx = 0x7ff00000 - hx;
- return (int)(((u_int32_t)hx)>>31);
+ int32_t hx, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ hx &= 0x7fffffff;
+ hx |= (u_int32_t) (lx | (-lx)) >> 31;
+ hx = 0x7ff00000 - hx;
+ return (int) (((u_int32_t) hx) >> 31);
}
hidden_def (__isnan)
weak_alias (__isnan, isnan)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_llround.c b/libc/sysdeps/ieee754/dbl-64/s_llround.c
index e8c2232e9..7d50a57dd 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_llround.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_llround.c
@@ -66,7 +66,7 @@ __llround (double x)
else
{
/* The number is too large. It is left implementation defined
- what happens. */
+ what happens. */
return (long long int) x;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/s_log1p.c b/libc/sysdeps/ieee754/dbl-64/s_log1p.c
index e3e686096..ea1dc6ca7 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_log1p.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_log1p.c
@@ -11,7 +11,7 @@
*/
/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25,
for performance improvement on pipelined processors.
-*/
+ */
/* double log1p(double x)
*
@@ -82,91 +82,112 @@
#include <math_private.h>
static const double
-ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
-ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
-two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
-Lp[] = {0.0, 6.666666666666735130e-01, /* 3FE55555 55555593 */
- 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
- 2.857142874366239149e-01, /* 3FD24924 94229359 */
- 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
- 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
- 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
- 1.479819860511658591e-01}; /* 3FC2F112 DF3E5244 */
+ ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
+ ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
+ two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
+ Lp[] = { 0.0, 6.666666666666735130e-01, /* 3FE55555 55555593 */
+ 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
+ 2.857142874366239149e-01, /* 3FD24924 94229359 */
+ 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
+ 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
+ 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
+ 1.479819860511658591e-01 }; /* 3FC2F112 DF3E5244 */
static const double zero = 0.0;
double
-__log1p(double x)
+__log1p (double x)
{
- double hfsq,f,c,s,z,R,u,z2,z4,z6,R1,R2,R3,R4;
- int32_t k,hx,hu,ax;
+ double hfsq, f, c, s, z, R, u, z2, z4, z6, R1, R2, R3, R4;
+ int32_t k, hx, hu, ax;
- GET_HIGH_WORD(hx,x);
- ax = hx&0x7fffffff;
+ GET_HIGH_WORD (hx, x);
+ ax = hx & 0x7fffffff;
- k = 1;
- if (hx < 0x3FDA827A) { /* x < 0.41422 */
- if(__builtin_expect(ax>=0x3ff00000, 0)) { /* x <= -1.0 */
- if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */
- else return (x-x)/(x-x); /* log1p(x<-1)=NaN */
- }
- if(__builtin_expect(ax<0x3e200000, 0)) { /* |x| < 2**-29 */
- math_force_eval(two54+x); /* raise inexact */
- if (ax<0x3c900000) /* |x| < 2**-54 */
- return x;
- else
- return x - x*x*0.5;
- }
- if(hx>0||hx<=((int32_t)0xbfd2bec3)) {
- k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */
+ k = 1;
+ if (hx < 0x3FDA827A) /* x < 0.41422 */
+ {
+ if (__builtin_expect (ax >= 0x3ff00000, 0)) /* x <= -1.0 */
+ {
+ if (x == -1.0)
+ return -two54 / (x - x); /* log1p(-1)=+inf */
+ else
+ return (x - x) / (x - x); /* log1p(x<-1)=NaN */
}
- else if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x;
- if(k!=0) {
- if(hx<0x43400000) {
- u = 1.0+x;
- GET_HIGH_WORD(hu,u);
- k = (hu>>20)-1023;
- c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */
- c /= u;
- } else {
- u = x;
- GET_HIGH_WORD(hu,u);
- k = (hu>>20)-1023;
- c = 0;
- }
- hu &= 0x000fffff;
- if(hu<0x6a09e) {
- SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */
- } else {
- k += 1;
- SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */
- hu = (0x00100000-hu)>>2;
- }
- f = u-1.0;
+ if (__builtin_expect (ax < 0x3e200000, 0)) /* |x| < 2**-29 */
+ {
+ math_force_eval (two54 + x); /* raise inexact */
+ if (ax < 0x3c900000) /* |x| < 2**-54 */
+ return x;
+ else
+ return x - x * x * 0.5;
}
- hfsq=0.5*f*f;
- if(hu==0) { /* |f| < 2**-20 */
- if(f==zero) {
- if(k==0) return zero;
- else {c += k*ln2_lo; return k*ln2_hi+c;}
+ if (hx > 0 || hx <= ((int32_t) 0xbfd2bec3))
+ {
+ k = 0; f = x; hu = 1;
+ } /* -0.2929<x<0.41422 */
+ }
+ else if (__builtin_expect (hx >= 0x7ff00000, 0))
+ return x + x;
+ if (k != 0)
+ {
+ if (hx < 0x43400000)
+ {
+ u = 1.0 + x;
+ GET_HIGH_WORD (hu, u);
+ k = (hu >> 20) - 1023;
+ c = (k > 0) ? 1.0 - (u - x) : x - (u - 1.0); /* correction term */
+ c /= u;
+ }
+ else
+ {
+ u = x;
+ GET_HIGH_WORD (hu, u);
+ k = (hu >> 20) - 1023;
+ c = 0;
+ }
+ hu &= 0x000fffff;
+ if (hu < 0x6a09e)
+ {
+ SET_HIGH_WORD (u, hu | 0x3ff00000); /* normalize u */
+ }
+ else
+ {
+ k += 1;
+ SET_HIGH_WORD (u, hu | 0x3fe00000); /* normalize u/2 */
+ hu = (0x00100000 - hu) >> 2;
+ }
+ f = u - 1.0;
+ }
+ hfsq = 0.5 * f * f;
+ if (hu == 0) /* |f| < 2**-20 */
+ {
+ if (f == zero)
+ {
+ if (k == 0)
+ return zero;
+ else
+ {
+ c += k * ln2_lo; return k * ln2_hi + c;
}
- R = hfsq*(1.0-0.66666666666666666*f);
- if(k==0) return f-R; else
- return k*ln2_hi-((R-(k*ln2_lo+c))-f);
}
- s = f/(2.0+f);
- z = s*s;
-#ifdef DO_NOT_USE_THIS
- R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
-#else
- R1 = z*Lp[1]; z2=z*z;
- R2 = Lp[2]+z*Lp[3]; z4=z2*z2;
- R3 = Lp[4]+z*Lp[5]; z6=z4*z2;
- R4 = Lp[6]+z*Lp[7];
- R = R1 + z2*R2 + z4*R3 + z6*R4;
-#endif
- if(k==0) return f-(hfsq-s*(hfsq+R)); else
- return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);
+ R = hfsq * (1.0 - 0.66666666666666666 * f);
+ if (k == 0)
+ return f - R;
+ else
+ return k * ln2_hi - ((R - (k * ln2_lo + c)) - f);
+ }
+ s = f / (2.0 + f);
+ z = s * s;
+ R1 = z * Lp[1]; z2 = z * z;
+ R2 = Lp[2] + z * Lp[3]; z4 = z2 * z2;
+ R3 = Lp[4] + z * Lp[5]; z6 = z4 * z2;
+ R4 = Lp[6] + z * Lp[7];
+ R = R1 + z2 * R2 + z4 * R3 + z6 * R4;
+ if (k == 0)
+ return f - (hfsq - s * (hfsq + R));
+ else
+ return k * ln2_hi - ((hfsq - (s * (hfsq + R) + (k * ln2_lo + c))) - f);
}
weak_alias (__log1p, log1p)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_logb.c b/libc/sysdeps/ieee754/dbl-64/s_logb.c
index 17aa94b75..c065826dd 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_logb.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_logb.c
@@ -25,7 +25,7 @@ __logb (double x)
int32_t lx, ix, rix;
EXTRACT_WORDS (ix, lx, x);
- ix &= 0x7fffffff; /* high |x| */
+ ix &= 0x7fffffff; /* high |x| */
if ((ix | lx) == 0)
return -1.0 / fabs (x);
if (ix >= 0x7ff00000)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_lrint.c b/libc/sysdeps/ieee754/dbl-64/s_lrint.c
index a68c97e59..1c3037364 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -33,7 +33,7 @@ long int
__lrint (double x)
{
int32_t j0;
- u_int32_t i0,i1;
+ u_int32_t i0, i1;
volatile double w;
double t;
long int result;
diff --git a/libc/sysdeps/ieee754/dbl-64/s_modf.c b/libc/sysdeps/ieee754/dbl-64/s_modf.c
index b9911c1af..1dce6381a 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_modf.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_modf.c
@@ -25,45 +25,59 @@
static const double one = 1.0;
double
-__modf(double x, double *iptr)
+__modf (double x, double *iptr)
{
- int32_t i0,i1,j0;
- u_int32_t i;
- EXTRACT_WORDS(i0,i1,x);
- j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
- if(j0<20) { /* integer part in high x */
- if(j0<0) { /* |x|<1 */
- INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */
- return x;
- } else {
- i = (0x000fffff)>>j0;
- if(((i0&i)|i1)==0) { /* x is integral */
- *iptr = x;
- INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
- return x;
- } else {
- INSERT_WORDS(*iptr,i0&(~i),0);
- return x - *iptr;
- }
+ int32_t i0, i1, j0;
+ u_int32_t i;
+ EXTRACT_WORDS (i0, i1, x);
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; /* exponent of x */
+ if (j0 < 20) /* integer part in high x */
+ {
+ if (j0 < 0) /* |x|<1 */
+ {
+ INSERT_WORDS (*iptr, i0 & 0x80000000, 0); /* *iptr = +-0 */
+ return x;
+ }
+ else
+ {
+ i = (0x000fffff) >> j0;
+ if (((i0 & i) | i1) == 0) /* x is integral */
+ {
+ *iptr = x;
+ INSERT_WORDS (x, i0 & 0x80000000, 0); /* return +-0 */
+ return x;
}
- } else if (__builtin_expect(j0>51, 0)) { /* no fraction part */
- *iptr = x*one;
- /* We must handle NaNs separately. */
- if (j0 == 0x400 && ((i0 & 0xfffff) | i1))
- return x*one;
- INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
- return x;
- } else { /* fraction part in low x */
- i = ((u_int32_t)(0xffffffff))>>(j0-20);
- if((i1&i)==0) { /* x is integral */
- *iptr = x;
- INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */
- return x;
- } else {
- INSERT_WORDS(*iptr,i0,i1&(~i));
- return x - *iptr;
+ else
+ {
+ INSERT_WORDS (*iptr, i0 & (~i), 0);
+ return x - *iptr;
}
}
+ }
+ else if (__builtin_expect (j0 > 51, 0)) /* no fraction part */
+ {
+ *iptr = x * one;
+ /* We must handle NaNs separately. */
+ if (j0 == 0x400 && ((i0 & 0xfffff) | i1))
+ return x * one;
+ INSERT_WORDS (x, i0 & 0x80000000, 0); /* return +-0 */
+ return x;
+ }
+ else /* fraction part in low x */
+ {
+ i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
+ if ((i1 & i) == 0) /* x is integral */
+ {
+ *iptr = x;
+ INSERT_WORDS (x, i0 & 0x80000000, 0); /* return +-0 */
+ return x;
+ }
+ else
+ {
+ INSERT_WORDS (*iptr, i0, i1 & (~i));
+ return x - *iptr;
+ }
+ }
}
weak_alias (__modf, modf)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
index 5017f471d..dec0c5d6e 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
@@ -29,40 +29,47 @@ static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $";
#include <math_private.h>
static const double
-TWO52[2]={
+ TWO52[2] = {
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
};
-double __nearbyint(double x)
+double
+__nearbyint (double x)
{
- fenv_t env;
- int32_t i0,j0,sx;
- double w,t;
- GET_HIGH_WORD(i0,x);
- sx = (i0>>31)&1;
- j0 = ((i0>>20)&0x7ff)-0x3ff;
- if(j0<52) {
- if(j0<0) {
- libc_feholdexcept (&env);
- w = TWO52[sx]+x;
- t = w-TWO52[sx];
- math_force_eval (t);
- libc_fesetenv (&env);
- GET_HIGH_WORD(i0,t);
- SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
- return t;
- }
- } else {
- if(j0==0x400) return x+x; /* inf or NaN */
- else return x; /* x is integral */
+ fenv_t env;
+ int32_t i0, j0, sx;
+ double w, t;
+ GET_HIGH_WORD (i0, x);
+ sx = (i0 >> 31) & 1;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ if (j0 < 52)
+ {
+ if (j0 < 0)
+ {
+ libc_feholdexcept (&env);
+ w = TWO52[sx] + x;
+ t = w - TWO52[sx];
+ math_force_eval (t);
+ libc_fesetenv (&env);
+ GET_HIGH_WORD (i0, t);
+ SET_HIGH_WORD (t, (i0 & 0x7fffffff) | (sx << 31));
+ return t;
}
- libc_feholdexcept (&env);
- w = TWO52[sx]+x;
- t = w-TWO52[sx];
- math_force_eval (t);
- libc_fesetenv (&env);
- return t;
+ }
+ else
+ {
+ if (j0 == 0x400)
+ return x + x; /* inf or NaN */
+ else
+ return x; /* x is integral */
+ }
+ libc_feholdexcept (&env);
+ w = TWO52[sx] + x;
+ t = w - TWO52[sx];
+ math_force_eval (t);
+ libc_fesetenv (&env);
+ return t;
}
weak_alias (__nearbyint, nearbyint)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_remquo.c b/libc/sysdeps/ieee754/dbl-64/s_remquo.c
index 642581ede..c40615004 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_remquo.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_remquo.c
@@ -28,8 +28,8 @@ static const double zero = 0.0;
double
__remquo (double x, double y, int *quo)
{
- int32_t hx,hy;
- u_int32_t sx,lx,ly;
+ int32_t hx, hy;
+ u_int32_t sx, lx, ly;
int cquo, qs;
EXTRACT_WORDS (hx, lx, x);
@@ -41,14 +41,14 @@ __remquo (double x, double y, int *quo)
/* Purge off exception values. */
if ((hy | ly) == 0)
- return (x * y) / (x * y); /* y = 0 */
- if ((hx >= 0x7ff00000) /* x not finite */
- || ((hy >= 0x7ff00000) /* p is NaN */
+ return (x * y) / (x * y); /* y = 0 */
+ if ((hx >= 0x7ff00000) /* x not finite */
+ || ((hy >= 0x7ff00000) /* p is NaN */
&& (((hy - 0x7ff00000) | ly) != 0)))
return (x * y) / (x * y);
if (hy <= 0x7fbfffff)
- x = __ieee754_fmod (x, 8 * y); /* now x < 8y */
+ x = __ieee754_fmod (x, 8 * y); /* now x < 8y */
if (((hx - hy) | (lx - ly)) == 0)
{
@@ -56,8 +56,8 @@ __remquo (double x, double y, int *quo)
return zero * x;
}
- x = fabs (x);
- y = fabs (y);
+ x = fabs (x);
+ y = fabs (y);
cquo = 0;
if (x >= 4 * y)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_rint.c b/libc/sysdeps/ieee754/dbl-64/s_rint.c
index 845890916..a9c0d2784 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_rint.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_rint.c
@@ -24,33 +24,39 @@
#include <math_private.h>
static const double
-TWO52[2]={
+ TWO52[2] = {
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
};
double
-__rint(double x)
+__rint (double x)
{
- int32_t i0,j0,sx;
- double w,t;
- GET_HIGH_WORD(i0,x);
- sx = (i0>>31)&1;
- j0 = ((i0>>20)&0x7ff)-0x3ff;
- if(j0<52) {
- if(j0<0) {
- w = TWO52[sx]+x;
- t = w-TWO52[sx];
- GET_HIGH_WORD(i0,t);
- SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
- return t;
- }
- } else {
- if(j0==0x400) return x+x; /* inf or NaN */
- else return x; /* x is integral */
+ int32_t i0, j0, sx;
+ double w, t;
+ GET_HIGH_WORD (i0, x);
+ sx = (i0 >> 31) & 1;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ if (j0 < 52)
+ {
+ if (j0 < 0)
+ {
+ w = TWO52[sx] + x;
+ t = w - TWO52[sx];
+ GET_HIGH_WORD (i0, t);
+ SET_HIGH_WORD (t, (i0 & 0x7fffffff) | (sx << 31));
+ return t;
}
- w = TWO52[sx]+x;
- return w-TWO52[sx];
+ }
+ else
+ {
+ if (j0 == 0x400)
+ return x + x; /* inf or NaN */
+ else
+ return x; /* x is integral */
+ }
+ w = TWO52[sx] + x;
+ return w - TWO52[sx];
}
#ifndef __rint
weak_alias (__rint, rint)
diff --git a/libc/sysdeps/ieee754/dbl-64/s_scalbln.c b/libc/sysdeps/ieee754/dbl-64/s_scalbln.c
index 271a24c3e..6402927d2 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_scalbln.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_scalbln.c
@@ -20,38 +20,43 @@
#include <math_private.h>
static const double
-two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
-twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
-huge = 1.0e+300,
-tiny = 1.0e-300;
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+ huge = 1.0e+300,
+ tiny = 1.0e-300;
double
__scalbln (double x, long int n)
{
- int32_t k,hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- k = (hx&0x7ff00000)>>20; /* extract exponent */
- if (__builtin_expect(k==0, 0)) { /* 0 or subnormal x */
- if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
- x *= two54;
- GET_HIGH_WORD(hx,x);
- k = ((hx&0x7ff00000)>>20) - 54;
- }
- if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */
- if (__builtin_expect(n< -50000, 0))
- return tiny*__copysign(tiny,x); /*underflow*/
- if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0))
- return huge*__copysign(huge,x); /* overflow */
- /* Now k and n are bounded we know that k = k+n does not
- overflow. */
- k = k+n;
- if (__builtin_expect(k > 0, 1)) /* normal result */
- {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
- if (k <= -54)
- return tiny*__copysign(tiny,x); /*underflow*/
- k += 54; /* subnormal result */
- SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
- return x*twom54;
+ int32_t k, hx, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ k = (hx & 0x7ff00000) >> 20; /* extract exponent */
+ if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */
+ {
+ if ((lx | (hx & 0x7fffffff)) == 0)
+ return x; /* +-0 */
+ x *= two54;
+ GET_HIGH_WORD (hx, x);
+ k = ((hx & 0x7ff00000) >> 20) - 54;
+ }
+ if (__builtin_expect (k == 0x7ff, 0))
+ return x + x; /* NaN or Inf */
+ if (__builtin_expect (n < -50000, 0))
+ return tiny * __copysign (tiny, x); /*underflow*/
+ if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0))
+ return huge * __copysign (huge, x); /* overflow */
+ /* Now k and n are bounded we know that k = k+n does not
+ overflow. */
+ k = k + n;
+ if (__builtin_expect (k > 0, 1)) /* normal result */
+ {
+ SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x;
+ }
+ if (k <= -54)
+ return tiny * __copysign (tiny, x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20));
+ return x * twom54;
}
weak_alias (__scalbln, scalbln)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_scalbn.c b/libc/sysdeps/ieee754/dbl-64/s_scalbn.c
index 1f302557e..6e7d5ad21 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_scalbn.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_scalbn.c
@@ -20,38 +20,43 @@
#include <math_private.h>
static const double
-two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
-twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
-huge = 1.0e+300,
-tiny = 1.0e-300;
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+ huge = 1.0e+300,
+ tiny = 1.0e-300;
double
__scalbn (double x, int n)
{
- int32_t k,hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- k = (hx&0x7ff00000)>>20; /* extract exponent */
- if (__builtin_expect(k==0, 0)) { /* 0 or subnormal x */
- if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
- x *= two54;
- GET_HIGH_WORD(hx,x);
- k = ((hx&0x7ff00000)>>20) - 54;
- }
- if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */
- if (__builtin_expect(n< -50000, 0))
- return tiny*__copysign(tiny,x); /*underflow*/
- if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0))
- return huge*__copysign(huge,x); /* overflow */
- /* Now k and n are bounded we know that k = k+n does not
- overflow. */
- k = k+n;
- if (__builtin_expect(k > 0, 1)) /* normal result */
- {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
- if (k <= -54)
- return tiny*__copysign(tiny,x); /*underflow*/
- k += 54; /* subnormal result */
- SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
- return x*twom54;
+ int32_t k, hx, lx;
+ EXTRACT_WORDS (hx, lx, x);
+ k = (hx & 0x7ff00000) >> 20; /* extract exponent */
+ if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */
+ {
+ if ((lx | (hx & 0x7fffffff)) == 0)
+ return x; /* +-0 */
+ x *= two54;
+ GET_HIGH_WORD (hx, x);
+ k = ((hx & 0x7ff00000) >> 20) - 54;
+ }
+ if (__builtin_expect (k == 0x7ff, 0))
+ return x + x; /* NaN or Inf */
+ if (__builtin_expect (n < -50000, 0))
+ return tiny * __copysign (tiny, x); /*underflow*/
+ if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0))
+ return huge * __copysign (huge, x); /* overflow */
+ /* Now k and n are bounded we know that k = k+n does not
+ overflow. */
+ k = k + n;
+ if (__builtin_expect (k > 0, 1)) /* normal result */
+ {
+ SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x;
+ }
+ if (k <= -54)
+ return tiny * __copysign (tiny, x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20));
+ return x * twom54;
}
weak_alias (__scalbn, scalbn)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/s_sin.c b/libc/sysdeps/ieee754/dbl-64/s_sin.c
index 5c388c8b9..53eef6002 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_sin.c
@@ -55,6 +55,59 @@
#include <math_private.h>
#include <fenv.h>
+/* Helper macros to compute sin of the input values. */
+#define POLYNOMIAL2(xx) ((((s5.x * (xx) + s4.x) * (xx) + s3.x) * (xx) + s2.x) \
+ * (xx))
+
+#define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1.x)
+
+/* The computed polynomial is a variation of the Taylor series expansion for
+ sin(a):
+
+ a - a^3/3! + a^5/5! - a^7/7! + a^9/9! + (1 - a^2) * da / 2
+
+ The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so
+ on. The result is returned to LHS and correction in COR. */
+#define TAYLOR_SINCOS(xx, a, da, cor) \
+({ \
+ double t = ((POLYNOMIAL (xx) * (a) - 0.5 * (da)) * (xx) + (da)); \
+ double res = (a) + t; \
+ (cor) = ((a) - res) + t; \
+ res; \
+})
+
+/* This is again a variation of the Taylor series expansion with the term
+ x^3/3! expanded into the following for better accuracy:
+
+ bb * x ^ 3 + 3 * aa * x * x1 * x2 + aa * x1 ^ 3 + aa * x2 ^ 3
+
+ The correction term is dx and bb + aa = -1/3!
+ */
+#define TAYLOR_SLOW(x0, dx, cor) \
+({ \
+ static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ \
+ double xx = (x0) * (x0); \
+ double x1 = ((x0) + th2_36) - th2_36; \
+ double y = aa.x * x1 * x1 * x1; \
+ double r = (x0) + y; \
+ double x2 = ((x0) - x1) + (dx); \
+ double t = (((POLYNOMIAL2 (xx) + bb.x) * xx + 3.0 * aa.x * x1 * x2) \
+ * (x0) + aa.x * x2 * x2 * x2 + (dx)); \
+ t = (((x0) - r) + y) + t; \
+ double res = r + t; \
+ (cor) = (r - res) + t; \
+ res; \
+})
+
+#define SINCOS_TABLE_LOOKUP(u, sn, ssn, cs, ccs) \
+({ \
+ int4 k = u.i[LOW_HALF] << 2; \
+ sn = __sincostab.x[k]; \
+ ssn = __sincostab.x[k + 1]; \
+ cs = __sincostab.x[k + 2]; \
+ ccs = __sincostab.x[k + 3]; \
+})
+
#ifndef SECTION
# define SECTION
#endif
@@ -74,10 +127,8 @@ static const double
void __dubsin (double x, double dx, double w[]);
void __docos (double x, double dx, double w[]);
-double __mpsin (double x, double dx);
-double __mpcos (double x, double dx);
-double __mpsin1 (double x);
-double __mpcos1 (double x);
+double __mpsin (double x, double dx, bool reduce_range);
+double __mpcos (double x, double dx, bool reduce_range);
static double slow (double x);
static double slow1 (double x);
static double slow2 (double x);
@@ -93,6 +144,39 @@ static double csloww (double x, double dx, double orig);
static double csloww1 (double x, double dx, double orig);
static double csloww2 (double x, double dx, double orig, int n);
+/* Reduce range of X and compute sin of a + da. K is the amount by which to
+ rotate the quadrants. This allows us to use the same routine to compute cos
+ by simply rotating the quadrants by 1. */
+static inline double
+__always_inline
+reduce_and_compute (double x, double a, double da, unsigned int k)
+{
+ double retval = 0;
+ unsigned int n = __branred (x, &a, &da);
+ k = (n + k) % 4;
+ switch (k)
+ {
+ case 0:
+ if (a * a < 0.01588)
+ retval = bsloww (a, da, x, n);
+ else
+ retval = bsloww1 (a, da, x, n);
+ break;
+ case 2:
+ if (a * a < 0.01588)
+ retval = bsloww (-a, -da, x, n);
+ else
+ retval = bsloww1 (-a, -da, x, n);
+ break;
+
+ case 1:
+ case 3:
+ retval = bsloww2 (a, da, x, n);
+ break;
+ }
+ return retval;
+}
+
/*******************************************************************/
/* An ultimate sin routine. Given an IEEE double machine number x */
/* it computes the correctly rounded (to nearest) value of sin(x) */
@@ -113,21 +197,16 @@ __sin (double x)
m = u.i[HIGH_HALF];
k = 0x7fffffff & m; /* no sign */
if (k < 0x3e500000) /* if x->0 =>sin(x)=x */
- {
- retval = x;
- goto ret;
- }
+ retval = x;
/*---------------------------- 2^-26 < |x|< 0.25 ----------------------*/
else if (k < 0x3fd00000)
{
xx = x * x;
- /*Taylor series. */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + s1.x)
- * (xx * x));
+ /* Taylor series. */
+ t = POLYNOMIAL (xx) * (xx * x);
res = x + t;
cor = (x - res) + t;
retval = (res == res + 1.07 * cor) ? res : slow (x);
- goto ret;
} /* else if (k < 0x3fd00000) */
/*---------------------------- 0.25<|x|< 0.855469---------------------- */
else if (k < 0x3feb6000)
@@ -137,16 +216,16 @@ __sin (double x)
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = (m > 0) ? __sincostab.x[k] : -__sincostab.x[k];
- ssn = (m > 0) ? __sincostab.x[k + 1] : -__sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
+ if (m <= 0)
+ {
+ sn = -sn;
+ ssn = -ssn;
+ }
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
retval = (res == res + 1.096 * cor) ? res : slow1 (x);
- goto ret;
} /* else if (k < 0x3feb6000) */
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
@@ -167,16 +246,11 @@ __sin (double x)
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ccs - s * ssn - cs * c) - sn * s;
res = cs + cor;
cor = (cs - res) + cor;
retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
- goto ret;
} /* else if (k < 0x400368fd) */
/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
@@ -204,14 +278,10 @@ __sin (double x)
}
if (xx < 0.01588)
{
- /*Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ /* Taylor series. */
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : sloww (a, da, x);
- goto ret;
}
else
{
@@ -232,18 +302,13 @@ __sin (double x)
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: sloww1 (a, da, x));
- goto ret;
}
break;
@@ -257,11 +322,7 @@ __sin (double x)
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -270,11 +331,8 @@ __sin (double x)
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: sloww2 (a, da, x, n));
- goto ret;
-
break;
}
-
} /* else if (k < 0x419921FB ) */
/*---------------------105414350 <|x|< 281474976710656 --------------------*/
@@ -307,14 +365,10 @@ __sin (double x)
}
if (xx < 0.01588)
{
- /* Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ /* Taylor series. */
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
- goto ret;
}
else
{
@@ -335,18 +389,13 @@ __sin (double x)
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: bsloww1 (a, da, x, n));
- goto ret;
}
break;
@@ -360,11 +409,7 @@ __sin (double x)
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -373,40 +418,13 @@ __sin (double x)
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: bsloww2 (a, da, x, n));
- goto ret;
-
break;
}
} /* else if (k < 0x42F00000 ) */
/* -----------------281474976710656 <|x| <2^1024----------------------------*/
else if (k < 0x7ff00000)
- {
- n = __branred (x, &a, &da);
- switch (n)
- {
- case 0:
- if (a * a < 0.01588)
- retval = bsloww (a, da, x, n);
- else
- retval = bsloww1 (a, da, x, n);
- goto ret;
- break;
- case 2:
- if (a * a < 0.01588)
- retval = bsloww (-a, -da, x, n);
- else
- retval = bsloww1 (-a, -da, x, n);
- goto ret;
- break;
-
- case 1:
- case 3:
- retval = bsloww2 (a, da, x, n);
- goto ret;
- break;
- }
- } /* else if (k < 0x7ff00000 ) */
+ retval = reduce_and_compute (x, a, da, 0);
/*--------------------- |x| > 2^1024 ----------------------------------*/
else
@@ -414,10 +432,8 @@ __sin (double x)
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
__set_errno (EDOM);
retval = x / x;
- goto ret;
}
-ret:
return retval;
}
@@ -444,11 +460,9 @@ __cos (double x)
m = u.i[HIGH_HALF];
k = 0x7fffffff & m;
+ /* |x|<2^-27 => cos(x)=1 */
if (k < 0x3e400000)
- {
- retval = 1.0;
- goto ret;
- } /* |x|<2^-27 => cos(x)=1 */
+ retval = 1.0;
else if (k < 0x3feb6000)
{ /* 2^-27 < |x| < 0.855469 */
@@ -458,16 +472,11 @@ __cos (double x)
xx = y * y;
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ccs - s * ssn - cs * c) - sn * s;
res = cs + cor;
cor = (cs - res) + cor;
retval = (res == res + 1.020 * cor) ? res : cslow2 (x);
- goto ret;
} /* else if (k < 0x3feb6000) */
else if (k < 0x400368fd)
@@ -478,13 +487,9 @@ __cos (double x)
xx = a * a;
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + s1.x)
- * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + 1.0e-31 : 1.02 * cor - 1.0e-31;
retval = (res == res + cor) ? res : csloww (a, da, x);
- goto ret;
}
else
{
@@ -505,18 +510,13 @@ __cos (double x)
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + 1.0e-31 : 1.035 * cor - 1.0e-31;
retval = ((res == res + cor) ? ((m) ? res : -res)
: csloww1 (a, da, x));
- goto ret;
}
} /* else if (k < 0x400368fd) */
@@ -546,13 +546,9 @@ __cos (double x)
}
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : csloww (a, da, x);
- goto ret;
}
else
{
@@ -573,18 +569,13 @@ __cos (double x)
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: csloww1 (a, da, x));
- goto ret;
}
break;
@@ -598,11 +589,7 @@ __cos (double x)
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -611,8 +598,6 @@ __cos (double x)
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n) ? -res : res)
: csloww2 (a, da, x, n));
- goto ret;
-
break;
}
} /* else if (k < 0x419921FB ) */
@@ -646,13 +631,9 @@ __cos (double x)
}
if (xx < 0.01588)
{
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx
- + s1.x) * a - 0.5 * da) * xx + da;
- res = a + t;
- cor = (a - res) + t;
+ res = TAYLOR_SINCOS (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
- goto ret;
}
else
{
@@ -673,18 +654,13 @@ __cos (double x)
xx = y * y;
s = y + (db + y * xx * (sn3 + xx * sn5));
c = y * db + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
: bsloww1 (a, da, x, n));
- goto ret;
}
break;
@@ -698,11 +674,7 @@ __cos (double x)
u.x = big.x + a;
y = a - (u.x - big.x) + da;
xx = y * y;
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
s = y + y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
cor = (ccs - s * ssn - cs * c) - sn * s;
@@ -711,49 +683,21 @@ __cos (double x)
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
retval = ((res == res + cor) ? ((n) ? -res : res)
: bsloww2 (a, da, x, n));
- goto ret;
break;
}
} /* else if (k < 0x42F00000 ) */
+ /* 281474976710656 <|x| <2^1024 */
else if (k < 0x7ff00000)
- { /* 281474976710656 <|x| <2^1024 */
-
- n = __branred (x, &a, &da);
- switch (n)
- {
- case 1:
- if (a * a < 0.01588)
- retval = bsloww (-a, -da, x, n);
- else
- retval = bsloww1 (-a, -da, x, n);
- goto ret;
- break;
- case 3:
- if (a * a < 0.01588)
- retval = bsloww (a, da, x, n);
- else
- retval = bsloww1 (a, da, x, n);
- goto ret;
- break;
-
- case 0:
- case 2:
- retval = bsloww2 (a, da, x, n);
- goto ret;
- break;
- }
- } /* else if (k < 0x7ff00000 ) */
+ retval = reduce_and_compute (x, a, da, 1);
else
{
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
__set_errno (EDOM);
retval = x / x; /* |x| > 2^1024 */
- goto ret;
}
-ret:
return retval;
}
@@ -766,18 +710,8 @@ static double
SECTION
slow (double x)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2];
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = x - x1;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ double res, cor, w[2];
+ res = TAYLOR_SLOW (x, 0, cor);
if (res == res + 1.0007 * cor)
return res;
else
@@ -786,12 +720,12 @@ slow (double x)
if (w[0] == w[0] + 1.000000001 * w[1])
return (x > 0) ? w[0] : -w[0];
else
- return (x > 0) ? __mpsin (x, 0) : -__mpsin (-x, 0);
+ return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
}
/*******************************************************************************/
-/* Routine compute sin(x) for 0.25<|x|< 0.855469 by __sincostab.tbl and Taylor */
+/* Routine compute sin(x) for 0.25<|x|< 0.855469 by __sincostab.tbl and Taylor */
/* and if result still doesn't accurate enough by mpsin or dubsin */
/*******************************************************************************/
@@ -802,18 +736,13 @@ slow1 (double x)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
y = y - (u.x - big.x);
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k]; /* Data */
- ssn = __sincostab.x[k + 1]; /* from */
- cs = __sincostab.x[k + 2]; /* tables */
- ccs = __sincostab.x[k + 3]; /* __sincostab.tbl */
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = y - y1;
c1 = (cs + t22) - t22;
@@ -831,7 +760,7 @@ slow1 (double x)
if (w[0] == w[0] + 1.000000005 * w[1])
return (x > 0) ? w[0] : -w[0];
else
- return (x > 0) ? __mpsin (x, 0) : -__mpsin (-x, 0);
+ return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
}
@@ -846,7 +775,6 @@ slow2 (double x)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res, del;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
y = hp0.x - y;
if (y >= 0)
@@ -864,11 +792,7 @@ slow2 (double x)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * del + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + del;
e1 = (sn + t22) - t22;
@@ -889,7 +813,7 @@ slow2 (double x)
if (w[0] == w[0] + 1.000000005 * w[1])
return (x > 0) ? w[0] : -w[0];
else
- return (x > 0) ? __mpsin (x, 0) : -__mpsin (-x, 0);
+ return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
}
@@ -905,24 +829,14 @@ static double
SECTION
sloww (double x, double dx, double orig)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2], a, da, xn;
+ double y, t, res, cor, w[2], a, da, xn;
union
{
int4 i[2];
double x;
} v;
int4 n;
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ res = TAYLOR_SLOW (x, dx, cor);
cor =
(cor >
0) ? 1.0005 * cor + ABS (orig) * 3.1e-30 : 1.0005 * cor -
@@ -966,7 +880,7 @@ sloww (double x, double dx, double orig)
if (w[0] == w[0] + cor)
return (a > 0) ? w[0] : -w[0];
else
- return __mpsin1 (orig);
+ return __mpsin (orig, 0, true);
}
}
}
@@ -985,7 +899,6 @@ sloww1 (double x, double dx, double orig)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -994,11 +907,7 @@ sloww1 (double x, double dx, double orig)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1028,7 +937,7 @@ sloww1 (double x, double dx, double orig)
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
else
- return __mpsin1 (orig);
+ return __mpsin (orig, 0, true);
}
}
@@ -1046,7 +955,6 @@ sloww2 (double x, double dx, double orig, int n)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1055,11 +963,7 @@ sloww2 (double x, double dx, double orig, int n)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
@@ -1090,7 +994,7 @@ sloww2 (double x, double dx, double orig, int n)
if (w[0] == w[0] + cor)
return (n & 2) ? -w[0] : w[0];
else
- return __mpsin1 (orig);
+ return __mpsin (orig, 0, true);
}
}
@@ -1106,19 +1010,9 @@ static double
SECTION
bsloww (double x, double dx, double orig, int n)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2];
-
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ double res, cor, w[2];
+
+ res = TAYLOR_SLOW (x, dx, cor);
cor = (cor > 0) ? 1.0005 * cor + 1.1e-24 : 1.0005 * cor - 1.1e-24;
if (res == res + cor)
return res;
@@ -1132,7 +1026,7 @@ bsloww (double x, double dx, double orig, int n)
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
else
- return (n & 1) ? __mpcos1 (orig) : __mpsin1 (orig);
+ return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
}
@@ -1150,7 +1044,6 @@ bsloww1 (double x, double dx, double orig, int n)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1159,11 +1052,7 @@ bsloww1 (double x, double dx, double orig, int n)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1188,7 +1077,7 @@ bsloww1 (double x, double dx, double orig, int n)
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
else
- return (n & 1) ? __mpcos1 (orig) : __mpsin1 (orig);
+ return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
}
@@ -1206,7 +1095,6 @@ bsloww2 (double x, double dx, double orig, int n)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1215,11 +1103,7 @@ bsloww2 (double x, double dx, double orig, int n)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
@@ -1245,7 +1129,7 @@ bsloww2 (double x, double dx, double orig, int n)
if (w[0] == w[0] + cor)
return (n & 2) ? -w[0] : w[0];
else
- return (n & 1) ? __mpsin1 (orig) : __mpcos1 (orig);
+ return (n & 1) ? __mpsin (orig, 0, true) : __mpcos (orig, 0, true);
}
}
@@ -1261,7 +1145,6 @@ cslow2 (double x)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1269,11 +1152,7 @@ cslow2 (double x)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = y - y1;
e1 = (sn + t22) - t22;
@@ -1292,7 +1171,7 @@ cslow2 (double x)
if (w[0] == w[0] + 1.000000005 * w[1])
return w[0];
else
- return __mpcos (x, 0);
+ return __mpcos (x, 0, false);
}
}
@@ -1308,8 +1187,7 @@ static double
SECTION
csloww (double x, double dx, double orig)
{
- static const double th2_36 = 206158430208.0; /* 1.5*2**37 */
- double y, x1, x2, xx, r, t, res, cor, w[2], a, da, xn;
+ double y, t, res, cor, w[2], a, da, xn;
union
{
int4 i[2];
@@ -1317,17 +1195,8 @@ csloww (double x, double dx, double orig)
} v;
int4 n;
- x1 = (x + th2_36) - th2_36;
- y = aa.x * x1 * x1 * x1;
- r = x + y;
- x2 = (x - x1) + dx;
- xx = x * x;
/* Taylor series */
- t = (((((s5.x * xx + s4.x) * xx + s3.x) * xx + s2.x) * xx + bb.x) * xx
- + 3.0 * aa.x * x1 * x2) * x + aa.x * x2 * x2 * x2 + dx;
- t = ((x - r) + y) + t;
- res = r + t;
- cor = (r - res) + t;
+ t = TAYLOR_SLOW (x, dx, cor);
if (cor > 0)
cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
@@ -1375,7 +1244,7 @@ csloww (double x, double dx, double orig)
if (w[0] == w[0] + cor)
return (a > 0) ? w[0] : -w[0];
else
- return __mpcos1 (orig);
+ return __mpcos (orig, 0, true);
}
}
}
@@ -1394,7 +1263,6 @@ csloww1 (double x, double dx, double orig)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, c1, c2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1403,11 +1271,7 @@ csloww1 (double x, double dx, double orig)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
c1 = (cs + t22) - t22;
@@ -1435,7 +1299,7 @@ csloww1 (double x, double dx, double orig)
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
else
- return __mpcos1 (orig);
+ return __mpcos (orig, 0, true);
}
}
@@ -1454,7 +1318,6 @@ csloww2 (double x, double dx, double orig, int n)
mynumber u;
double sn, ssn, cs, ccs, s, c, w[2], y, y1, y2, e1, e2, xx, cor, res;
static const double t22 = 6291456.0;
- int4 k;
y = ABS (x);
u.x = big.x + y;
@@ -1463,11 +1326,7 @@ csloww2 (double x, double dx, double orig, int n)
xx = y * y;
s = y * xx * (sn3 + xx * sn5);
c = y * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
- k = u.i[LOW_HALF] << 2;
- sn = __sincostab.x[k];
- ssn = __sincostab.x[k + 1];
- cs = __sincostab.x[k + 2];
- ccs = __sincostab.x[k + 3];
+ SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
y1 = (y + t22) - t22;
y2 = (y - y1) + dx;
@@ -1496,7 +1355,7 @@ csloww2 (double x, double dx, double orig, int n)
if (w[0] == w[0] + cor)
return (n) ? -w[0] : w[0];
else
- return __mpcos1 (orig);
+ return __mpcos (orig, 0, true);
}
}
diff --git a/libc/sysdeps/ieee754/dbl-64/s_sincos.c b/libc/sysdeps/ieee754/dbl-64/s_sincos.c
index b6d5432f4..01d1bdf97 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -32,7 +32,7 @@ __sincos (double x, double *sinx, double *cosx)
/* |x| ~< pi/4 */
ix &= 0x7fffffff;
- if (ix>=0x7ff00000)
+ if (ix >= 0x7ff00000)
{
/* sin(Inf or NaN) is NaN */
*sinx = *cosx = x - x;
diff --git a/libc/sysdeps/ieee754/dbl-64/s_tan.c b/libc/sysdeps/ieee754/dbl-64/s_tan.c
index 54f863e54..09db096d0 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_tan.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_tan.c
@@ -41,6 +41,7 @@
#include <math.h>
#include <math_private.h>
#include <fenv.h>
+#include <stap-probe.h>
#ifndef SECTION
# define SECTION
@@ -58,8 +59,8 @@ tan (double x)
int ux, i, n;
double a, da, a2, b, db, c, dc, c1, cc1, c2, cc2, c3, cc3, fi, ffi, gi, pz,
- s, sy, t, t1, t2, t3, t4, t7, t8, t9, t10, w, x2, xn, xx2, y, ya, yya, z0,
- z, zz, z2, zz2;
+ s, sy, t, t1, t2, t3, t4, t7, t8, t9, t10, w, x2, xn, xx2, y, ya,
+ yya, z0, z, zz, z2, zz2;
#ifndef DLA_FMS
double t5, t6;
#endif
@@ -97,7 +98,6 @@ tan (double x)
/* (II) The case 1.259e-8 < abs(x) <= 0.0608 */
if (w <= g2.d)
{
-
/* First stage */
x2 = x * x;
@@ -149,7 +149,6 @@ tan (double x)
/* (III) The case 0.0608 < abs(x) <= 0.787 */
if (w <= g3.d)
{
-
/* First stage */
i = ((int) (mfftnhf.d + TWO8 * w));
z = w - xfg[i][0].d;
@@ -376,7 +375,7 @@ tan (double x)
/* Second stage */
ffi = xfg[i][3].d;
EADD (z0, yya, z, zz)
- MUL2 (z, zz, z, zz, z2, zz2, t1, t2, t3, t4, t5, t6, t7, t8);
+ MUL2 (z, zz, z, zz, z2, zz2, t1, t2, t3, t4, t5, t6, t7, t8);
c1 = z2 * (a7.d + z2 * (a9.d + z2 * a11.d));
ADD2 (a5.d, aa5.d, c1, 0.0, c2, cc2, t1, t2);
MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2, t3, t4, t5, t6, t7, t8);
@@ -838,6 +837,7 @@ tanMp (double x)
p = 32;
__mptan (x, &mpy, p);
__mp_dbl (&mpy, &y, p);
+ LIBC_PROBE (slowtan, 2, &x, &y);
return y;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/s_tanh.c b/libc/sysdeps/ieee754/dbl-64/s_tanh.c
index ded0d6025..23cfcdead 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_tanh.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_tanh.c
@@ -41,41 +41,51 @@ static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
#include <math.h>
#include <math_private.h>
-static const double one=1.0, two=2.0, tiny = 1.0e-300;
+static const double one = 1.0, two = 2.0, tiny = 1.0e-300;
-double __tanh(double x)
+double
+__tanh (double x)
{
- double t,z;
- int32_t jx,ix,lx;
+ double t, z;
+ int32_t jx, ix, lx;
- /* High word of |x|. */
- EXTRACT_WORDS(jx,lx,x);
- ix = jx&0x7fffffff;
+ /* High word of |x|. */
+ EXTRACT_WORDS (jx, lx, x);
+ ix = jx & 0x7fffffff;
- /* x is INF or NaN */
- if(ix>=0x7ff00000) {
- if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */
- else return one/x-one; /* tanh(NaN) = NaN */
- }
+ /* x is INF or NaN */
+ if (ix >= 0x7ff00000)
+ {
+ if (jx >= 0)
+ return one / x + one; /* tanh(+-inf)=+-1 */
+ else
+ return one / x - one; /* tanh(NaN) = NaN */
+ }
- /* |x| < 22 */
- if (ix < 0x40360000) { /* |x|<22 */
- if ((ix | lx) == 0)
- return x; /* x == +-0 */
- if (ix<0x3c800000) /* |x|<2**-55 */
- return x*(one+x); /* tanh(small) = small */
- if (ix>=0x3ff00000) { /* |x|>=1 */
- t = __expm1(two*fabs(x));
- z = one - two/(t+two);
- } else {
- t = __expm1(-two*fabs(x));
- z= -t/(t+two);
- }
- /* |x| > 22, return +-1 */
- } else {
- z = one - tiny; /* raised inexact flag */
+ /* |x| < 22 */
+ if (ix < 0x40360000) /* |x|<22 */
+ {
+ if ((ix | lx) == 0)
+ return x; /* x == +-0 */
+ if (ix < 0x3c800000) /* |x|<2**-55 */
+ return x * (one + x); /* tanh(small) = small */
+ if (ix >= 0x3ff00000) /* |x|>=1 */
+ {
+ t = __expm1 (two * fabs (x));
+ z = one - two / (t + two);
+ }
+ else
+ {
+ t = __expm1 (-two * fabs (x));
+ z = -t / (t + two);
}
- return (jx>=0)? z: -z;
+ /* |x| > 22, return +-1 */
+ }
+ else
+ {
+ z = one - tiny; /* raised inexact flag */
+ }
+ return (jx >= 0) ? z : -z;
}
weak_alias (__tanh, tanh)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/ieee754/dbl-64/sincos32.c b/libc/sysdeps/ieee754/dbl-64/sincos32.c
index 954db66d6..f253b8ce8 100644
--- a/libc/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/libc/sysdeps/ieee754/dbl-64/sincos32.c
@@ -48,312 +48,318 @@
# define SECTION
#endif
-/****************************************************************/
-/* Compute Multi-Precision sin() function for given p. Receive */
-/* Multi Precision number x and result stored at y */
-/****************************************************************/
+/* Compute Multi-Precision sin() function for given p. Receive Multi Precision
+ number x and result stored at y. */
static void
SECTION
-ss32(mp_no *x, mp_no *y, int p) {
+ss32 (mp_no *x, mp_no *y, int p)
+{
int i;
double a;
- mp_no mpt1,x2,gor,sum ,mpk={1,{1.0}};
- for (i=1;i<=p;i++) mpk.d[i]=0;
+ mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}};
+ for (i = 1; i <= p; i++)
+ mpk.d[i] = 0;
- __sqr(x,&x2,p);
- __cpy(&oofac27,&gor,p);
- __cpy(&gor,&sum,p);
- for (a=27.0;a>1.0;a-=2.0) {
- mpk.d[1]=a*(a-1.0);
- __mul(&gor,&mpk,&mpt1,p);
- __cpy(&mpt1,&gor,p);
- __mul(&x2,&sum,&mpt1,p);
- __sub(&gor,&mpt1,&sum,p);
- }
- __mul(x,&sum,y,p);
+ __sqr (x, &x2, p);
+ __cpy (&oofac27, &gor, p);
+ __cpy (&gor, &sum, p);
+ for (a = 27.0; a > 1.0; a -= 2.0)
+ {
+ mpk.d[1] = a * (a - 1.0);
+ __mul (&gor, &mpk, &mpt1, p);
+ __cpy (&mpt1, &gor, p);
+ __mul (&x2, &sum, &mpt1, p);
+ __sub (&gor, &mpt1, &sum, p);
+ }
+ __mul (x, &sum, y, p);
}
-/**********************************************************************/
-/* Compute Multi-Precision cos() function for given p. Receive Multi */
-/* Precision number x and result stored at y */
-/**********************************************************************/
+/* Compute Multi-Precision cos() function for given p. Receive Multi Precision
+ number x and result stored at y. */
static void
SECTION
-cc32(mp_no *x, mp_no *y, int p) {
+cc32 (mp_no *x, mp_no *y, int p)
+{
int i;
double a;
- mp_no mpt1,x2,gor,sum ,mpk={1,{1.0}};
- for (i=1;i<=p;i++) mpk.d[i]=0;
+ mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}};
+ for (i = 1; i <= p; i++)
+ mpk.d[i] = 0;
- __sqr(x,&x2,p);
- mpk.d[1]=27.0;
- __mul(&oofac27,&mpk,&gor,p);
- __cpy(&gor,&sum,p);
- for (a=26.0;a>2.0;a-=2.0) {
- mpk.d[1]=a*(a-1.0);
- __mul(&gor,&mpk,&mpt1,p);
- __cpy(&mpt1,&gor,p);
- __mul(&x2,&sum,&mpt1,p);
- __sub(&gor,&mpt1,&sum,p);
- }
- __mul(&x2,&sum,y,p);
+ __sqr (x, &x2, p);
+ mpk.d[1] = 27.0;
+ __mul (&oofac27, &mpk, &gor, p);
+ __cpy (&gor, &sum, p);
+ for (a = 26.0; a > 2.0; a -= 2.0)
+ {
+ mpk.d[1] = a * (a - 1.0);
+ __mul (&gor, &mpk, &mpt1, p);
+ __cpy (&mpt1, &gor, p);
+ __mul (&x2, &sum, &mpt1, p);
+ __sub (&gor, &mpt1, &sum, p);
+ }
+ __mul (&x2, &sum, y, p);
}
-/***************************************************************************/
-/* c32() computes both sin(x), cos(x) as Multi precision numbers */
-/***************************************************************************/
+/* Compute both sin(x), cos(x) as Multi precision numbers. */
void
SECTION
-__c32(mp_no *x, mp_no *y, mp_no *z, int p) {
- mp_no u,t,t1,t2,c,s;
+__c32 (mp_no *x, mp_no *y, mp_no *z, int p)
+{
+ mp_no u, t, t1, t2, c, s;
int i;
- __cpy(x,&u,p);
- u.e=u.e-1;
- cc32(&u,&c,p);
- ss32(&u,&s,p);
- for (i=0;i<24;i++) {
- __mul(&c,&s,&t,p);
- __sub(&s,&t,&t1,p);
- __add(&t1,&t1,&s,p);
- __sub(&mptwo,&c,&t1,p);
- __mul(&t1,&c,&t2,p);
- __add(&t2,&t2,&c,p);
- }
- __sub(&mpone,&c,y,p);
- __cpy(&s,z,p);
+ __cpy (x, &u, p);
+ u.e = u.e - 1;
+ cc32 (&u, &c, p);
+ ss32 (&u, &s, p);
+ for (i = 0; i < 24; i++)
+ {
+ __mul (&c, &s, &t, p);
+ __sub (&s, &t, &t1, p);
+ __add (&t1, &t1, &s, p);
+ __sub (&mptwo, &c, &t1, p);
+ __mul (&t1, &c, &t2, p);
+ __add (&t2, &t2, &c, p);
+ }
+ __sub (&mpone, &c, y, p);
+ __cpy (&s, z, p);
}
-/************************************************************************/
-/*Routine receive double x and two double results of sin(x) and return */
-/*result which is more accurate */
-/*Computing sin(x) with multi precision routine c32 */
-/************************************************************************/
+/* Receive double x and two double results of sin(x) and return result which is
+ more accurate, computing sin(x) with multi precision routine c32. */
double
SECTION
-__sin32(double x, double res, double res1) {
+__sin32 (double x, double res, double res1)
+{
int p;
- mp_no a,b,c;
- p=32;
- __dbl_mp(res,&a,p);
- __dbl_mp(0.5*(res1-res),&b,p);
- __add(&a,&b,&c,p);
- if (x>0.8)
- { __sub(&hp,&c,&a,p);
- __c32(&a,&b,&c,p);
- }
- else __c32(&c,&a,&b,p); /* b=sin(0.5*(res+res1)) */
- __dbl_mp(x,&c,p); /* c = x */
- __sub(&b,&c,&a,p);
- /* if a>0 return min(res,res1), otherwise return max(res,res1) */
- if (a.d[0]>0) return (res<res1)?res:res1;
- else return (res>res1)?res:res1;
+ mp_no a, b, c;
+ p = 32;
+ __dbl_mp (res, &a, p);
+ __dbl_mp (0.5 * (res1 - res), &b, p);
+ __add (&a, &b, &c, p);
+ if (x > 0.8)
+ {
+ __sub (&hp, &c, &a, p);
+ __c32 (&a, &b, &c, p);
+ }
+ else
+ __c32 (&c, &a, &b, p); /* b=sin(0.5*(res+res1)) */
+ __dbl_mp (x, &c, p); /* c = x */
+ __sub (&b, &c, &a, p);
+ /* if a > 0 return min (res, res1), otherwise return max (res, res1). */
+ if (a.d[0] > 0)
+ return (res < res1) ? res : res1;
+ else
+ return (res > res1) ? res : res1;
}
-/************************************************************************/
-/*Routine receive double x and two double results of cos(x) and return */
-/*result which is more accurate */
-/*Computing cos(x) with multi precision routine c32 */
-/************************************************************************/
+/* Receive double x and two double results of cos(x) and return result which is
+ more accurate, computing cos(x) with multi precision routine c32. */
double
SECTION
-__cos32(double x, double res, double res1) {
+__cos32 (double x, double res, double res1)
+{
int p;
- mp_no a,b,c;
- p=32;
- __dbl_mp(res,&a,p);
- __dbl_mp(0.5*(res1-res),&b,p);
- __add(&a,&b,&c,p);
- if (x>2.4)
- { __sub(&pi,&c,&a,p);
- __c32(&a,&b,&c,p);
- b.d[0]=-b.d[0];
- }
- else if (x>0.8)
- { __sub(&hp,&c,&a,p);
- __c32(&a,&c,&b,p);
- }
- else __c32(&c,&b,&a,p); /* b=cos(0.5*(res+res1)) */
- __dbl_mp(x,&c,p); /* c = x */
- __sub(&b,&c,&a,p);
- /* if a>0 return max(res,res1), otherwise return min(res,res1) */
- if (a.d[0]>0) return (res>res1)?res:res1;
- else return (res<res1)?res:res1;
+ mp_no a, b, c;
+ p = 32;
+ __dbl_mp (res, &a, p);
+ __dbl_mp (0.5 * (res1 - res), &b, p);
+ __add (&a, &b, &c, p);
+ if (x > 2.4)
+ {
+ __sub (&pi, &c, &a, p);
+ __c32 (&a, &b, &c, p);
+ b.d[0] = -b.d[0];
+ }
+ else if (x > 0.8)
+ {
+ __sub (&hp, &c, &a, p);
+ __c32 (&a, &c, &b, p);
+ }
+ else
+ __c32 (&c, &b, &a, p); /* b=cos(0.5*(res+res1)) */
+ __dbl_mp (x, &c, p); /* c = x */
+ __sub (&b, &c, &a, p);
+ /* if a > 0 return max (res, res1), otherwise return min (res, res1). */
+ if (a.d[0] > 0)
+ return (res > res1) ? res : res1;
+ else
+ return (res < res1) ? res : res1;
}
-/*******************************************************************/
-/*Compute sin(x+dx) as Multi Precision number and return result as */
-/* double */
-/*******************************************************************/
+/* Compute sin() of double-length number (X + DX) as Multi Precision number and
+ return result as double. If REDUCE_RANGE is true, X is assumed to be the
+ original input and DX is ignored. */
double
SECTION
-__mpsin(double x, double dx) {
- int p;
+__mpsin (double x, double dx, bool reduce_range)
+{
double y;
- mp_no a,b,c;
- p=32;
- __dbl_mp(x,&a,p);
- __dbl_mp(dx,&b,p);
- __add(&a,&b,&c,p);
- if (x>0.8) { __sub(&hp,&c,&a,p); __c32(&a,&b,&c,p); }
- else __c32(&c,&a,&b,p); /* b = sin(x+dx) */
- __mp_dbl(&b,&y,p);
- return y;
-}
+ mp_no a, b, c, s;
+ int n;
+ int p = 32;
-/*******************************************************************/
-/* Compute cos()of double-length number (x+dx) as Multi Precision */
-/* number and return result as double */
-/*******************************************************************/
-double
-SECTION
-__mpcos(double x, double dx) {
- int p;
- double y;
- mp_no a,b,c;
- p=32;
- __dbl_mp(x,&a,p);
- __dbl_mp(dx,&b,p);
- __add(&a,&b,&c,p);
- if (x>0.8)
- { __sub(&hp,&c,&b,p);
- __c32(&b,&c,&a,p);
- }
- else __c32(&c,&a,&b,p); /* a = cos(x+dx) */
- __mp_dbl(&a,&y,p);
- return y;
-}
+ if (reduce_range)
+ {
+ n = __mpranred (x, &a, p); /* n is 0, 1, 2 or 3. */
+ __c32 (&a, &c, &s, p);
+ }
+ else
+ {
+ n = -1;
+ __dbl_mp (x, &b, p);
+ __dbl_mp (dx, &c, p);
+ __add (&b, &c, &a, p);
+ if (x > 0.8)
+ {
+ __sub (&hp, &a, &b, p);
+ __c32 (&b, &s, &c, p);
+ }
+ else
+ __c32 (&a, &c, &s, p); /* b = sin(x+dx) */
+ }
-/******************************************************************/
-/* mpranred() performs range reduction of a double number x into */
-/* multi precision number y, such that y=x-n*pi/2, abs(y)<pi/4, */
-/* n=0,+-1,+-2,.... */
-/* Return int which indicates in which quarter of circle x is */
-/******************************************************************/
-int
-SECTION
-__mpranred(double x, mp_no *y, int p)
-{
- number v;
- double t,xn;
- int i,k,n;
- mp_no a,b,c;
+ /* Convert result based on which quarter of unit circle y is in. */
+ switch (n)
+ {
+ case 1:
+ __mp_dbl (&c, &y, p);
+ break;
+
+ case 3:
+ __mp_dbl (&c, &y, p);
+ y = -y;
+ break;
+
+ case 2:
+ __mp_dbl (&s, &y, p);
+ y = -y;
+ break;
- if (ABS(x) < 2.8e14) {
- t = (x*hpinv.d + toint.d);
- xn = t - toint.d;
- v.d = t;
- n =v.i[LOW_HALF]&3;
- __dbl_mp(xn,&a,p);
- __mul(&a,&hp,&b,p);
- __dbl_mp(x,&c,p);
- __sub(&c,&b,y,p);
- return n;
- }
- else { /* if x is very big more precision required */
- __dbl_mp(x,&a,p);
- a.d[0]=1.0;
- k = a.e-5;
- if (k < 0) k=0;
- b.e = -k;
- b.d[0] = 1.0;
- for (i=0;i<p;i++) b.d[i+1] = toverp[i+k];
- __mul(&a,&b,&c,p);
- t = c.d[c.e];
- for (i=1;i<=p-c.e;i++) c.d[i]=c.d[i+c.e];
- for (i=p+1-c.e;i<=p;i++) c.d[i]=0;
- c.e=0;
- if (c.d[1] >= HALFRAD)
- { t +=1.0;
- __sub(&c,&mpone,&b,p);
- __mul(&b,&hp,y,p);
+ /* Quadrant not set, so the result must be sin (X + DX), which is also in
+ S. */
+ case 0:
+ default:
+ __mp_dbl (&s, &y, p);
}
- else __mul(&c,&hp,y,p);
- n = (int) t;
- if (x < 0) { y->d[0] = - y->d[0]; n = -n; }
- return (n&3);
- }
+ return y;
}
-/*******************************************************************/
-/* Multi-Precision sin() function subroutine, for p=32. It is */
-/* based on the routines mpranred() and c32(). */
-/*******************************************************************/
+/* Compute cos() of double-length number (X + DX) as Multi Precision number and
+ return result as double. If REDUCE_RANGE is true, X is assumed to be the
+ original input and DX is ignored. */
double
SECTION
-__mpsin1(double x)
+__mpcos (double x, double dx, bool reduce_range)
{
- int p;
- int n;
- mp_no u,s,c;
double y;
- p=32;
- n=__mpranred(x,&u,p); /* n is 0, 1, 2 or 3 */
- __c32(&u,&c,&s,p);
- switch (n) { /* in which quarter of unit circle y is*/
- case 0:
- __mp_dbl(&s,&y,p);
- return y;
- break;
+ mp_no a, b, c, s;
+ int n;
+ int p = 32;
- case 2:
- __mp_dbl(&s,&y,p);
- return -y;
- break;
+ if (reduce_range)
+ {
+ n = __mpranred (x, &a, p); /* n is 0, 1, 2 or 3. */
+ __c32 (&a, &c, &s, p);
+ }
+ else
+ {
+ n = -1;
+ __dbl_mp (x, &b, p);
+ __dbl_mp (dx, &c, p);
+ __add (&b, &c, &a, p);
+ if (x > 0.8)
+ {
+ __sub (&hp, &a, &b, p);
+ __c32 (&b, &s, &c, p);
+ }
+ else
+ __c32 (&a, &c, &s, p); /* a = cos(x+dx) */
+ }
- case 1:
- __mp_dbl(&c,&y,p);
- return y;
- break;
+ /* Convert result based on which quarter of unit circle y is in. */
+ switch (n)
+ {
+ case 1:
+ __mp_dbl (&s, &y, p);
+ y = -y;
+ break;
- case 3:
- __mp_dbl(&c,&y,p);
- return -y;
- break;
+ case 3:
+ __mp_dbl (&s, &y, p);
+ break;
- }
- return 0; /* unreachable, to make the compiler happy */
-}
+ case 2:
+ __mp_dbl (&c, &y, p);
+ y = -y;
+ break;
-/*****************************************************************/
-/* Multi-Precision cos() function subroutine, for p=32. It is */
-/* based on the routines mpranred() and c32(). */
-/*****************************************************************/
+ /* Quadrant not set, so the result must be cos (X + DX), which is also
+ stored in C. */
+ case 0:
+ default:
+ __mp_dbl (&c, &y, p);
+ }
+ return y;
+}
-double
+/* Perform range reduction of a double number x into multi precision number y,
+ such that y = x - n * pi / 2, abs (y) < pi / 4, n = 0, +-1, +-2, ...
+ Return int which indicates in which quarter of circle x is. */
+int
SECTION
-__mpcos1(double x)
+__mpranred (double x, mp_no *y, int p)
{
- int p;
- int n;
- mp_no u,s,c;
- double y;
-
- p=32;
- n=__mpranred(x,&u,p); /* n is 0, 1, 2 or 3 */
- __c32(&u,&c,&s,p);
- switch (n) { /* in what quarter of unit circle y is*/
-
- case 0:
- __mp_dbl(&c,&y,p);
- return y;
- break;
-
- case 2:
- __mp_dbl(&c,&y,p);
- return -y;
- break;
-
- case 1:
- __mp_dbl(&s,&y,p);
- return -y;
- break;
-
- case 3:
- __mp_dbl(&s,&y,p);
- return y;
- break;
+ number v;
+ double t, xn;
+ int i, k, n;
+ mp_no a, b, c;
- }
- return 0; /* unreachable, to make the compiler happy */
+ if (ABS (x) < 2.8e14)
+ {
+ t = (x * hpinv.d + toint.d);
+ xn = t - toint.d;
+ v.d = t;
+ n = v.i[LOW_HALF] & 3;
+ __dbl_mp (xn, &a, p);
+ __mul (&a, &hp, &b, p);
+ __dbl_mp (x, &c, p);
+ __sub (&c, &b, y, p);
+ return n;
+ }
+ else
+ {
+ /* If x is very big more precision required. */
+ __dbl_mp (x, &a, p);
+ a.d[0] = 1.0;
+ k = a.e - 5;
+ if (k < 0)
+ k = 0;
+ b.e = -k;
+ b.d[0] = 1.0;
+ for (i = 0; i < p; i++)
+ b.d[i + 1] = toverp[i + k];
+ __mul (&a, &b, &c, p);
+ t = c.d[c.e];
+ for (i = 1; i <= p - c.e; i++)
+ c.d[i] = c.d[i + c.e];
+ for (i = p + 1 - c.e; i <= p; i++)
+ c.d[i] = 0;
+ c.e = 0;
+ if (c.d[1] >= HALFRAD)
+ {
+ t += 1.0;
+ __sub (&c, &mpone, &b, p);
+ __mul (&b, &hp, y, p);
+ }
+ else
+ __mul (&c, &hp, y, p);
+ n = (int) t;
+ if (x < 0)
+ {
+ y->d[0] = -y->d[0];
+ n = -n;
+ }
+ return (n & 3);
+ }
}
-/******************************************************************/
diff --git a/libc/sysdeps/ieee754/dbl-64/slowexp.c b/libc/sysdeps/ieee754/dbl-64/slowexp.c
index 8f353f634..525224f44 100644
--- a/libc/sysdeps/ieee754/dbl-64/slowexp.c
+++ b/libc/sysdeps/ieee754/dbl-64/slowexp.c
@@ -29,6 +29,8 @@
/**************************************************************************/
#include <math_private.h>
+#include <stap-probe.h>
+
#ifndef USE_LONG_DOUBLE_FOR_MP
# include "mpa.h"
void __mpexp (mp_no *x, mp_no *y, int p);
@@ -60,13 +62,22 @@ __slowexp (double x)
__mp_dbl (&mpw, &w, p);
__mp_dbl (&mpz, &z, p);
if (w == z)
- return w;
+ {
+ /* Track how often we get to the slow exp code plus
+ its input/output values. */
+ LIBC_PROBE (slowexp_p6, 2, &x, &w);
+ return w;
+ }
else
{
p = 32;
__dbl_mp (x, &mpx, p);
__mpexp (&mpx, &mpy, p);
__mp_dbl (&mpy, &res, p);
+
+ /* Track how often we get to the uber-slow exp code plus
+ its input/output values. */
+ LIBC_PROBE (slowexp_p32, 2, &x, &res);
return res;
}
#else
diff --git a/libc/sysdeps/ieee754/dbl-64/slowpow.c b/libc/sysdeps/ieee754/dbl-64/slowpow.c
index a379728b1..d200c39e5 100644
--- a/libc/sysdeps/ieee754/dbl-64/slowpow.c
+++ b/libc/sysdeps/ieee754/dbl-64/slowpow.c
@@ -34,6 +34,8 @@
#include "mpa.h"
#include <math_private.h>
+#include <stap-probe.h>
+
#ifndef SECTION
# define SECTION
#endif
@@ -97,7 +99,12 @@ __slowpow (double x, double y, double z)
__sub (&mpp, &eps, &mpr1, p);
__mp_dbl (&mpr1, &res1, p);
if (res == res1)
- return res;
+ {
+ /* Track how often we get to the slow pow code plus
+ its input/output values. */
+ LIBC_PROBE (slowpow_p10, 4, &x, &y, &z, &res);
+ return res;
+ }
/* If we don't, then we repeat using a higher precision. 768 bits of
precision ought to be enough for anybody. */
@@ -109,5 +116,10 @@ __slowpow (double x, double y, double z)
__mul (&mpy, &mpz, &mpw, p);
__mpexp (&mpw, &mpp, p);
__mp_dbl (&mpp, &res, p);
+
+ /* Track how often we get to the uber-slow pow code plus
+ its input/output values. */
+ LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res);
+
return res;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128/printf_fphex.c b/libc/sysdeps/ieee754/ldbl-128/printf_fphex.c
index c9e09a4b7..e82228a53 100644
--- a/libc/sysdeps/ieee754/ldbl-128/printf_fphex.c
+++ b/libc/sysdeps/ieee754/ldbl-128/printf_fphex.c
@@ -24,13 +24,15 @@ do { \
digits we use only the implicit digits for the number before \
the decimal point. */ \
unsigned long long int num0, num1; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
assert (sizeof (long double) == 16); \
\
- num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
- num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \
- | fpnum.ldbl.ieee.mantissa3); \
+ num0 = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
+ num1 = (((unsigned long long int) u.ieee.mantissa2) << 32 \
+ | u.ieee.mantissa3); \
\
zero_mantissa = (num0|num1) == 0; \
\
@@ -75,9 +77,9 @@ do { \
*--wnumstr = L'0'; \
} \
\
- leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \
+ leading = u.ieee.exponent == 0 ? '0' : '1'; \
\
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
if (exponent == 0) \
{ \
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
index abc78a35b..8a4a5bb7b 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
@@ -36,8 +36,12 @@ __ieee754_acoshl(long double x)
{
long double t;
int64_t hx;
- u_int64_t lx;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ uint64_t lx;
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
if(hx<0x3ff0000000000000LL) { /* x < 1 */
return (x-x)/(x-x);
} else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
index 5d2af3034..2cb288238 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
@@ -151,26 +151,27 @@ static const long double
long double
__ieee754_acosl (long double x)
{
- long double z, r, w, p, q, s, t, f2;
- ieee854_long_double_shape_type u;
+ long double a, z, r, w, p, q, s, t, f2;
- u.value = __builtin_fabsl (x);
- if (u.value == 1.0L)
+ if (__glibc_unlikely (__isnanl (x)))
+ return x + x;
+ a = __builtin_fabsl (x);
+ if (a == 1.0L)
{
if (x > 0.0L)
return 0.0; /* acos(1) = 0 */
else
return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
}
- else if (u.value > 1.0L)
+ else if (a > 1.0L)
{
return (x - x) / (x - x); /* acos(|x| > 1) is NaN */
}
- if (u.value < 0.5L)
+ if (a < 0.5L)
{
- if (u.value < 6.938893903907228e-18L) /* |x| < 2**-57 */
+ if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */
return pio2_hi + pio2_lo;
- if (u.value < 0.4375L)
+ if (a < 0.4375L)
{
/* Arcsine of x. */
z = x * x;
@@ -199,7 +200,7 @@ __ieee754_acosl (long double x)
return z;
}
/* .4375 <= |x| < .5 */
- t = u.value - 0.4375L;
+ t = a - 0.4375L;
p = ((((((((((P10 * t
+ P9) * t
+ P8) * t
@@ -230,9 +231,9 @@ __ieee754_acosl (long double x)
r = acosr4375 + r;
return r;
}
- else if (u.value < 0.625L)
+ else if (a < 0.625L)
{
- t = u.value - 0.5625L;
+ t = a - 0.5625L;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
@@ -264,7 +265,9 @@ __ieee754_acosl (long double x)
}
else
{ /* |x| >= .625 */
- z = (one - u.value) * 0.5;
+ double shi, slo;
+
+ z = (one - a) * 0.5;
s = __ieee754_sqrtl (z);
/* Compute an extended precision square root from
the Newton iteration s -> 0.5 * (s + z / s).
@@ -273,12 +276,11 @@ __ieee754_acosl (long double x)
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;
+ ldbl_unpack (s, &shi, &slo);
+ a = shi;
+ f2 = slo;
+ w = z - a * a;
+ w = w - 2.0 * a * f2;
w = w - f2 * f2;
w = w / (2.0 * s);
/* Arcsine of s. */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
index b39543949..dece11875 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -131,19 +131,20 @@ static const long double
long double
__ieee754_asinl (long double x)
{
- long double t, w, p, q, c, r, s;
+ long double a, t, w, p, q, c, r, s;
int flag;
- ieee854_long_double_shape_type u;
+ if (__glibc_unlikely (__isnanl (x)))
+ return x + x;
flag = 0;
- u.value = __builtin_fabsl (x);
- if (u.value == 1.0L) /* |x|>= 1 */
+ a = __builtin_fabsl (x);
+ if (a == 1.0L) /* |x|>= 1 */
return x * pio2_hi + x * pio2_lo; /* asin(1)=+-pi/2 with inexact */
- else if (u.value >= 1.0L)
+ else if (a >= 1.0L)
return (x - x) / (x - x); /* asin(|x|>1) is NaN */
- else if (u.value < 0.5L)
+ else if (a < 0.5L)
{
- if (u.value < 6.938893903907228e-18L) /* |x| < 2**-57 */
+ if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */
{
if (huge + x > one)
return x; /* return x with inexact if x!=0 */
@@ -155,9 +156,9 @@ __ieee754_asinl (long double x)
flag = 1;
}
}
- else if (u.value < 0.625L)
+ else if (a < 0.625L)
{
- t = u.value - 0.5625;
+ t = a - 0.5625;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
@@ -190,7 +191,7 @@ __ieee754_asinl (long double x)
else
{
/* 1 > |x| >= 0.625 */
- w = one - u.value;
+ w = one - a;
t = w * 0.5;
}
@@ -223,17 +224,14 @@ __ieee754_asinl (long double x)
}
s = __ieee754_sqrtl (t);
- if (u.value > 0.975L)
+ if (a > 0.975L)
{
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;
+ w = ldbl_high (s);
c = (t - w * w) / (s + w);
r = p / q;
p = 2.0 * s * r - (pio2_lo - 2.0 * c);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
index 3e0535561..b625323df 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
@@ -56,11 +56,15 @@ __ieee754_atan2l(long double y, long double x)
{
long double z;
int64_t k,m,hx,hy,ix,iy;
- u_int64_t lx,ly;
+ uint64_t lx;
+ double xhi, xlo, yhi;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
ix = hx&0x7fffffffffffffffLL;
- GET_LDOUBLE_WORDS64(hy,ly,y);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64 (hy, yhi);
iy = hy&0x7fffffffffffffffLL;
if(((ix)>0x7ff0000000000000LL)||
((iy)>0x7ff0000000000000LL)) /* x or y is NaN */
@@ -70,7 +74,7 @@ __ieee754_atan2l(long double y, long double x)
m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */
/* when y = 0 */
- if((iy|(ly&0x7fffffffffffffffLL))==0) {
+ if(iy==0) {
switch(m) {
case 0:
case 1: return y; /* atan(+-0,+anything)=+-0 */
@@ -79,7 +83,7 @@ __ieee754_atan2l(long double y, long double x)
}
}
/* when x = 0 */
- if((ix|(lx&0x7fffffffffffffff))==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+ if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* when x is INF */
if(ix==0x7ff0000000000000LL) {
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
index f35182f03..29f2e9207 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
@@ -40,8 +40,10 @@ __ieee754_atanhl(long double x)
{
long double t;
int64_t hx,ix;
- u_int64_t lx __attribute__ ((unused));
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx&0x7fffffffffffffffLL;
if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
if (ix > 0x3ff0000000000000LL)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
index 3e8e1875c..05683bc02 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -41,9 +41,11 @@ __ieee754_coshl (long double x)
{
long double t,w;
int64_t ix;
+ double xhi;
/* High word of |x|. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
ix &= 0x7fffffffffffffffLL;
/* x is INF or NaN */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c
index 1eaf2fe39..49121ca31 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c
@@ -36,9 +36,9 @@ __ieee754_exp10l (long double arg)
else if (arg > LDBL_MAX_10_EXP + 1)
return LDBL_MAX * LDBL_MAX;
- u.d = arg;
- arg_high = u.dd[0];
- arg_low = u.dd[1];
+ u.ld = arg;
+ arg_high = u.d[0].d;
+ arg_low = u.d[1].d;
exp_high = arg_high * log10_high;
exp_low = arg_high * log10_low + arg_low * M_LN10l;
return __ieee754_expl (exp_high) * __ieee754_expl (exp_low);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
index 1b994cd7a..f7c50bfd3 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -162,39 +162,39 @@ __ieee754_expl (long double x)
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];
+ ex2_u.ld = (__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;
+ ex2_u.d[0].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) */;
+ exponent2 = ex2_u.d[1].ieee.exponent + (n_i >> unsafe);
+ if (ex2_u.d[1].ieee.exponent == 0)
+ /* assert ((ex2_u.d[1].ieee.mantissa0|ex2_u.d[1].ieee.mantissa1) == 0) */;
else if (exponent2 > 0)
- ex2_u.ieee.exponent2 = exponent2;
+ ex2_u.d[1].ieee.exponent = exponent2;
else if (exponent2 <= -54)
{
- ex2_u.ieee.exponent2 = 0;
- ex2_u.ieee.mantissa2 = 0;
- ex2_u.ieee.mantissa3 = 0;
+ ex2_u.d[1].ieee.exponent = 0;
+ ex2_u.d[1].ieee.mantissa0 = 0;
+ ex2_u.d[1].ieee.mantissa1 = 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;
+ ex2_u.d[1].d *= two54;
+ ex2_u.d[1].ieee.exponent += n_i >> unsafe;
+ ex2_u.d[1].d *= twom54;
}
/* Compute scale = 2^n_1. */
- scale_u.d = 1.0L;
- scale_u.ieee.exponent += n_i - (n_i >> unsafe);
+ scale_u.ld = 1.0L;
+ scale_u.d[0].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]
@@ -204,7 +204,7 @@ __ieee754_expl (long double x)
/* Return result. */
fesetenv (&oldenv);
- result = x22 * ex2_u.d + ex2_u.d;
+ result = x22 * ex2_u.ld + ex2_u.ld;
/* 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
@@ -238,7 +238,7 @@ __ieee754_expl (long double x)
if (!unsafe)
return result;
else
- return result * scale_u.d;
+ return result * scale_u.ld;
}
/* Exceptional cases: */
else if (isless (x, himark))
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
index a60963c84..a140fb322 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -27,76 +27,83 @@ static const long double one = 1.0, Zero[] = {0.0, -0.0,};
long double
__ieee754_fmodl (long double x, long double y)
{
- int64_t n,hx,hy,hz,ix,iy,sx, i;
- u_int64_t lx,ly,lz;
- int temp;
+ int64_t hx, hy, hz, sx, sy;
+ uint64_t lx, ly, lz;
+ int n, ix, iy;
+ double xhi, xlo, yhi, ylo;
- GET_LDOUBLE_WORDS64(hx,lx,x);
- GET_LDOUBLE_WORDS64(hy,ly,y);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
+ ldbl_unpack (y, &yhi, &ylo);
+ EXTRACT_WORDS64 (hy, yhi);
+ EXTRACT_WORDS64 (ly, ylo);
sx = hx&0x8000000000000000ULL; /* sign of x */
- hx ^=sx; /* |x| */
- hy &= 0x7fffffffffffffffLL; /* |y| */
+ hx ^= sx; /* |x| */
+ sy = hy&0x8000000000000000ULL; /* sign of y */
+ hy ^= sy; /* |y| */
/* purge off exception values */
- if(__builtin_expect((hy|(ly&0x7fffffffffffffff))==0 ||
+ if(__builtin_expect(hy==0 ||
(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
(hy>0x7ff0000000000000LL),0)) /* or y is NaN */
return (x*y)/(x*y);
- if(__builtin_expect(hx<=hy,0)) {
- 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*/
+ if (__builtin_expect (hx <= hy, 0))
+ {
+ /* If |x| < |y| return x. */
+ if (hx < hy)
+ return x;
+ /* At this point the absolute value of the high doubles of
+ x and y must be equal. */
+ /* If the low double of y is the same sign as the high
+ double of y (ie. the low double increases |y|)... */
+ if (((ly ^ sy) & 0x8000000000000000LL) == 0
+ /* ... then a different sign low double to high double
+ for x or same sign but lower magnitude... */
+ && (int64_t) (lx ^ sx) < (int64_t) (ly ^ sy))
+ /* ... means |x| < |y|. */
+ return x;
+ /* If the low double of x differs in sign to the high
+ double of x (ie. the low double decreases |x|)... */
+ if (((lx ^ sx) & 0x8000000000000000LL) != 0
+ /* ... then a different sign low double to high double
+ for y with lower magnitude (we've already caught
+ the same sign for y case above)... */
+ && (int64_t) (lx ^ sx) > (int64_t) (ly ^ sy))
+ /* ... means |x| < |y|. */
+ return x;
+ /* If |x| == |y| return x*0. */
+ if ((lx ^ sx) == (ly ^ sy))
+ return Zero[(uint64_t) sx >> 63];
}
- /* determine ix = ilogb(x) */
- if(__builtin_expect(hx<0x0010000000000000LL,0)) { /* subnormal x */
- if(hx==0) {
- for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
- } else {
- for (ix = -1022, i=(hx<<11); i>0; i<<=1) ix -=1;
- }
- } else ix = (hx>>52)-0x3ff;
-
- /* determine iy = ilogb(y) */
- if(__builtin_expect(hy<0x0010000000000000LL,0)) { /* subnormal y */
- if(hy==0) {
- for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
- } else {
- for (iy = -1022, i=(hy<<11); 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 operations will give the correct
result. */
- ldbl_extract_mantissa(&hx, &lx, &temp, x);
- ldbl_extract_mantissa(&hy, &ly, &temp, y);
+ ldbl_extract_mantissa(&hx, &lx, &ix, x);
+ ldbl_extract_mantissa(&hy, &ly, &iy, y);
- /* set up {hx,lx}, {hy,ly} and align y to x */
- if(__builtin_expect(ix >= -1022, 1))
- 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(__builtin_expect(iy >= -1022, 1))
- 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;
- }
- }
+ if (__builtin_expect (ix == -IEEE754_DOUBLE_BIAS, 0))
+ {
+ /* subnormal x, shift x to normal. */
+ while ((hx & (1LL << 48)) == 0)
+ {
+ hx = (hx << 1) | (lx >> 63);
+ lx = lx << 1;
+ ix -= 1;
+ }
+ }
+
+ if (__builtin_expect (iy == -IEEE754_DOUBLE_BIAS, 0))
+ {
+ /* subnormal y, shift y to normal. */
+ while ((hy & (1LL << 48)) == 0)
+ {
+ hy = (hy << 1) | (ly >> 63);
+ ly = ly << 1;
+ iy -= 1;
+ }
+ }
/* fix point fmod */
n = ix - iy;
@@ -104,7 +111,7 @@ __ieee754_fmodl (long double x, long double y)
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 */
+ if((hz|lz)==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
hx = hz+hz+(lz>>63); lx = lz+lz;
}
@@ -113,7 +120,7 @@ __ieee754_fmodl (long double x, long double y)
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 */
+ if((hx|lx)==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;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
index 90d8e3f0d..84c13de9b 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -122,11 +122,12 @@ long double
__ieee754_gammal_r (long double x, int *signgamp)
{
int64_t hx;
- u_int64_t lx;
+ double xhi;
- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
- if (((hx | lx) & 0x7fffffffffffffffLL) == 0)
+ if ((hx & 0x7fffffffffffffffLL) == 0)
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
index 768bd3b06..3b07a47b4 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -45,76 +45,84 @@
#include <math.h>
#include <math_private.h>
-static const long double two600 = 0x1.0p+600L;
-static const long double two1022 = 0x1.0p+1022L;
-
long double
__ieee754_hypotl(long double x, long double y)
{
- long double a,b,t1,t2,y1,y2,w,kld;
+ long double a,b,a1,a2,b1,b2,w,kld;
int64_t j,k,ha,hb;
+ double xhi, yhi, hi, lo;
- GET_LDOUBLE_MSW64(ha,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ha, xhi);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64 (hb, yhi);
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)>0x780000000000000LL) {return a+b;} /* x/y > 2**120 */
+ if((ha-hb)>0x0780000000000000LL) {return a+b;} /* x/y > 2**120 */
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)
+ if(ha == 0x7ff0000000000000LL)
w = a;
- GET_LDOUBLE_LSW64(low,b);
- if(((hb^0x7ff0000000000000LL)|(low&0x7fffffffffffffffLL))==0)
+ if(hb == 0x7ff0000000000000LL)
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;
+ a *= 0x1p-600L;
+ b *= 0x1p-600L;
+ k = 600;
+ kld = 0x1p+600L;
}
- if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */
+ else if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */
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;
+ if(hb==0) return a;
+ a *= 0x1p+1022L;
+ b *= 0x1p+1022L;
+ k = -1022;
+ kld = 0x1p-1022L;
} 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;
+ a *= 0x1p+600L;
+ b *= 0x1p+600L;
+ k = -600;
+ kld = 0x1p-600L;
}
}
/* 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)));
+ ldbl_unpack (a, &hi, &lo);
+ a1 = hi;
+ a2 = lo;
+ /* a*a + b*b
+ = (a1+a2)*a + b*b
+ = a1*a + a2*a + b*b
+ = a1*(a1+a2) + a2*a + b*b
+ = a1*a1 + a1*a2 + a2*a + b*b
+ = a1*a1 + a2*(a+a1) + b*b */
+ w = __ieee754_sqrtl(a1*a1-(b*(-b)-a2*(a+a1)));
} 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)));
+ ldbl_unpack (b, &hi, &lo);
+ b1 = hi;
+ b2 = lo;
+ ldbl_unpack (a, &hi, &lo);
+ a1 = hi;
+ a2 = lo;
+ /* a*a + b*b
+ = a*a + (a-b)*(a-b) - (a-b)*(a-b) + b*b
+ = a*a + w*w - (a*a - 2*a*b + b*b) + b*b
+ = w*w + 2*a*b
+ = w*w + (a1+a2)*b
+ = w*w + a1*b + a2*b
+ = w*w + a1*(b1+b2) + a2*b
+ = w*w + a1*b1 + a1*b2 + a2*b */
+ w = __ieee754_sqrtl(a1*b1-(w*(-w)-(a1*b2+a2*b)));
}
if(k!=0)
return w*kld;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c
index 55f87ed42..aeace7c97 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c
@@ -31,26 +31,24 @@ static char rcsid[] = "$NetBSD: $";
int __ieee754_ilogbl(long double x)
{
- int64_t hx,lx;
+ int64_t hx;
int ix;
+ double xhi;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
hx &= 0x7fffffffffffffffLL;
if(hx <= 0x0010000000000000LL) {
- if((hx|(lx&0x7fffffffffffffffLL))==0)
+ if(hx==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;
- }
+ 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)
+ if (hx==0x7ff0000000000000LL)
return INT_MAX;
}
return FP_ILOGBNAN;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
index 40012e41e..817977da5 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
@@ -70,26 +70,25 @@ static const long double
long double
__ieee754_jnl (int n, long double x)
{
- u_int32_t se;
+ uint32_t se, lx;
int32_t i, ix, sgn;
long double a, b, temp, di;
long double z, w;
- ieee854_long_double_shape_type u;
+ double xhi;
/* 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;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (se, lx, xhi);
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)
+ if (((ix - 0x7ff00000) | lx) != 0)
return x + x;
}
@@ -298,21 +297,20 @@ strong_alias (__ieee754_jnl, __jnl_finite)
long double
__ieee754_ynl (int n, long double x)
{
- u_int32_t se;
+ uint32_t se, lx;
int32_t i, ix;
int32_t sign;
long double a, b, temp;
- ieee854_long_double_shape_type u;
+ double xhi;
- u.value = x;
- se = u.parts32.w0;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (se, lx, xhi);
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)
+ if (((ix - 0x7ff00000) | lx) != 0)
return x + x;
}
if (x <= 0.0L)
@@ -377,14 +375,16 @@ __ieee754_ynl (int n, long double x)
a = __ieee754_y0l (x);
b = __ieee754_y1l (x);
/* quit if b is -inf */
- u.value = b;
- se = u.parts32.w0 & 0xfff00000;
+ xhi = ldbl_high (b);
+ GET_HIGH_WORD (se, xhi);
+ se &= 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;
+ xhi = ldbl_high (b);
+ GET_HIGH_WORD (se, xhi);
+ se &= 0xfff00000;
a = temp;
}
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
index fae774cea..1a6a4a0fa 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
@@ -182,11 +182,13 @@ __ieee754_log10l (long double x)
long double z;
long double y;
int e;
- int64_t hx, lx;
+ int64_t hx;
+ double xhi;
/* Test for domain */
- GET_LDOUBLE_WORDS64 (hx, lx, x);
- if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+ if ((hx & 0x7fffffffffffffffLL) == 0)
return (-1.0L / (x - x));
if (hx < 0)
return (x - x) / (x - x);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
index f0098f6c7..323ded0c0 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
@@ -177,11 +177,13 @@ __ieee754_log2l (x)
long double z;
long double y;
int e;
- int64_t hx, lx;
+ int64_t hx;
+ double xhi;
/* Test for domain */
- GET_LDOUBLE_WORDS64 (hx, lx, x);
- if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+ if ((hx & 0x7fffffffffffffffLL) == 0)
return (-1.0L / (x - x));
if (hx < 0)
return (x - x) / (x - x);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_logl.c
index 15b5edfab..b7db2b978 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_logl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -188,18 +188,20 @@ static const long double
long double
__ieee754_logl(long double x)
{
- long double z, y, w;
- ieee854_long_double_shape_type u, t;
+ long double z, y, w, t;
unsigned int m;
int k, e;
+ double xhi;
+ uint32_t hx, lx;
- u.value = x;
- m = u.parts32.w0;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (hx, lx, xhi);
+ m = hx;
/* Check for IEEE special cases. */
k = m & 0x7fffffff;
/* log(0) = -infinity. */
- if ((k | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ if ((k | lx) == 0)
{
return -0.5L / ZERO;
}
@@ -219,7 +221,7 @@ __ieee754_logl(long double x)
{
z = x - 1.0L;
k = 64;
- t.value = 1.0L;
+ t = 1.0L;
e = 0;
}
else
@@ -236,10 +238,8 @@ __ieee754_logl(long double x)
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;
+ INSERT_WORDS (xhi, 0x3ff00000 + (k << 13), 0);
+ t = xhi;
w0 += 0x100000;
e -= 1;
k += 64;
@@ -247,17 +247,15 @@ __ieee754_logl(long double x)
else
{
k = (m - 0xfe000) >> 14;
- t.parts32.w0 = 0x3fe00000 + (k << 14);
- t.parts32.w1 = 0;
- t.parts32.w2 = 0;
- t.parts32.w3 = 0;
+ INSERT_WORDS (xhi, 0x3fe00000 + (k << 14), 0);
+ t = xhi;
}
- u.value = __scalbnl (u.value, ((int) ((w0 - u.parts32.w0) * 2)) >> 21);
+ x = __scalbnl (x, ((int) ((w0 - hx) * 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;
+ z = (x - t) / t;
}
/* Series expansion of log(1+z). */
w = z * z;
@@ -284,7 +282,7 @@ __ieee754_logl(long double x)
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 += (t - 1.0L);
y += e * ln2a;
return y;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
index 8bd35d0c8..c942f2f24 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -151,37 +151,32 @@ __ieee754_powl (long double x, long double y)
long double y1, t1, t2, r, s, t, u, v, w;
long double s2, s_h, s_l, t_h, t_l, ay;
int32_t i, j, k, yisint, n;
- u_int32_t ix, iy;
- int32_t hx, hy;
- ieee854_long_double_shape_type o, p, q;
+ uint32_t ix, iy;
+ int32_t hx, hy, hax;
+ double ohi, xhi, xlo, yhi, ylo;
+ uint32_t lx, ly, lj;
- p.value = x;
- hx = p.parts32.w0;
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS (hx, lx, xhi);
ix = hx & 0x7fffffff;
- q.value = y;
- hy = q.parts32.w0;
+ ldbl_unpack (y, &yhi, &ylo);
+ EXTRACT_WORDS (hy, ly, yhi);
iy = hy & 0x7fffffff;
-
/* y==zero: x**0 = 1 */
- if ((iy | q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ if ((iy | ly) == 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)
+ if (x == -1.0L && ((iy - 0x7ff00000) | ly) == 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)))
+ if ((ix >= 0x7ff00000 && ((ix - 0x7ff00000) | lx) != 0)
+ || (iy >= 0x7ff00000 && ((iy - 0x7ff00000) | ly) != 0))
return x + y;
/* determine if y is an odd int when x < 0
@@ -192,7 +187,10 @@ __ieee754_powl (long double x, long double y)
yisint = 0;
if (hx < 0)
{
- if ((q.parts32.w2 & 0x7fffffff) >= 0x43400000) /* Low part >= 2^53 */
+ uint32_t low_ye;
+
+ GET_HIGH_WORD (low_ye, ylo);
+ if ((low_ye & 0x7fffffff) >= 0x43400000) /* Low part >= 2^53 */
yisint = 2; /* even integer y */
else if (iy >= 0x3ff00000) /* 1.0 */
{
@@ -207,42 +205,43 @@ __ieee754_powl (long double x, long double y)
}
}
+ ax = fabsl (x);
+
/* special value of y */
- if ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ if (ly == 0)
{
- if (iy == 0x7ff00000 && q.parts32.w1 == 0) /* y is +-inf */
+ if (iy == 0x7ff00000) /* 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)
+ if (ax > one)
/* (|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);
+ if (ylo == 0.0)
+ {
+ 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 (lx == 0)
{
- if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
+ if (ix == 0x7ff00000 || ix == 0 || (ix == 0x3ff00000 && xlo == 0.0))
{
z = ax; /*x is +-0,+-inf,+-1 */
if (hy < 0)
@@ -294,8 +293,8 @@ __ieee754_powl (long double x, long double y)
{
ax *= two113;
n -= 113;
- o.value = ax;
- ix = o.parts32.w0;
+ ohi = ldbl_high (ax);
+ GET_HIGH_WORD (ix, ohi);
}
n += ((ix) >> 20) - 0x3ff;
j = ix & 0x000fffff;
@@ -312,26 +311,19 @@ __ieee754_powl (long double x, long double y)
ix -= 0x00100000;
}
- o.value = ax;
- o.value = __scalbnl (o.value, ((int) ((ix - o.parts32.w0) * 2)) >> 21);
- ax = o.value;
+ ohi = ldbl_high (ax);
+ GET_HIGH_WORD (hax, ohi);
+ ax = __scalbnl (ax, ((int) ((ix - hax) * 2)) >> 21);
/* 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;
+ s_h = ldbl_high (s);
- o.value = s_h;
- o.parts32.w3 = 0;
- o.parts32.w2 = 0;
- 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 = 0;
- t_h = o.value;
+ t_h = ldbl_high (t_h);
t_l = ax - (t_h - bp[k]);
s_l = v * ((u - s_h * t_h) - s_h * t_l);
/* compute log(ax) */
@@ -342,30 +334,21 @@ __ieee754_powl (long double x, long double y)
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 = 0;
- t_h = o.value;
+ t_h = ldbl_high (t_h);
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 = 0;
- p_h = o.value;
+ p_h = ldbl_high (p_h);
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 = 0;
- t1 = o.value;
+ t1 = ldbl_high (t1);
t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
/* s (sign of result -ve**odd) = -1 else = 1 */
@@ -374,21 +357,16 @@ __ieee754_powl (long double x, long double y)
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 = 0;
- y1 = o.value;
+ y1 = ldbl_high (y);
p_l = (y - y1) * t1 + y * t2;
p_h = y1 * t1;
z = p_l + p_h;
- o.value = z;
- j = o.parts32.w0;
+ ohi = ldbl_high (z);
+ EXTRACT_WORDS (j, lj, ohi);
if (j >= 0x40d00000) /* z >= 16384 */
{
/* if z > 16384 */
- if (((j - 0x40d00000) | o.parts32.w1
- | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ if (((j - 0x40d00000) | lj) != 0)
return s * huge * huge; /* overflow */
else
{
@@ -399,8 +377,7 @@ __ieee754_powl (long double x, long double y)
else if ((j & 0x7fffffff) >= 0x40d01b90) /* z <= -16495 */
{
/* z < -16495 */
- if (((j - 0xc0d01bc0) | o.parts32.w1
- | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ if (((j - 0xc0d01bc0) | lj) != 0)
return s * tiny * tiny; /* underflow */
else
{
@@ -419,10 +396,7 @@ __ieee754_powl (long double x, long double y)
p_h -= t;
}
t = p_l + p_h;
- o.value = t;
- o.parts32.w3 = 0;
- o.parts32.w2 = 0;
- t = o.value;
+ t = ldbl_high (t);
u = t * lg2_h;
v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
z = u + v;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
index 6a72d6a85..36bc03226 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
@@ -200,10 +200,11 @@ int32_t __ieee754_rem_pio2l(long double x, long double *y)
double tx[8];
int exp;
int64_t n, ix, hx, ixd;
- u_int64_t lx __attribute__ ((unused));
u_int64_t lxd;
+ double xhi;
- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx & 0x7fffffffffffffffLL;
if (ix <= 0x3fe921fb54442d10LL) /* x in <-pi/4, pi/4> */
{
@@ -243,7 +244,7 @@ int32_t __ieee754_rem_pio2l(long double x, long double *y)
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. */
+ bit mantissa so the next operation 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
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
index 67d7db7fb..800416f29 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
@@ -33,18 +33,22 @@ __ieee754_remainderl(long double x, long double p)
int64_t hx,hp;
u_int64_t sx,lx,lp;
long double p_half;
+ double xhi, xlo, phi, plo;
- GET_LDOUBLE_WORDS64(hx,lx,x);
- GET_LDOUBLE_WORDS64(hp,lp,p);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
+ ldbl_unpack (p, &phi, &plo);
+ EXTRACT_WORDS64 (hp, phi);
+ EXTRACT_WORDS64 (lp, plo);
sx = hx&0x8000000000000000ULL;
hp &= 0x7fffffffffffffffLL;
hx &= 0x7fffffffffffffffLL;
/* purge off exception values */
- if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
+ if(hp==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7ff0000000000000LL)|| /* x not finite */
- ((hp>=0x7ff0000000000000LL)&& /* p is NaN */
- (((hp-0x7ff0000000000000LL)|lp)!=0)))
+ (hp>0x7ff0000000000000LL)) /* p is NaN */
return (x*p)/(x*p);
@@ -64,8 +68,8 @@ __ieee754_remainderl(long double x, long double p)
if(x>=p_half) x -= p;
}
}
- GET_LDOUBLE_MSW64(hx,x);
- SET_LDOUBLE_MSW64(x,hx^sx);
+ if (sx)
+ x = -x;
return x;
}
strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
index 4e8481c41..1790bef87 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -38,9 +38,11 @@ __ieee754_sinhl(long double x)
{
long double t,w,h;
int64_t ix,jx;
+ double xhi;
/* High word of |x|. */
- GET_LDOUBLE_MSW64(jx,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (jx, xhi);
ix = jx&0x7fffffffffffffffLL;
/* x is INF or NaN */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
index 2b0f7c62e..61feb367f 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
@@ -34,15 +34,13 @@
#include <math_private.h>
-typedef unsigned int int4;
-typedef union {int4 i[4]; long double x; double d[2]; } mynumber;
+typedef union {int64_t i[2]; 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 */
+ t512 = 0x1p512,
+ tm256 = 0x1p-256,
+ two54 = 0x1p54, /* 0x4350000000000000 */
+ twom54 = 0x1p-54; /* 0x3C90000000000000 */
/*********************************************************************/
/* An ultimate sqrt routine. Given an IEEE double machine number x */
@@ -54,56 +52,53 @@ 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;
+ uint64_t k, l;
+ int64_t m, n;
double d;
a.x=x;
- k=a.i[0] & 0x7fffffff;
+ k=a.i[0] & INT64_C(0x7fffffffffffffff);
/*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
- if (k>0x000fffff && k<0x7ff00000) {
+ if (k>INT64_C(0x000fffff00000000) && k<INT64_C(0x7ff0000000000000)) {
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;
+ l = (k&INT64_C(0x001fffffffffffff))|INT64_C(0x3fe0000000000000);
+ if ((a.i[1] & INT64_C(0x7fffffffffffffff)) != 0) {
+ n = (int64_t) ((l - k) * 2) >> 53;
+ m = (a.i[1] >> 52) & 0x7ff;
if (m == 0) {
a.d[1] *= two54;
- m = ((a.i[2] >> 20) & 0x7ff) - 54;
+ m = ((a.i[1] >> 52) & 0x7ff) - 54;
}
m += n;
- if ((int) m > 0)
- a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
- else if ((int) m <= -54) {
- a.i[2] &= 0x80000000;
- a.i[3] = 0;
+ if (m > 0)
+ a.i[1] = (a.i[1] & INT64_C(0x800fffffffffffff)) | (m << 52);
+ else if (m <= -54) {
+ a.i[1] &= INT64_C(0x8000000000000000);
} else {
m += 54;
- a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ a.i[1] = (a.i[1] & INT64_C(0x800fffffffffffff)) | (m << 52);
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[0] = INT64_C(0x2000000000000000)+((k&INT64_C(0x7fe0000000000000))>>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)
+ if (k>=INT64_C(0x7ff0000000000000)) {
+ if (a.i[0] == INT64_C(0xfff0000000000000))
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);
+ return tm256*__ieee754_sqrtl(x*t512);
}
}
strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
index 9e94f53b0..0c97a9920 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -111,61 +111,6 @@ union ieee754_double
#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
@@ -179,49 +124,10 @@ union ieee854_long_double
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;
-
- /* This format makes it easier to see if a NaN is a signalling NaN. */
- struct
- { /* Big endian. There is no other. */
-
- unsigned int negative:1;
- unsigned int exponent:11;
- unsigned int quiet_nan:1;
- /* Together Mantissa0-3 comprise the mantissa. */
- unsigned int mantissa0:19;
- 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_nan;
+ long double ld;
+ union ieee754_double d[2];
};
-#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
-
__END_DECLS
#endif /* ieee754.h */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
index 0b81782fd..046f3b573 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
@@ -81,8 +81,11 @@ __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);
+ uint32_t tix, hix, index;
+ double xhi, hhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
tix = ((u_int64_t)ix) >> 32;
tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
@@ -136,7 +139,8 @@ __kernel_cosl(long double x, long double y)
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+ h = hhi;
l = y - (h - x);
z = l * l;
sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
index fc1ead659..3ba9d7e90 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
@@ -100,9 +100,12 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
{
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;
+ uint32_t tix, hix, index;
+ double xhi, hhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
+ tix = ((uint64_t)ix) >> 32;
tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
{
@@ -164,7 +167,8 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+ h = hhi;
if (iy)
l = y - (h - x);
else
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
index f17c0ae5d..b12ea134d 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
@@ -82,7 +82,10 @@ __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);
+ double xhi, hhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
tix = ((u_int64_t)ix) >> 32;
tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
@@ -132,7 +135,8 @@ __kernel_sinl(long double x, long double y, int iy)
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+ h = hhi;
if (iy)
l = (ix < 0 ? -y : y) - (h - x);
else
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index 1f6bad241..bcf8b5e7d 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -85,17 +85,17 @@ long double
__kernel_tanl (long double x, long double y, int iy)
{
long double z, r, v, w, s;
- int32_t ix, sign;
- ieee854_long_double_shape_type u, u1;
+ int32_t ix, sign, hx, lx;
+ double xhi;
- u.value = x;
- ix = u.parts32.w0 & 0x7fffffff;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (hx, lx, xhi);
+ ix = hx & 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)
+ if ((int) x == 0) /* generate inexact */
+ {
+ if ((ix | lx | (iy + 1)) == 0)
return one / fabs (x);
else
return (iy == 1) ? x : -one / x;
@@ -103,7 +103,7 @@ __kernel_tanl (long double x, long double y, int iy)
}
if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */
{
- if ((u.parts32.w0 & 0x80000000) != 0)
+ if ((hx & 0x80000000) != 0)
{
x = -x;
y = -y;
@@ -139,15 +139,13 @@ __kernel_tanl (long double x, long double y, int iy)
{ /* 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 */
+ long double u1, z1;
+
+ u1 = ldbl_high (w);
+ v = r - (u1 - 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);
+ z1 = ldbl_high (z);
+ s = 1.0 + z1 * u1;
+ return z1 + z * (s + z1 * v);
}
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/libc/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
index 00e44b8b9..e46fde74f 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
@@ -36,34 +36,44 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
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;
+ u.ld = value;
- 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
+ *is_neg = u.d[0].ieee.negative;
+ *expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;
+
+ lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
+ hi = ((long long) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
+
+ /* If the lower double is not a denormal or zero then set the hidden
53rd bit. */
- if (u.ieee.exponent2 > 0)
- {
- lo |= 1LL << 52;
+ if (u.d[1].ieee.exponent != 0)
+ lo |= 1ULL << 52;
+ else
+ lo = lo << 1;
- /* 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 lower double is normalized separately from the upper. We may
+ need to adjust the lower manitissa to reflect this. */
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53;
+ if (ediff > 0)
+ {
+ if (ediff < 64)
+ lo = lo >> ediff;
+ else
+ lo = 0;
}
+ else if (ediff < 0)
+ lo = lo << -ediff;
+
/* 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)))
+ if (u.d[0].ieee.negative != u.d[1].ieee.negative
+ && lo != 0)
{
lo = (1ULL << 53) - lo;
- if (hi == 0LL)
+ if (hi == 0)
{
/* we have a borrow from the hidden bit, so shift left 1. */
hi = 0x0ffffffffffffeLL | (lo >> 51);
@@ -92,7 +102,7 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
- (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
- if (u.ieee.exponent == 0)
+ if (u.d[0].ieee.exponent == 0)
{
/* A biased exponent of zero is a special case.
Either it is a zero or it is a denormal number. */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
index 046293e59..1b6e27a9f 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -2,10 +2,13 @@
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
#endif
-#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
#include <ieee754.h>
#include <stdint.h>
+/* To suit our callers we return *hi64 and *lo64 as if they came from
+ an ieee854 112 bit mantissa, that is, 48 bits in *hi64 (plus one
+ implicit bit) and 64 bits in *lo64. */
+
static inline void
ldbl_extract_mantissa (int64_t *hi64, uint64_t *lo64, int *exp, long double x)
{
@@ -14,77 +17,119 @@ ldbl_extract_mantissa (int64_t *hi64, uint64_t *lo64, int *exp, long double x)
the number before the decimal point and the second implicit bit
as bit 53 of the mantissa. */
uint64_t hi, lo;
- int ediff;
- union ibm_extended_long_double eldbl;
- eldbl.d = x;
- *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
-
- lo = ((int64_t)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
- hi = ((int64_t)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);
- }
+ union ibm_extended_long_double u;
- if ((eldbl.ieee.negative != eldbl.ieee.negative2)
- && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
+ u.ld = x;
+ *exp = u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;
+
+ lo = ((uint64_t) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
+ hi = ((uint64_t) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
+
+ if (u.d[0].ieee.exponent != 0)
{
- hi--;
- lo = (1ULL << 60) - lo;
- if (hi < (1ULL << 52))
+ int ediff;
+
+ /* If not a denormal or zero then we have an implicit 53rd bit. */
+ hi |= (uint64_t) 1 << 52;
+
+ if (u.d[1].ieee.exponent != 0)
+ lo |= (uint64_t) 1 << 52;
+ else
+ /* A denormal is to be interpreted as having a biased exponent
+ of 1. */
+ lo = lo << 1;
+
+ /* We are going to shift 4 bits out of hi later, because we only
+ want 48 bits in *hi64. That means we want 60 bits in lo, but
+ we currently only have 53. Shift the value up. */
+ lo = lo << 7;
+
+ /* The lower double is normalized separately from the upper.
+ We may need to adjust the lower mantissa to reflect this.
+ The difference between the exponents can be larger than 53
+ when the low double is much less than 1ULP of the upper
+ (in which case there are significant bits, all 0's or all
+ 1's, between the two significands). The difference between
+ the exponents can be less than 53 when the upper double
+ exponent is nearing its minimum value (in which case the low
+ double is denormal ie. has an exponent of zero). */
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53;
+ if (ediff > 0)
+ {
+ if (ediff < 64)
+ lo = lo >> ediff;
+ else
+ lo = 0;
+ }
+ else if (ediff < 0)
+ lo = lo << -ediff;
+
+ if (u.d[0].ieee.negative != u.d[1].ieee.negative
+ && lo != 0)
{
- /* we have a borrow from the hidden bit, so shift left 1. */
- hi = (hi << 1) | (lo >> 59);
- lo = 0xfffffffffffffffLL & (lo << 1);
- *exp = *exp - 1;
+ hi--;
+ lo = ((uint64_t) 1 << 60) - lo;
+ if (hi < (uint64_t) 1 << 52)
+ {
+ /* We have a borrow from the hidden bit, so shift left 1. */
+ hi = (hi << 1) | (lo >> 59);
+ lo = (((uint64_t) 1 << 60) - 1) & (lo << 1);
+ *exp = *exp - 1;
+ }
}
}
+ else
+ /* If the larger magnitude double is denormal then the smaller
+ one must be zero. */
+ hi = hi << 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)
+ldbl_insert_mantissa (int sign, int exp, int64_t hi64, uint64_t lo64)
{
union ibm_extended_long_double u;
- unsigned long hidden2, lzcount;
- unsigned long long hi, lo;
+ int expnt2;
+ uint64_t hi, lo;
+
+ u.d[0].ieee.negative = sign;
+ u.d[1].ieee.negative = sign;
+ u.d[0].ieee.exponent = exp + IEEE754_DOUBLE_BIAS;
+ u.d[1].ieee.exponent = 0;
+ expnt2 = exp - 53 + IEEE754_DOUBLE_BIAS;
- 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;
+ lo = (lo64 >> 7) & (((uint64_t) 1 << 53) - 1);
/* The high order 53 bits (52 + hidden) go into the upper double */
- hi = (lo64 >> 60) & ((1ULL << 11) - 1);
- hi |= (hi64 << 4);
+ hi = lo64 >> 60;
+ hi |= hi64 << 4;
- if (lo != 0LL)
+ if (lo != 0)
{
- /* hidden2 bit of low double controls rounding of the high double.
- If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
+ int lzcount;
+
+ /* hidden bit of low double controls rounding of the high double.
+ If hidden 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 (hidden2)
+ if ((lo & ((uint64_t) 1 << 52)) != 0
+ && ((hi & 1) != 0 || (lo & (((uint64_t) 1 << 52) - 1)) != 0))
{
hi++;
- u.ieee.negative2 = !sign;
- lo = (1ULL << 53) - lo;
+ if ((hi & ((uint64_t) 1 << 53)) != 0)
+ {
+ hi = hi >> 1;
+ u.d[0].ieee.exponent++;
+ }
+ u.d[1].ieee.negative = !sign;
+ lo = ((uint64_t) 1 << 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. */
+
+ /* Normalize the low double. Shift the mantissa left until
+ the hidden bit is '1' and adjust the exponent accordingly. */
if (sizeof (lo) == sizeof (long))
lzcount = __builtin_clzl (lo);
@@ -92,35 +137,31 @@ ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
lzcount = __builtin_clzl ((long) (lo >> 32));
else
lzcount = __builtin_clzl ((long) lo) + 32;
- lzcount = lzcount - 11;
- if (lzcount > 0)
+ lzcount = lzcount - (64 - 53);
+ lo <<= lzcount;
+ expnt2 -= lzcount;
+
+ if (expnt2 >= 1)
+ /* Not denormal. */
+ u.d[1].ieee.exponent = expnt2;
+ else
{
- int expnt2 = u.ieee.exponent2 - lzcount;
- if (expnt2 >= 1)
- {
- /* Not denormal. Normalize and set low exponent. */
- lo = lo << lzcount;
- u.ieee.exponent2 = expnt2;
- }
+ /* Is denormal. Note that biased exponent of 0 is treated
+ as if it was 1, hence the extra shift. */
+ if (expnt2 > -53)
+ lo >>= 1 - expnt2;
else
- {
- /* Is denormal. */
- lo = lo << (lzcount + expnt2);
- u.ieee.exponent2 = 0;
- }
+ lo = 0;
}
}
else
- {
- u.ieee.negative2 = 0;
- u.ieee.exponent2 = 0;
- }
+ u.d[1].ieee.negative = 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;
+ u.d[1].ieee.mantissa1 = lo;
+ u.d[1].ieee.mantissa0 = lo >> 32;
+ u.d[0].ieee.mantissa1 = hi;
+ u.d[0].ieee.mantissa0 = hi >> 32;
+ return u.ld;
}
/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
@@ -129,18 +170,18 @@ static inline long double
default_ldbl_pack (double a, double aa)
{
union ibm_extended_long_double u;
- u.dd[0] = a;
- u.dd[1] = aa;
- return u.d;
+ u.d[0].d = a;
+ u.d[1].d = aa;
+ return u.ld;
}
static inline void
default_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];
+ u.ld = l;
+ *a = u.d[0].d;
+ *aa = u.d[1].d;
}
#ifndef ldbl_pack
@@ -150,6 +191,9 @@ default_ldbl_unpack (long double l, double *a, double *aa)
# define ldbl_unpack default_ldbl_unpack
#endif
+/* Extract high double. */
+#define ldbl_high(x) ((double) x)
+
/* Convert a finite long double to canonical form.
Does not handle +/-Inf properly. */
static inline void
@@ -163,13 +207,13 @@ ldbl_canonicalize (double *a, double *aa)
*aa = xl;
}
-/* Simple inline nearbyint (double) function .
+/* 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;
+ double two52 = 0x1p52;
if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
{
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
index 3df42c566..c96852dfd 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
@@ -33,11 +33,11 @@ __mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
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;
+ u.d[0].ieee.negative = sign;
+ u.d[1].ieee.negative = sign;
+ u.d[0].ieee.exponent = expt + IEEE754_DOUBLE_BIAS;
+ u.d[1].ieee.exponent = 0;
+ exponent2 = expt - 53 + IEEE754_DOUBLE_BIAS;
#if BITS_PER_MP_LIMB == 32
/* The low order 53 bits (52 + hidden) go into the lower double */
@@ -69,19 +69,19 @@ __mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
else
lzcount = __builtin_clzl ((long) val) + 32;
if (hi)
- lzcount = lzcount - 11;
+ lzcount = lzcount - (64 - 53);
else
- lzcount = lzcount + 42;
+ lzcount = lzcount + 53 - (64 - 53);
- if (lzcount > u.ieee.exponent)
+ if (lzcount > u.d[0].ieee.exponent)
{
- lzcount = u.ieee.exponent;
- u.ieee.exponent = 0;
+ lzcount = u.d[0].ieee.exponent;
+ u.d[0].ieee.exponent = 0;
exponent2 -= lzcount;
}
else
{
- u.ieee.exponent -= (lzcount - 1);
+ u.d[0].ieee.exponent -= (lzcount - 1);
exponent2 -= (lzcount - 1);
}
@@ -97,29 +97,27 @@ __mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
}
}
- if (lo != 0L)
+ if (lo != 0)
{
- /* hidden2 bit of low double controls rounding of the high double.
- If hidden2 is '1' and either the explicit mantissa is non-zero
+ /* hidden bit of low double controls rounding of the high double.
+ If hidden 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 & 1) != 0 || (lo & ((1LL << 52) - 1)) != 0))
{
hi++;
- if ((hi & ((1LL << 52) - 1)) == 0)
+ if ((hi & (1LL << 53)) != 0)
{
- if ((hi & (1LL << 53)) != 0)
- hi -= 1LL << 52;
- u.ieee.exponent++;
+ hi >>= 1;
+ u.d[0].ieee.exponent++;
}
- u.ieee.negative2 = !sign;
+ u.d[1].ieee.negative = !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. */
+ /* Normalize the low double. Shift the mantissa left until
+ the hidden bit is '1' and adjust the exponent accordingly. */
if (sizeof (lo) == sizeof (long))
lzcount = __builtin_clzl (lo);
@@ -127,24 +125,24 @@ __mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
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;
- }
+ lzcount = lzcount - (64 - 53);
+ lo <<= lzcount;
+ exponent2 -= lzcount;
+
if (exponent2 > 0)
- u.ieee.exponent2 = exponent2;
- else
+ u.d[1].ieee.exponent = exponent2;
+ else if (exponent2 > -53)
lo >>= 1 - exponent2;
+ else
+ lo = 0;
}
else
- u.ieee.negative2 = 0;
+ u.d[1].ieee.negative = 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);
+ u.d[1].ieee.mantissa1 = lo;
+ u.d[1].ieee.mantissa0 = lo >> 32;
+ u.d[0].ieee.mantissa1 = hi;
+ u.d[0].ieee.mantissa0 = hi >> 32;
- return u.d;
+ return u.ld;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
index 247dc20e5..e0ec422b0 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@@ -26,31 +26,31 @@ do { \
unsigned long long int num0, num1; \
unsigned long long hi, lo; \
int ediff; \
- union ibm_extended_long_double eldbl; \
- eldbl.d = fpnum.ldbl.d; \
+ union ibm_extended_long_double u; \
+ u.ld = fpnum.ldbl; \
\
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 = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \
+ hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \
lo <<= 7; /* pre-shift lo to match ieee854. */ \
- /* If the lower double is not a denomal or zero then set the hidden \
+ /* If the lower double is not a denormal or zero then set the hidden \
53rd bit. */ \
- if (eldbl.ieee.exponent2 != 0) \
+ if (u.d[1].ieee.exponent != 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) \
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53; \
+ if (ediff > 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)) \
+ else if (ediff > 0) \
+ lo = lo >> ediff; \
+ else if (ediff < 0) \
+ lo = lo << -ediff; \
+ if (u.d[0].ieee.negative != u.d[1].ieee.negative \
+ && lo != 0) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \
@@ -58,7 +58,7 @@ do { \
/* we have a borrow from the hidden bit, so shift left 1. */ \
hi = 0xffffffffffffeLL | (lo >> 59); \
lo = 0xfffffffffffffffLL & (lo << 1); \
- eldbl.ieee.exponent--; \
+ u.d[0].ieee.exponent--; \
} \
else \
hi--; \
@@ -109,9 +109,9 @@ do { \
*--wnumstr = L'0'; \
} \
\
- leading = eldbl.ieee.exponent == 0 ? '0' : '1'; \
+ leading = u.d[0].ieee.exponent == 0 ? '0' : '1'; \
\
- exponent = eldbl.ieee.exponent; \
+ exponent = u.d[0].ieee.exponent; \
\
if (exponent == 0) \
{ \
@@ -121,18 +121,18 @@ do { \
{ \
/* This is a denormalized number. */ \
expnegative = 1; \
- exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1; \
+ exponent = IEEE754_DOUBLE_BIAS - 1; \
} \
} \
- else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS) \
+ else if (exponent >= IEEE754_DOUBLE_BIAS) \
{ \
expnegative = 0; \
- exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ exponent -= IEEE754_DOUBLE_BIAS; \
} \
else \
{ \
expnegative = 1; \
- exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS); \
+ exponent = -(exponent - IEEE754_DOUBLE_BIAS); \
} \
} while (0)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
index a833457ea..63c6edbb1 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
@@ -38,7 +38,10 @@ long double __asinhl(long double x)
{
long double t,w;
int64_t hx,ix;
- GET_LDOUBLE_MSW64(hx,x);
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx&0x7fffffffffffffffLL;
if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */
if(ix< 0x3e20000000000000LL) { /* |x|<2**-29 */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
index 2a36d16bb..41dde2399 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -173,23 +173,20 @@ static const long double
long double
__atanl (long double x)
{
- int k, sign;
+ int32_t k, sign, lx;
long double t, u, p, q;
- ieee854_long_double_shape_type s;
+ double xhi;
- s.value = x;
- k = s.parts32.w0;
- if (k & 0x80000000)
- sign = 1;
- else
- sign = 0;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (k, lx, xhi);
+ sign = k & 0x80000000;
/* Check for IEEE special cases. */
k &= 0x7fffffff;
if (k >= 0x7ff00000)
{
/* NaN. */
- if ((k & 0xfffff) | s.parts32.w1 )
+ if (((k - 0x7ff00000) | lx) != 0)
return (x + x);
/* Infinity. */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_cosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
index 23148392f..54c6cc77d 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
@@ -53,9 +53,11 @@ long double __cosl(long double x)
{
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;
/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
index 6a4475ed6..c861c65cc 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -760,16 +760,16 @@ long double
__erfl (long double x)
{
long double a, y, z;
- int32_t i, ix, sign;
- ieee854_long_double_shape_type u;
+ int32_t i, ix, hx;
+ double xhi;
- u.value = x;
- sign = u.parts32.w0;
- ix = sign & 0x7fffffff;
+ xhi = ldbl_high (x);
+ GET_HIGH_WORD (hx, xhi);
+ ix = hx & 0x7fffffff;
if (ix >= 0x7ff00000)
{ /* erf(nan)=nan */
- i = ((sign & 0xfff00000) >> 31) << 1;
+ i = ((uint32_t) hx >> 31) << 1;
return (long double) (1 - i) + one / x; /* erf(+-inf)=+-1 */
}
@@ -778,7 +778,7 @@ __erfl (long double x)
if (ix >= 0x4039A0DE)
{
/* __erfcl (x) underflows if x > 25.6283 */
- if (sign)
+ if ((hx & 0x80000000) == 0)
return one-tiny;
else
return tiny-one;
@@ -789,8 +789,9 @@ __erfl (long double x)
return (one - y);
}
}
- u.parts32.w0 = ix;
- a = u.value;
+ a = x;
+ if ((hx & 0x80000000) != 0)
+ a = -a;
z = x * x;
if (ix < 0x3fec0000) /* a < 0.875 */
{
@@ -814,7 +815,7 @@ __erfl (long double x)
y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2);
}
- if (sign & 0x80000000) /* x < 0 */
+ if (hx & 0x80000000) /* x < 0 */
y = -y;
return( y );
}
@@ -824,18 +825,18 @@ long double
__erfcl (long double x)
{
long double y, z, p, r;
- int32_t i, ix, sign;
- ieee854_long_double_shape_type u;
+ int32_t i, ix;
+ uint32_t hx;
+ double xhi;
- u.value = x;
- sign = u.parts32.w0;
- ix = sign & 0x7fffffff;
- u.parts32.w0 = ix;
+ xhi = ldbl_high (x);
+ GET_HIGH_WORD (hx, xhi);
+ ix = hx & 0x7fffffff;
if (ix >= 0x7ff00000)
{ /* erfc(nan)=nan */
/* erfc(+-inf)=0,2 */
- return (long double) (((u_int32_t) sign >> 31) << 1) + one / x;
+ return (long double) ((hx >> 31) << 1) + one / x;
}
if (ix < 0x3fd00000) /* |x| <1/4 */
@@ -846,7 +847,8 @@ __erfcl (long double x)
}
if (ix < 0x3ff40000) /* 1.25 */
{
- x = u.value;
+ if ((hx & 0x80000000) != 0)
+ x = -x;
i = 8.0 * x;
switch (i)
{
@@ -891,7 +893,7 @@ __erfcl (long double x)
y += C20a;
break;
}
- if (sign & 0x80000000)
+ if (hx & 0x80000000)
y = 2.0L - y;
return y;
}
@@ -899,10 +901,11 @@ __erfcl (long double x)
if (ix < 0x405ac000)
{
/* x < -9 */
- if ((ix >= 0x40220000) && (sign & 0x80000000))
+ if (hx >= 0xc0220000)
return two - tiny;
- x = fabsl (x);
+ if ((hx & 0x80000000) != 0)
+ x = -x;
z = one / (x * x);
i = 8.0 / x;
switch (i)
@@ -933,21 +936,17 @@ __erfcl (long double x)
p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
break;
}
- u.value = x;
- u.parts32.w3 = 0;
- u.parts32.w2 = 0;
- u.parts32.w1 &= 0xf8000000;
- z = u.value;
+ z = (float) x;
r = __ieee754_expl (-z * z - 0.5625) *
__ieee754_expl ((z - x) * (z + x) + p);
- if ((sign & 0x80000000) == 0)
+ if ((hx & 0x80000000) == 0)
return r / x;
else
return two - r / x;
}
else
{
- if ((sign & 0x80000000) == 0)
+ if ((hx & 0x80000000) == 0)
return tiny * tiny;
else
return two - tiny;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
index 8808dcd89..007e78534 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
@@ -92,19 +92,19 @@ long double
__expm1l (long double x)
{
long double px, qx, xx;
- int32_t ix, sign;
- ieee854_long_double_shape_type u;
+ int32_t ix, lx, sign;
int k;
+ double xhi;
/* Detect infinity and NaN. */
- u.value = x;
- ix = u.parts32.w0;
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (ix, lx, xhi);
sign = ix & 0x80000000;
ix &= 0x7fffffff;
if (ix >= 0x7ff00000)
{
/* Infinity. */
- if (((ix & 0xfffff) | u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ if (((ix - 0x7ff00000) | lx) == 0)
{
if (sign)
return -1.0L;
@@ -116,7 +116,7 @@ __expm1l (long double x)
}
/* expm1(+- 0) = +- 0. */
- if ((ix == 0) && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ if ((ix | lx) == 0)
return x;
/* Overflow. */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
index 99146d802..c801c9706 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
@@ -29,10 +29,16 @@ static char rcsid[] = "$NetBSD: $";
long double __fabsl(long double x)
{
u_int64_t hx, lx;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
lx = lx ^ ( hx & 0x8000000000000000LL );
hx = hx & 0x7fffffffffffffffLL;
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x;
}
long_double_symbol (libm, __fabsl, fabsl);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_finitel.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
index 8edb34154..7b4655fad 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
@@ -29,10 +29,14 @@ static char rcsid[] = "$NetBSD: $";
int
___finitel (long double x)
{
- int64_t hx;
- GET_LDOUBLE_MSW64(hx,x);
- return (int)((u_int64_t)((hx&0x7fffffffffffffffLL)
- -0x7ff0000000000000LL)>>63);
+ uint64_t hx;
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+ hx &= 0x7fffffffffffffffLL;
+ hx -= 0x7ff0000000000000LL;
+ return hx >> 63;
}
hidden_ver (___finitel, __finitel)
weak_alias (___finitel, ____finitel)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
index f4a90b08c..90586e822 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
@@ -46,8 +46,10 @@ ___fpclassifyl (long double x)
{
u_int64_t hx, lx;
int retval = FP_NORMAL;
+ double xhi, xlo;
- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) {
/* +/-NaN or +/-Inf */
if (hx & 0x000fffffffffffffULL) {
@@ -65,6 +67,7 @@ ___fpclassifyl (long double x)
retval = FP_NORMAL;
} else {
if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) {
+ EXTRACT_WORDS64 (lx, xlo);
if ((lx & 0x7fffffffffffffff) /* lower is non-zero */
&& ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */
/* +/- denormal */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
index 3ac537411..7e40663fd 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
@@ -36,16 +36,21 @@ two107 = 162259276829213363391578010288128.0; /* 0x4670000000000000, 0 */
long double __frexpl(long double x, int *eptr)
{
- u_int64_t hx, lx, ix, ixl;
+ uint64_t hx, lx, ix, ixl;
int64_t explo;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
ixl = 0x7fffffffffffffffULL&lx;
ix = 0x7fffffffffffffffULL&hx;
*eptr = 0;
- if(ix>=0x7ff0000000000000ULL||((ix|ixl)==0)) return x; /* 0,inf,nan */
+ if(ix>=0x7ff0000000000000ULL||ix==0) return x; /* 0,inf,nan */
if (ix<0x0010000000000000ULL) { /* subnormal */
x *= two107;
- GET_LDOUBLE_MSW64(hx,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx&0x7fffffffffffffffULL;
*eptr = -107;
}
@@ -54,7 +59,7 @@ long double __frexpl(long double x, int *eptr)
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
+ /* the lower double is a denormal so we need to correct its
mantissa and perhaps its exponent. */
int cnt;
@@ -73,7 +78,9 @@ long double __frexpl(long double x, int *eptr)
lx = 0ULL;
hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x;
}
#ifdef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c
index c8dd9ff98..54e72c916 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c
@@ -1,6 +1,7 @@
/*
* __isinf_nsl(x) returns != 0 if x is ±inf, else 0;
* no branching!
+ * slightly dodgy in relying on signed shift right copying sign bit
*/
#include <math.h>
@@ -9,8 +10,14 @@
int
__isinf_nsl (long double x)
{
- int64_t hx,lx;
- GET_LDOUBLE_WORDS64(hx,lx,x);
- return !((lx & 0x7fffffffffffffffLL)
- | ((hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL));
+ double xhi;
+ int64_t hx, mask;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+
+ mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
+ mask |= -mask;
+ mask >>= 63;
+ return ~mask;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
index 5f5b0144b..6a728221f 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
@@ -11,6 +11,7 @@ static char rcsid[] = "$NetBSD: $";
/*
* isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
* no branching!
+ * slightly dodgy in relying on signed shift right copying sign bit
*/
#include <math.h>
@@ -20,12 +21,16 @@ static char rcsid[] = "$NetBSD: $";
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);
+ double xhi;
+ int64_t hx, mask;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+
+ mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
+ mask |= -mask;
+ mask >>= 63;
+ return ~mask & (hx >> 62);
}
hidden_ver (___isinfl, __isinfl)
#ifndef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
index 264dec745..d12f1d3bf 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
@@ -29,12 +29,14 @@ static char rcsid[] = "$NetBSD: $";
int
___isnanl (long double x)
{
- int64_t hx;
- int64_t lx __attribute__ ((unused));
- GET_LDOUBLE_WORDS64(hx,lx,x);
- hx &= 0x7fffffffffffffffLL;
- hx = 0x7ff0000000000000LL - hx;
- return (int)((u_int64_t)hx>>63);
+ uint64_t hx;
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
+ hx &= 0x7fffffffffffffffLL;
+ hx = 0x7ff0000000000000LL - hx;
+ return (int) (hx >> 63);
}
hidden_ver (___isnanl, __isnanl)
#ifndef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c
index 96fab1aff..bdd58f8f2 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c
@@ -22,10 +22,13 @@
int
__issignalingl (long double x)
{
- u_int64_t xi;
+ uint64_t xi;
/* For inspecting NaN status, we only have to look at the first of the pair
of IEEE 754 64-bit precision numbers. */
- GET_LDOUBLE_MSW64 (xi, x);
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (xi, xhi);
#ifdef HIGH_ORDER_BIT_IS_SET_FOR_SNAN
# error untested
/* We only have to care about the high-order bit of x's significand, because
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
index 77c4fdea8..a34638305 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
@@ -126,19 +126,18 @@ long double
__log1pl (long double xm1)
{
long double x, y, z, r, s;
- ieee854_long_double_shape_type u;
- int32_t hx;
+ double xhi;
+ int32_t hx, lx;
int e;
/* Test for NaN or infinity input. */
- u.value = xm1;
- hx = u.parts32.w0;
+ xhi = ldbl_high (xm1);
+ EXTRACT_WORDS (hx, lx, xhi);
if (hx >= 0x7ff00000)
return xm1;
/* log1p(+- 0) = +- 0. */
- if (((hx & 0x7fffffff) == 0)
- && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ if (((hx & 0x7fffffff) | lx) == 0)
return xm1;
x = xm1 + 1.0L;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
index 6cbfcfa1c..e14028861 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -27,9 +27,10 @@ long double
__logbl (long double x)
{
int64_t hx, rhx;
- int64_t lx __attribute__ ((unused));
+ double xhi;
- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
hx &= 0x7fffffffffffffffLL; /* high |x| */
if (hx == 0)
return -1.0 / fabs (x);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_modfl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
index 39de9d4bf..ed03ce236 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
@@ -37,43 +37,54 @@ long double __modfl(long double x, long double *iptr)
{
int64_t i0,i1,j0;
u_int64_t i;
- GET_LDOUBLE_WORDS64(i0,i1,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (i0, xhi);
+ EXTRACT_WORDS64 (i1, xlo);
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);
+ INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
+ *iptr = xhi;
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);
+ INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
+ x = xhi;
return x;
} else {
- SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0);
+ INSERT_WORDS64 (xhi, i0&(~i));
+ *iptr = xhi;
return x - *iptr;
}
}
} else if (j0>103) { /* no fraction part */
*iptr = x*one;
/* We must handle NaNs separately. */
- if (j0 == 0x400 && ((i0 & 0x000fffffffffffffLL) | i1))
+ if ((i0 & 0x7fffffffffffffffLL) > 0x7ff0000000000000LL)
return x*one;
/* return +-0 */
- SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+ INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
+ x = xhi;
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);
+ INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
+ x = xhi;
return x;
} else {
- SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i));
+ INSERT_WORDS64 (xhi, i0);
+ INSERT_WORDS64 (xlo, i1&(~i));
+ *iptr = ldbl_pack (xhi, xlo);
return x - *iptr;
}
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
index bfcd11044..92ced5218 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -34,11 +34,11 @@ __nearbyintl (long double x)
fenv_t env;
static const long double TWO52 = 4503599627370496.0L;
union ibm_extended_long_double u;
- u.d = x;
+ u.ld = x;
- if (fabs (u.dd[0]) < TWO52)
+ if (fabs (u.d[0].d) < TWO52)
{
- double high = u.dd[0];
+ double high = u.d[0].d;
feholdexcept (&env);
if (high > 0.0)
{
@@ -52,13 +52,13 @@ __nearbyintl (long double x)
high += TWO52;
if (high == 0.0) high = -0.0;
}
- u.dd[0] = high;
- u.dd[1] = 0.0;
- math_force_eval (u.dd[0]);
- math_force_eval (u.dd[1]);
+ u.d[0].d = high;
+ u.d[1].d = 0.0;
+ math_force_eval (u.d[0]);
+ math_force_eval (u.d[1]);
fesetenv (&env);
}
- else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ else if (fabs (u.d[1].d) < TWO52 && u.d[1].d != 0.0)
{
double high, low, tau;
/* In this case we have to round the low double and handle any
@@ -67,57 +67,57 @@ __nearbyintl (long double x)
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.d[0].d > 0.0)
{
- if (u.dd[1] > 0.0)
+ if (u.d[1].d > 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];
+ high = u.d[0].d;
+ low = u.d[1].d;
}
- else if (u.dd[1] < 0.0)
+ else if (u.d[1].d < 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;
+ tau = __nextafter (u.d[0].d, 0.0);
+ tau = (u.d[0].d - tau) * 2.0;
+ high = u.d[0].d - tau;
+ low = u.d[1].d + tau;
}
low += TWO52;
low -= TWO52;
}
- else if (u.dd[0] < 0.0)
+ else if (u.d[0].d < 0.0)
{
- if (u.dd[1] < 0.0)
+ if (u.d[1].d < 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];
+ high = u.d[0].d;
+ low = u.d[1].d;
}
- else if (u.dd[1] > 0.0)
+ else if (u.d[1].d > 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;
+ tau = __nextafter (u.d[0].d, 0.0);
+ tau = (u.d[0].d - tau) * 2.0;
+ high = u.d[0].d - tau;
+ low = u.d[1].d + tau;
}
low = TWO52 - low;
low = -(low - TWO52);
}
- u.dd[0] = high + low;
- u.dd[1] = high - u.dd[0] + low;
- math_force_eval (u.dd[0]);
- math_force_eval (u.dd[1]);
+ u.d[0].d = high + low;
+ u.d[1].d = high - u.d[0].d + low;
+ math_force_eval (u.d[0]);
+ math_force_eval (u.d[1]);
fesetenv (&env);
}
- return u.d;
+ return u.ld;
}
long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
index 7e581274a..c050944c0 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
@@ -30,27 +30,28 @@ static char rcsid[] = "$NetBSD: $";
long double __nextafterl(long double x, long double y)
{
- int64_t hx,hy,ihx,ihy,ilx;
- u_int64_t lx;
- u_int64_t ly __attribute__ ((unused));
+ int64_t hx,hy,ihx,ihy;
+ uint64_t lx;
+ double xhi, xlo, yhi;
- GET_LDOUBLE_WORDS64(hx,lx,x);
- GET_LDOUBLE_WORDS64(hy,ly,y);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64 (hy, yhi);
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 */
+ if((ihx>0x7ff0000000000000LL) || /* x is nan */
+ (ihy>0x7ff0000000000000LL)) /* 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;
+ if(ihx == 0) { /* x == 0 */
+ long double u; /* return +-minsubnormal */
hy = (hy & 0x8000000000000000ULL) | 1;
- SET_LDOUBLE_WORDS64(x,hy,0ULL);/* return +-minsubnormal */
+ INSERT_WORDS64 (yhi, hy);
+ x = yhi;
u = math_opt_barrier (x);
u = u * u;
math_force_eval (u); /* raise underflow flag */
@@ -59,10 +60,16 @@ long double __nextafterl(long double x, long double y)
long double u;
if(x > y) { /* x > y, x -= ulp */
+ /* This isn't the largest magnitude correctly rounded
+ long double as you can see from the lowest mantissa
+ bit being zero. It is however the largest magnitude
+ long double with a 106 bit mantissa, and nextafterl
+ is insane with variable precision. So to make
+ nextafterl sane we assume 106 bit precision. */
if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL))
return x+x; /* overflow, return -inf */
if (hx >= 0x7ff0000000000000LL) {
- SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL);
+ u = 0x1.fffffffffffff7ffffffffffff8p+1023L;
return u;
}
if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */
@@ -77,16 +84,19 @@ long double __nextafterl(long double x, long double y)
return x;
}
if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
- SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+ INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
+ u = yhi;
u *= 0x1.0000000000000p-105L;
- } else
- SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+ } else {
+ INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
+ u = yhi;
+ }
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);
+ if ((uint64_t) hx >= 0xfff0000000000000ULL) {
+ u = -0x1.fffffffffffff7ffffffffffff8p+1023L;
return u;
}
if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */
@@ -103,10 +113,13 @@ long double __nextafterl(long double x, long double y)
return x;
}
if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
- SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+ INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
+ u = yhi;
u *= 0x1.0000000000000p-105L;
- } else
- SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+ } else {
+ INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
+ u = yhi;
+ }
return x + u;
}
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
index 7e288a436..b40cf167f 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
@@ -34,23 +34,22 @@ double __nexttoward(double x, long double y)
{
int32_t hx,ix;
int64_t hy,iy;
- u_int32_t lx;
- u_int64_t ly,uly;
+ uint32_t lx;
+ double yhi;
EXTRACT_WORDS(hx,lx,x);
- GET_LDOUBLE_WORDS64(hy,ly,y);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64(hy,yhi);
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 */
+ iy>0x7ff0000000000000LL) /* 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 */
+ INSERT_WORDS(x,(uint32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
u = math_opt_barrier (x);
u = u * u;
math_force_eval (u); /* raise underflow flag */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
index b387a9119..19522f476 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
@@ -27,16 +27,16 @@ float __nexttowardf(float x, long double y)
{
int32_t hx,ix;
int64_t hy,iy;
- u_int64_t ly, uly;
+ double yhi;
GET_FLOAT_WORD(hx,x);
- GET_LDOUBLE_WORDS64(hy,ly,y);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64 (hy, yhi);
ix = hx&0x7fffffff; /* |x| */
iy = hy&0x7fffffffffffffffLL; /* |y| */
- uly = ly&0x7fffffffffffffffLL; /* |y| */
if((ix>0x7f800000) || /* x is nan */
- ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+ (iy>0x7ff0000000000000LL))
/* y is nan */
return x+y;
if((long double) x==y) return y; /* x=y, return y */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
index f4777a0e1..195e108ca 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -33,20 +33,24 @@ __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);
+ double xhi, xlo, yhi, ylo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
+ ldbl_unpack (y, &yhi, &ylo);
+ EXTRACT_WORDS64 (hy, yhi);
+ EXTRACT_WORDS64 (ly, ylo);
sx = hx & 0x8000000000000000ULL;
qs = sx ^ (hy & 0x8000000000000000ULL);
hy &= 0x7fffffffffffffffLL;
hx &= 0x7fffffffffffffffLL;
/* Purge off exception values. */
- if ((hy | (ly & 0x7fffffffffffffff)) == 0)
+ if (hy == 0)
return (x * y) / (x * y); /* y = 0 */
if ((hx >= 0x7ff0000000000000LL) /* x not finite */
- || ((hy >= 0x7ff0000000000000LL) /* y is NaN */
- && (((hy - 0x7ff0000000000000LL) | ly) != 0)))
+ || (hy > 0x7ff0000000000000LL)) /* y is NaN */
return (x * y) / (x * y);
if (hy <= 0x7fbfffffffffffffLL)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
index d75256888..03d459727 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
@@ -41,11 +41,15 @@ long double __scalblnl (long double x, long int n)
{
int64_t k,l,hx,lx;
union { int64_t i; double d; } u;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
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 */
+ if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */
u.i = hx;
u.d *= two54;
hx = u.i;
@@ -61,7 +65,9 @@ long double __scalblnl (long double x, long int n)
if (k > 0) { /* normal result */
hx = (hx&0x800fffffffffffffULL)|(k<<52);
if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x;
}
if (l == 0) { /* low part subnormal */
@@ -81,14 +87,19 @@ long double __scalblnl (long double x, long int n)
u.d *= twom54;
lx = u.i;
}
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
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);
+ hx &= 0x800fffffffffffffULL;
+ INSERT_WORDS64 (xhi, hx|(k<<52));
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x*twolm54;
}
long_double_symbol (libm, __scalblnl, scalblnl);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
index bcdb23bda..161172db6 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
@@ -41,11 +41,15 @@ long double __scalbnl (long double x, int n)
{
int64_t k,l,hx,lx;
union { int64_t i; double d; } u;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
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 */
+ if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */
u.i = hx;
u.d *= two54;
hx = u.i;
@@ -61,7 +65,9 @@ long double __scalbnl (long double x, int n)
if (k > 0) { /* normal result */
hx = (hx&0x800fffffffffffffULL)|(k<<52);
if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x;
}
if (l == 0) { /* low part subnormal */
@@ -81,14 +87,19 @@ long double __scalbnl (long double x, int n)
u.d *= twom54;
lx = u.i;
}
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
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);
+ hx &= 0x800fffffffffffffULL;
+ INSERT_WORDS64 (xhi, hx|(k<<52));
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x*twolm54;
}
#ifdef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
index ee4aea6cf..aecb1fd79 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
@@ -25,8 +25,10 @@ int
___signbitl (long double x)
{
int64_t e;
+ double xhi;
- GET_LDOUBLE_MSW64 (e, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (e, xhi);
return e < 0;
}
#ifdef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
index 3b1e547bd..a9e2f3d19 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
@@ -27,9 +27,11 @@ void
__sincosl (long double x, long double *sinx, long double *cosx)
{
int64_t ix;
+ double xhi;
/* High word of x. */
- GET_LDOUBLE_MSW64 (ix, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_sinl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
index 6fec16f85..087921a91 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
@@ -53,9 +53,11 @@ long double __sinl(long double x)
{
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;
/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
index 138b63cd1..c63e25345 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
@@ -47,10 +47,12 @@ static const long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
long double __tanhl(long double x)
{
long double t,z;
- int64_t jx,ix,lx;
+ int64_t jx,ix;
+ double xhi;
/* High word of |x|. */
- GET_LDOUBLE_WORDS64(jx,lx,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (jx, xhi);
ix = jx&0x7fffffffffffffffLL;
/* x is INF or NaN */
@@ -61,7 +63,7 @@ long double __tanhl(long double x)
/* |x| < 22 */
if (ix < 0x4036000000000000LL) { /* |x|<22 */
- if ((ix | (lx&0x7fffffffffffffffLL)) == 0)
+ if (ix == 0)
return x; /* x == +-0 */
if (ix<0x3c60000000000000LL) /* |x|<2**-57 */
return x*(one+x); /* tanh(small) = small */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_tanl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
index 9967d0c20..66b8a0621 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
@@ -53,9 +53,11 @@ long double __tanl(long double x)
{
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;
/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
index 04e328857..93a80c5ee 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -43,11 +43,11 @@ libc_hidden_proto (STRTOF)
#define FLOAT_HUGE_VAL HUGE_VALL
# define SET_MANTISSA(flt, mant) \
do { union ibm_extended_long_double u; \
- u.d = (flt); \
- u.ieee_nan.mantissa0 = (mant) >> 32; \
- u.ieee_nan.mantissa1 = (mant); \
- if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
- (flt) = u.d; \
+ u.ld = (flt); \
+ u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \
+ u.d[0].ieee_nan.mantissa1 = (mant); \
+ if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \
+ (flt) = u.ld; \
} while (0)
#include <strtod_l.c>
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c b/libc/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
index ed0d4a506..06dcf02ff 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
@@ -89,23 +89,23 @@ __x2y2m1l (long double x, long double y)
double vals[12];
SET_RESTORE_ROUND (FE_TONEAREST);
union ibm_extended_long_double xu, yu;
- xu.d = x;
- yu.d = y;
- if (fabs (xu.dd[1]) < 0x1p-500)
- xu.dd[1] = 0.0;
- if (fabs (yu.dd[1]) < 0x1p-500)
- yu.dd[1] = 0.0;
- mul_split (&vals[1], &vals[0], xu.dd[0], xu.dd[0]);
- mul_split (&vals[3], &vals[2], xu.dd[0], xu.dd[1]);
+ xu.ld = x;
+ yu.ld = y;
+ if (fabs (xu.d[1].d) < 0x1p-500)
+ xu.d[1].d = 0.0;
+ if (fabs (yu.d[1].d) < 0x1p-500)
+ yu.d[1].d = 0.0;
+ mul_split (&vals[1], &vals[0], xu.d[0].d, xu.d[0].d);
+ mul_split (&vals[3], &vals[2], xu.d[0].d, xu.d[1].d);
vals[2] *= 2.0;
vals[3] *= 2.0;
- mul_split (&vals[5], &vals[4], xu.dd[1], xu.dd[1]);
- mul_split (&vals[7], &vals[6], yu.dd[0], yu.dd[0]);
- mul_split (&vals[9], &vals[8], yu.dd[0], yu.dd[1]);
+ mul_split (&vals[5], &vals[4], xu.d[1].d, xu.d[1].d);
+ mul_split (&vals[7], &vals[6], yu.d[0].d, yu.d[0].d);
+ mul_split (&vals[9], &vals[8], yu.d[0].d, yu.d[1].d);
vals[8] *= 2.0;
vals[9] *= 2.0;
- mul_split (&vals[11], &vals[10], yu.dd[1], yu.dd[1]);
- if (xu.dd[0] >= 0.75)
+ mul_split (&vals[11], &vals[10], yu.d[1].d, yu.d[1].d);
+ if (xu.d[0].d >= 0.75)
vals[1] -= 1.0;
else
{
diff --git a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
index f356a4843..715c93b50 100644
--- a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
+++ b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
@@ -25,11 +25,13 @@ do { \
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
assert (sizeof (long double) == 12); \
\
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
zero_mantissa = num == 0; \
\
@@ -62,7 +64,7 @@ do { \
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
if (exponent == 0) \
{ \
diff --git a/libc/sysdeps/mach/hurd/fork.c b/libc/sysdeps/mach/hurd/fork.c
index ab11babff..321421fbb 100644
--- a/libc/sysdeps/mach/hurd/fork.c
+++ b/libc/sysdeps/mach/hurd/fork.c
@@ -34,6 +34,11 @@
symbol_set_declare (_hurd_fork_locks)
+/* Application callbacks registered through pthread_atfork. */
+DEFINE_HOOK (_hurd_atfork_prepare_hook, (void));
+DEFINE_HOOK (_hurd_atfork_child_hook, (void));
+DEFINE_HOOK (_hurd_atfork_parent_hook, (void));
+
/* Things that want to be called before we fork, to prepare the parent for
task_create, when the new child task will inherit our address space. */
DEFINE_HOOK (_hurd_fork_prepare_hook, (void));
@@ -62,6 +67,8 @@ __fork (void)
error_t err;
struct hurd_sigstate *volatile ss;
+ RUN_HOOK (_hurd_atfork_prepare_hook, ());
+
ss = _hurd_self_sigstate ();
__spin_lock (&ss->critical_section_lock);
@@ -695,6 +702,14 @@ __fork (void)
_hurd_critical_section_unlock (ss);
+ if (!err)
+ {
+ if (pid != 0)
+ RUN_HOOK (_hurd_atfork_parent_hook, ());
+ else
+ RUN_HOOK (_hurd_atfork_child_hook, ());
+ }
+
return err ? __hurd_fail (err) : pid;
}
libc_hidden_def (__fork)
diff --git a/libc/sysdeps/mach/hurd/i386/tls.h b/libc/sysdeps/mach/hurd/i386/tls.h
index 4f4c7c5df..da8c16aa0 100644
--- a/libc/sysdeps/mach/hurd/i386/tls.h
+++ b/libc/sysdeps/mach/hurd/i386/tls.h
@@ -118,7 +118,6 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(descr, secondcall) \
_hurd_tls_init ((tcbhead_t *) (descr), (secondcall))
-# define TLS_INIT_TP_EXPENSIVE 1
/* Return the TCB address of the current thread. */
# define THREAD_SELF \
diff --git a/libc/sysdeps/posix/dirstream.h b/libc/sysdeps/posix/dirstream.h
index 8e8570dd4..be2089505 100644
--- a/libc/sysdeps/posix/dirstream.h
+++ b/libc/sysdeps/posix/dirstream.h
@@ -41,8 +41,13 @@ struct __dirstream
int errcode; /* Delayed error code. */
- /* Directory block. */
- char data[0] __attribute__ ((aligned (__alignof__ (void*))));
+ /* Directory block. We must make sure that this block starts
+ at an address that is aligned adequately enough to store
+ dirent entries. Using the alignment of "void *" is not
+ sufficient because dirents on 32-bit platforms can require
+ 64-bit alignment. We use "long double" here to be consistent
+ with what malloc uses. */
+ char data[0] __attribute__ ((aligned (__alignof__ (long double))));
};
#define _DIR_dirfd(dirp) ((dirp)->fd)
diff --git a/libc/sysdeps/posix/getaddrinfo.c b/libc/sysdeps/posix/getaddrinfo.c
index 52177e454..0f4b88514 100644
--- a/libc/sysdeps/posix/getaddrinfo.c
+++ b/libc/sysdeps/posix/getaddrinfo.c
@@ -558,16 +558,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
struct gaih_addrtuple **pat = &at;
int no_data = 0;
int no_inet6_data = 0;
- service_user *nip = NULL;
+ service_user *nip;
enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
int old_res_options;
- /* If we do not have to look for IPv6 addresses, use
- the simple, old functions, which do not support
- IPv6 scope ids. */
- if (req->ai_family == AF_INET)
+ /* If we do not have to look for IPv6 addresses or the canonical
+ name, use the simple, old functions, which do not support
+ IPv6 scope ids, nor retrieving the canonical name. */
+ if (req->ai_family == AF_INET
+ && (req->ai_flags & AI_CANONNAME) == 0)
{
/* Allocate additional room for struct host_data. */
size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*)
@@ -791,15 +792,13 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
#endif
- if (__nss_hosts_database != NULL)
- {
- no_more = 0;
- nip = __nss_hosts_database;
- }
- else
+ if (__nss_hosts_database == NULL)
no_more = __nss_database_lookup ("hosts", NULL,
"dns [!UNAVAIL=return] files",
- &nip);
+ &__nss_hosts_database);
+ else
+ no_more = 0;
+ nip = __nss_hosts_database;
/* Initialize configurations. */
if (__glibc_unlikely (!_res_hconf.initialized))
@@ -1011,8 +1010,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
canon = s;
else
{
- /* Set to name now to avoid using
- gethostbyaddr. */
+ /* If the canonical name cannot be
+ determined, use the passed in
+ string. */
if (malloc_canonbuf)
{
free (canonbuf);
@@ -1127,70 +1127,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
/* Only the first entry gets the canonical name. */
if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
{
- char *tmpbuf2 = NULL;
- bool malloc_tmpbuf2 = false;
-
if (canon == NULL)
- {
- struct hostent *h = NULL;
- int herrno;
- struct hostent th;
- /* Add room for struct host_data. */
- size_t tmpbuf2len = (512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)
- * sizeof(char*) + 16 * sizeof(char));
-
- do
- {
- if (__libc_use_alloca (alloca_used + 2 * tmpbuf2len))
- tmpbuf2 = extend_alloca_account (tmpbuf2, tmpbuf2len,
- tmpbuf2len * 2,
- alloca_used);
- else
- {
- char *newp = realloc (malloc_tmpbuf2 ? tmpbuf2 : NULL,
- 2 * tmpbuf2len);
- if (newp == NULL)
- {
- if (malloc_tmpbuf2)
- free (tmpbuf2);
- result = -EAI_MEMORY;
- goto free_and_return;
- }
-
- tmpbuf2 = newp;
- tmpbuf2len = 2 * tmpbuf2len;
- malloc_tmpbuf2 = true;
- }
-
- rc = __gethostbyaddr_r (at2->addr,
- ((at2->family == AF_INET6)
- ? sizeof (struct in6_addr)
- : sizeof (struct in_addr)),
- at2->family, &th, tmpbuf2,
- tmpbuf2len, &h, &herrno);
- }
- while (rc == ERANGE && herrno == NETDB_INTERNAL);
-
- if (rc != 0 && herrno == NETDB_INTERNAL)
- {
- if (malloc_tmpbuf2)
- free (tmpbuf2);
-
- __set_h_errno (herrno);
- result = -EAI_SYSTEM;
- goto free_and_return;
- }
-
- if (h != NULL)
- canon = h->h_name;
- else
- {
- assert (orig_name != NULL);
- /* If the canonical name cannot be determined, use
- the passed in string. */
- canon = orig_name;
- }
- }
+ /* If the canonical name cannot be determined, use
+ the passed in string. */
+ canon = orig_name;
#ifdef HAVE_LIBIDN
if (req->ai_flags & AI_CANONIDN)
@@ -1205,9 +1145,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
if (rc != IDNA_SUCCESS)
{
- if (malloc_tmpbuf2)
- free (tmpbuf2);
-
if (rc == IDNA_MALLOC_ERROR)
result = -EAI_MEMORY;
else if (rc == IDNA_DLOPEN_ERROR)
@@ -1237,17 +1174,11 @@ gaih_inet (const char *name, const struct gaih_service *service,
canon = strdup (canon);
if (canon == NULL)
{
- if (malloc_tmpbuf2)
- free (tmpbuf2);
-
result = -EAI_MEMORY;
goto free_and_return;
}
}
}
-
- if (malloc_tmpbuf2)
- free (tmpbuf2);
}
family = at2->family;
diff --git a/libc/sysdeps/powerpc/bits/fenv.h b/libc/sysdeps/powerpc/bits/fenv.h
index 07cd3c8e5..122edd3dc 100644
--- a/libc/sysdeps/powerpc/bits/fenv.h
+++ b/libc/sysdeps/powerpc/bits/fenv.h
@@ -19,75 +19,6 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
-#if defined __NO_FPRS__ && !defined _SOFT_FLOAT /* E500 */
-
-/* Define bits representing the exception. We use the bit positions of
- the appropriate bits in the SPEFSCR... */
-enum
- {
- FE_INEXACT =
-#define FE_INEXACT (1 << (63 - 42))
- FE_INEXACT,
- FE_INVALID =
-#define FE_INVALID (1 << (63 - 43))
- FE_INVALID,
- FE_DIVBYZERO =
-#define FE_DIVBYZERO (1 << (63 - 44))
- FE_DIVBYZERO,
- FE_UNDERFLOW =
-#define FE_UNDERFLOW (1 << (63 - 45))
- FE_UNDERFLOW,
- FE_OVERFLOW =
-#define FE_OVERFLOW (1 << (63 - 46))
- FE_OVERFLOW
- };
-
-#define FE_ALL_EXCEPT \
- (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The E500 support all of the four defined rounding modes. We use
- the bit pattern in the SPEFSCR as the values for the appropriate
- macros. */
-enum
- {
- FE_TONEAREST =
-#define FE_TONEAREST 0
- FE_TONEAREST,
- FE_TOWARDZERO =
-#define FE_TOWARDZERO 1
- FE_TOWARDZERO,
- FE_UPWARD =
-#define FE_UPWARD 2
- FE_UPWARD,
- FE_DOWNWARD =
-#define FE_DOWNWARD 3
- FE_DOWNWARD
- };
-
-/* Type representing exception flags. */
-typedef unsigned int fexcept_t;
-
-typedef double fenv_t;
-
-/* If the default argument is used we use this value. */
-extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env)
-
-#ifdef __USE_GNU
-/* Floating-point environment where all exceptions are enabled. Note that
- this is not sufficient to give you SIGFPE. */
-extern const fenv_t __fe_enabled_env;
-# define FE_ENABLED_ENV (&__fe_enabled_env)
-
-/* Floating-point environment with all exceptions enabled. Note that
- just evaluating this value will set the processor into 'FPU
- exceptions imprecise recoverable' mode, which may cause a significant
- performance penalty (but have no other visible effect). */
-extern const fenv_t *__fe_nomask_env (void);
-# define FE_NOMASK_ENV (__fe_nomask_env ())
-#endif
-
-#else /* PowerPC 6xx floating-point. */
/* Define bits representing the exception. We use the bit positions of
the appropriate bits in the FPSCR... */
@@ -244,5 +175,3 @@ extern const fenv_t *__fe_mask_env (void);
__END_DECLS
#endif
-
-#endif
diff --git a/libc/sysdeps/powerpc/bits/mathinline.h b/libc/sysdeps/powerpc/bits/mathinline.h
index 140fff08e..cef5b29b1 100644
--- a/libc/sysdeps/powerpc/bits/mathinline.h
+++ b/libc/sysdeps/powerpc/bits/mathinline.h
@@ -61,21 +61,28 @@
__MATH_INLINE int
__NTH (__signbitf (float __x))
{
+#if __GNUC_PREREQ (4, 0)
+ return __builtin_signbitf (__x);
+#else
__extension__ union { float __f; int __i; } __u = { __f: __x };
return __u.__i < 0;
+#endif
}
__MATH_INLINE int
__NTH (__signbit (double __x))
{
- __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
- return __u.__i[0] < 0;
+#if __GNUC_PREREQ (4, 0)
+ return __builtin_signbit (__x);
+#else
+ __extension__ union { double __d; long long __i; } __u = { __d: __x };
+ return __u.__i < 0;
+#endif
}
# ifdef __LONG_DOUBLE_128__
__MATH_INLINE int
__NTH (__signbitl (long double __x))
{
- __extension__ union { long double __d; int __i[4]; } __u = { __d: __x };
- return __u.__i[0] < 0;
+ return __signbit ((double) __x);
}
# endif
# endif
@@ -92,22 +99,17 @@ __NTH (lrint (double __x))
{
union {
double __d;
- int __ll[2];
+ long long __ll;
} __u;
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
- return __u.__ll[1];
+ return __u.__ll;
}
__MATH_INLINE long int lrintf (float __x) __THROW;
__MATH_INLINE long int
__NTH (lrintf (float __x))
{
- union {
- double __d;
- int __ll[2];
- } __u;
- __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
- return __u.__ll[1];
+ return lrint ((double) __x);
}
# endif
diff --git a/libc/sysdeps/powerpc/ffs.c b/libc/sysdeps/powerpc/ffs.c
index e0fee46b3..deba0cdd0 100644
--- a/libc/sysdeps/powerpc/ffs.c
+++ b/libc/sysdeps/powerpc/ffs.c
@@ -35,6 +35,7 @@ __ffs (int x)
return 32 - cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
#undef ffsl
diff --git a/libc/sysdeps/powerpc/fpu/e_sqrt.c b/libc/sysdeps/powerpc/fpu/e_sqrt.c
index 3efe277f3..2d50fb525 100644
--- a/libc/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/libc/sysdeps/powerpc/fpu/e_sqrt.c
@@ -145,7 +145,7 @@ __slow_ieee754_sqrt (double x)
feraiseexcept (FE_INVALID_SQRT);
fenv_union_t u = { .fenv = fegetenv_register () };
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
#endif
feraiseexcept (FE_INVALID);
x = a_nan.value;
diff --git a/libc/sysdeps/powerpc/fpu/e_sqrtf.c b/libc/sysdeps/powerpc/fpu/e_sqrtf.c
index 6e50a3cd7..91d2d37d7 100644
--- a/libc/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/libc/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -121,7 +121,7 @@ __slow_ieee754_sqrtf (float x)
feraiseexcept (FE_INVALID_SQRT);
fenv_union_t u = { .fenv = fegetenv_register () };
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
#endif
feraiseexcept (FE_INVALID);
x = a_nan.value;
diff --git a/libc/sysdeps/powerpc/fpu/fclrexcpt.c b/libc/sysdeps/powerpc/fpu/fclrexcpt.c
index 86575dba6..7f66e21ce 100644
--- a/libc/sysdeps/powerpc/fpu/fclrexcpt.c
+++ b/libc/sysdeps/powerpc/fpu/fclrexcpt.c
@@ -28,8 +28,8 @@ __feclearexcept (int excepts)
u.fenv = fegetenv_register ();
/* Clear the relevant bits. */
- u.l[1] = u.l[1] & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
- | (excepts & FPSCR_STICKY_BITS));
+ u.l = u.l & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
+ | (excepts & FPSCR_STICKY_BITS));
/* Put the new state in effect. */
fesetenv_register (u.fenv);
diff --git a/libc/sysdeps/powerpc/fpu/fedisblxcpt.c b/libc/sysdeps/powerpc/fpu/fedisblxcpt.c
index 659566b67..f2c45a60c 100644
--- a/libc/sysdeps/powerpc/fpu/fedisblxcpt.c
+++ b/libc/sysdeps/powerpc/fpu/fedisblxcpt.c
@@ -32,15 +32,15 @@ fedisableexcept (int excepts)
fe.fenv = fegetenv_register ();
if (excepts & FE_INEXACT)
- fe.l[1] &= ~(1 << (31 - FPSCR_XE));
+ fe.l &= ~(1 << (31 - FPSCR_XE));
if (excepts & FE_DIVBYZERO)
- fe.l[1] &= ~(1 << (31 - FPSCR_ZE));
+ fe.l &= ~(1 << (31 - FPSCR_ZE));
if (excepts & FE_UNDERFLOW)
- fe.l[1] &= ~(1 << (31 - FPSCR_UE));
+ fe.l &= ~(1 << (31 - FPSCR_UE));
if (excepts & FE_OVERFLOW)
- fe.l[1] &= ~(1 << (31 - FPSCR_OE));
+ fe.l &= ~(1 << (31 - FPSCR_OE));
if (excepts & FE_INVALID)
- fe.l[1] &= ~(1 << (31 - FPSCR_VE));
+ fe.l &= ~(1 << (31 - FPSCR_VE));
fesetenv_register (fe.fenv);
new = __fegetexcept ();
diff --git a/libc/sysdeps/powerpc/fpu/feenablxcpt.c b/libc/sysdeps/powerpc/fpu/feenablxcpt.c
index fc4bfffad..472796d15 100644
--- a/libc/sysdeps/powerpc/fpu/feenablxcpt.c
+++ b/libc/sysdeps/powerpc/fpu/feenablxcpt.c
@@ -32,15 +32,15 @@ feenableexcept (int excepts)
fe.fenv = fegetenv_register ();
if (excepts & FE_INEXACT)
- fe.l[1] |= (1 << (31 - FPSCR_XE));
+ fe.l |= (1 << (31 - FPSCR_XE));
if (excepts & FE_DIVBYZERO)
- fe.l[1] |= (1 << (31 - FPSCR_ZE));
+ fe.l |= (1 << (31 - FPSCR_ZE));
if (excepts & FE_UNDERFLOW)
- fe.l[1] |= (1 << (31 - FPSCR_UE));
+ fe.l |= (1 << (31 - FPSCR_UE));
if (excepts & FE_OVERFLOW)
- fe.l[1] |= (1 << (31 - FPSCR_OE));
+ fe.l |= (1 << (31 - FPSCR_OE));
if (excepts & FE_INVALID)
- fe.l[1] |= (1 << (31 - FPSCR_VE));
+ fe.l |= (1 << (31 - FPSCR_VE));
fesetenv_register (fe.fenv);
new = __fegetexcept ();
diff --git a/libc/sysdeps/powerpc/fpu/fegetexcept.c b/libc/sysdeps/powerpc/fpu/fegetexcept.c
index f3d5724e9..23d47a27e 100644
--- a/libc/sysdeps/powerpc/fpu/fegetexcept.c
+++ b/libc/sysdeps/powerpc/fpu/fegetexcept.c
@@ -27,15 +27,15 @@ __fegetexcept (void)
fe.fenv = fegetenv_register ();
- if (fe.l[1] & (1 << (31 - FPSCR_XE)))
+ if (fe.l & (1 << (31 - FPSCR_XE)))
result |= FE_INEXACT;
- if (fe.l[1] & (1 << (31 - FPSCR_ZE)))
+ if (fe.l & (1 << (31 - FPSCR_ZE)))
result |= FE_DIVBYZERO;
- if (fe.l[1] & (1 << (31 - FPSCR_UE)))
+ if (fe.l & (1 << (31 - FPSCR_UE)))
result |= FE_UNDERFLOW;
- if (fe.l[1] & (1 << (31 - FPSCR_OE)))
+ if (fe.l & (1 << (31 - FPSCR_OE)))
result |= FE_OVERFLOW;
- if (fe.l[1] & (1 << (31 - FPSCR_VE)))
+ if (fe.l & (1 << (31 - FPSCR_VE)))
result |= FE_INVALID;
return result;
diff --git a/libc/sysdeps/powerpc/fpu/feholdexcpt.c b/libc/sysdeps/powerpc/fpu/feholdexcpt.c
index 013d2bfbb..0ecf0f7bc 100644
--- a/libc/sysdeps/powerpc/fpu/feholdexcpt.c
+++ b/libc/sysdeps/powerpc/fpu/feholdexcpt.c
@@ -30,13 +30,12 @@ feholdexcept (fenv_t *envp)
/* Clear everything except for the rounding modes and non-IEEE arithmetic
flag. */
- new.l[1] = old.l[1] & 7;
- new.l[0] = old.l[0];
+ new.l = old.l & 0xffffffff00000007LL;
/* If the old env had any enabled exceptions, then mask SIGFPE in the
MSR FE0/FE1 bits. This may allow the FPU to run faster because it
always takes the default action and can not generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) != 0)
(void)__fe_mask_env ();
/* Put the new state in effect. */
diff --git a/libc/sysdeps/powerpc/fpu/fenv_libc.h b/libc/sysdeps/powerpc/fpu/fenv_libc.h
index 191095156..baa2a7d39 100644
--- a/libc/sysdeps/powerpc/fpu/fenv_libc.h
+++ b/libc/sysdeps/powerpc/fpu/fenv_libc.h
@@ -69,7 +69,7 @@ libm_hidden_proto (__fe_nomask_env)
typedef union
{
fenv_t fenv;
- unsigned int l[2];
+ unsigned long long l;
} fenv_union_t;
diff --git a/libc/sysdeps/powerpc/fpu/fesetenv.c b/libc/sysdeps/powerpc/fpu/fesetenv.c
index e92adb4c5..6c00b267a 100644
--- a/libc/sysdeps/powerpc/fpu/fesetenv.c
+++ b/libc/sysdeps/powerpc/fpu/fesetenv.c
@@ -34,14 +34,14 @@ __fesetenv (const fenv_t *envp)
exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits. This will put the
hardware into "precise mode" and may cause the FPU to run slower on some
hardware. */
- if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
(void)__fe_nomask_env ();
/* If the old env had any enabled exceptions and the new env has no enabled
exceptions, then mask SIGFPE in the MSR FE0/FE1 bits. This may allow the
FPU to run faster because it always takes the default action and can not
generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
+ if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
(void)__fe_mask_env ();
fesetenv_register (*envp);
diff --git a/libc/sysdeps/powerpc/fpu/feupdateenv.c b/libc/sysdeps/powerpc/fpu/feupdateenv.c
index 6500ea173..677504416 100644
--- a/libc/sysdeps/powerpc/fpu/feupdateenv.c
+++ b/libc/sysdeps/powerpc/fpu/feupdateenv.c
@@ -34,20 +34,20 @@ __feupdateenv (const fenv_t *envp)
/* Restore rounding mode and exception enable from *envp and merge
exceptions. Leave fraction rounded/inexact and FP result/CC bits
unchanged. */
- new.l[1] = (old.l[1] & 0x1FFFFF00) | (new.l[1] & 0x1FF80FFF);
+ new.l = (old.l & 0xffffffff1fffff00LL) | (new.l & 0x1ff80fff);
/* If the old env has no enabled exceptions and the new env has any enabled
exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits. This will put
the hardware into "precise mode" and may cause the FPU to run slower on
some hardware. */
- if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
(void)__fe_nomask_env ();
/* If the old env had any enabled exceptions and the new env has no enabled
exceptions, then mask SIGFPE in the MSR FE0/FE1 bits. This may allow the
FPU to run faster because it always takes the default action and can not
generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
+ if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
(void)__fe_mask_env ();
/* Atomically enable and raise (if appropriate) exceptions set in `new'. */
diff --git a/libc/sysdeps/powerpc/fpu/fgetexcptflg.c b/libc/sysdeps/powerpc/fpu/fgetexcptflg.c
index f6327ce17..1395bede0 100644
--- a/libc/sysdeps/powerpc/fpu/fgetexcptflg.c
+++ b/libc/sysdeps/powerpc/fpu/fgetexcptflg.c
@@ -27,7 +27,7 @@ __fegetexceptflag (fexcept_t *flagp, int excepts)
u.fenv = fegetenv_register ();
/* Return (all of) it. */
- *flagp = u.l[1] & excepts & FE_ALL_EXCEPT;
+ *flagp = u.l & excepts & FE_ALL_EXCEPT;
/* Success. */
return 0;
diff --git a/libc/sysdeps/powerpc/fpu/fraiseexcpt.c b/libc/sysdeps/powerpc/fpu/fraiseexcpt.c
index 9118c1954..6193071bd 100644
--- a/libc/sysdeps/powerpc/fpu/fraiseexcpt.c
+++ b/libc/sysdeps/powerpc/fpu/fraiseexcpt.c
@@ -33,11 +33,11 @@ __feraiseexcept (int excepts)
u.fenv = fegetenv_register ();
/* Add the exceptions */
- u.l[1] = (u.l[1]
- | (excepts & FPSCR_STICKY_BITS)
- /* Turn FE_INVALID into FE_INVALID_SOFTWARE. */
- | (excepts >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
- & FE_INVALID_SOFTWARE));
+ u.l = (u.l
+ | (excepts & FPSCR_STICKY_BITS)
+ /* Turn FE_INVALID into FE_INVALID_SOFTWARE. */
+ | (excepts >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
+ & FE_INVALID_SOFTWARE));
/* Store the new status word (along with the rest of the environment),
triggering any appropriate exceptions. */
@@ -49,7 +49,7 @@ __feraiseexcept (int excepts)
don't have FE_INVALID_SOFTWARE implemented. Detect this
case and raise FE_INVALID_SNAN instead. */
u.fenv = fegetenv_register ();
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
set_fpscr_bit (FPSCR_VXSNAN);
}
diff --git a/libc/sysdeps/powerpc/fpu/fsetexcptflg.c b/libc/sysdeps/powerpc/fpu/fsetexcptflg.c
index c050d4022..0d309c8d5 100644
--- a/libc/sysdeps/powerpc/fpu/fsetexcptflg.c
+++ b/libc/sysdeps/powerpc/fpu/fsetexcptflg.c
@@ -31,10 +31,10 @@ __fesetexceptflag (const fexcept_t *flagp, int excepts)
flag = *flagp & excepts;
/* Replace the exception status */
- u.l[1] = ((u.l[1] & ~(FPSCR_STICKY_BITS & excepts))
- | (flag & FPSCR_STICKY_BITS)
- | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
- & FE_INVALID_SOFTWARE));
+ u.l = ((u.l & ~(FPSCR_STICKY_BITS & excepts))
+ | (flag & FPSCR_STICKY_BITS)
+ | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
+ & FE_INVALID_SOFTWARE));
/* Store the new status word (along with the rest of the environment).
This may cause floating-point exceptions if the restored state
diff --git a/libc/sysdeps/powerpc/fpu/ftestexcept.c b/libc/sysdeps/powerpc/fpu/ftestexcept.c
index 0dbc3befb..86eea0fb0 100644
--- a/libc/sysdeps/powerpc/fpu/ftestexcept.c
+++ b/libc/sysdeps/powerpc/fpu/ftestexcept.c
@@ -28,6 +28,6 @@ fetestexcept (int excepts)
/* The FE_INVALID bit is dealt with correctly by the hardware, so we can
just: */
- return u.l[1] & excepts;
+ return u.l & excepts;
}
libm_hidden_def (fetestexcept)
diff --git a/libc/sysdeps/powerpc/fpu/libm-test-ulps b/libc/sysdeps/powerpc/fpu/libm-test-ulps
index 6fdace9ee..37b2ca192 100644
--- a/libc/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/libc/sysdeps/powerpc/fpu/libm-test-ulps
@@ -5927,11 +5927,31 @@ double: 1
idouble: 1
# gamma
+Test "gamma (-0x1p-10)":
+double: 1
+idouble: 1
+Test "gamma (-0x1p-15)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "gamma (-0x1p-20)":
+double: 1
+idouble: 1
+Test "gamma (-0x1p-5)":
+double: 1
+idouble: 1
Test "gamma (0.7)":
double: 1
float: 1
idouble: 1
ifloat: 1
+Test "gamma (0x1p-10)":
+float: 1
+ifloat: 1
+Test "gamma (0x1p-30)":
+double: 1
+idouble: 1
Test "gamma (1.2)":
double: 1
float: 2
@@ -6131,9 +6151,9 @@ ildouble: 1
ldouble: 1
Test "jn (10, 10.0)":
double: 2
-float: 1
+float: 2
idouble: 2
-ifloat: 1
+ifloat: 2
ildouble: 4
ldouble: 4
Test "jn (10, 2.0)":
@@ -6146,6 +6166,14 @@ double: 2
float: 2
idouble: 2
ifloat: 2
+Test "jn (2, 0x1p1023)":
+ildouble: 1
+ldouble: 1
+Test "jn (2, 0x1p127)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
Test "jn (2, 2.4048255576957729)":
double: 2
float: 1
@@ -6226,11 +6254,31 @@ ildouble: 7
ldouble: 7
# lgamma
+Test "lgamma (-0x1p-10)":
+double: 1
+idouble: 1
+Test "lgamma (-0x1p-15)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (-0x1p-20)":
+double: 1
+idouble: 1
+Test "lgamma (-0x1p-5)":
+double: 1
+idouble: 1
Test "lgamma (0.7)":
double: 1
float: 1
idouble: 1
ifloat: 1
+Test "lgamma (0x1p-10)":
+float: 1
+ifloat: 1
+Test "lgamma (0x1p-30)":
+double: 1
+idouble: 1
Test "lgamma (1.2)":
double: 1
float: 2
@@ -6592,6 +6640,9 @@ float: 1
ifloat: 1
ildouble: 2
ldouble: 2
+Test "tan_towardzero (2)":
+ildouble: 1
+ldouble: 1
Test "tan_towardzero (3)":
float: 1
ifloat: 1
@@ -7334,6 +7385,19 @@ idouble: 3
ifloat: 1
ildouble: 1
ldouble: 1
+Test "yn (2, 0x1.ffff62p+99)":
+double: 1
+idouble: 1
+Test "yn (2, 0x1p1023)":
+ildouble: 1
+ldouble: 1
+Test "yn (2, 0x1p127)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Test "yn (3, 0.125)":
double: 1
idouble: 1
diff --git a/libc/sysdeps/powerpc/fpu/s_float_bitwise.h b/libc/sysdeps/powerpc/fpu/s_float_bitwise.h
index 8e4adca86..c0a4e56be 100644
--- a/libc/sysdeps/powerpc/fpu/s_float_bitwise.h
+++ b/libc/sysdeps/powerpc/fpu/s_float_bitwise.h
@@ -23,18 +23,19 @@
#include <math_private.h>
/* Returns (int)(num & 0x7FFFFFF0 == value) */
-static inline
-int __float_and_test28 (float num, float value)
+static inline int
+__float_and_test28 (float num, float value)
{
float ret;
#ifdef _ARCH_PWR7
- vector int mask = (vector int) {
- 0x7ffffffe, 0x00000000, 0x00000000, 0x0000000
- };
+ union {
+ int i;
+ float f;
+ } mask = { .i = 0x7ffffff0 };
__asm__ (
- /* the 'f' constrain is use on mask because we just need
+ /* the 'f' constraint is used on mask because we just need
* to compare floats, not full vector */
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
);
#else
int32_t inum;
@@ -46,16 +47,17 @@ int __float_and_test28 (float num, float value)
}
/* Returns (int)(num & 0x7FFFFF00 == value) */
-static inline
-int __float_and_test24 (float num, float value)
+static inline int
+__float_and_test24 (float num, float value)
{
float ret;
#ifdef _ARCH_PWR7
- vector int mask = (vector int) {
- 0x7fffffe0, 0x00000000, 0x00000000, 0x0000000
- };
+ union {
+ int i;
+ float f;
+ } mask = { .i = 0x7fffff00 };
__asm__ (
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
);
#else
int32_t inum;
@@ -67,16 +69,17 @@ int __float_and_test24 (float num, float value)
}
/* Returns (float)(num & 0x7F800000) */
-static inline
-float __float_and8 (float num)
+static inline float
+__float_and8 (float num)
{
float ret;
#ifdef _ARCH_PWR7
- vector int mask = (vector int) {
- 0x7ff00000, 0x00000000, 0x00000000, 0x00000000
- };
+ union {
+ int i;
+ float f;
+ } mask = { .i = 0x7f800000 };
__asm__ (
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
);
#else
int32_t inum;
@@ -88,17 +91,18 @@ float __float_and8 (float num)
}
/* Returns ((int32_t)(num & 0x7F800000) >> 23) */
-static inline
-int32_t __float_get_exp (float num)
+static inline int32_t
+__float_get_exp (float num)
{
int32_t inum;
#ifdef _ARCH_PWR7
float ret;
- vector int mask = (vector int) {
- 0x7ff00000, 0x00000000, 0x00000000, 0x00000000
- };
+ union {
+ int i;
+ float f;
+ } mask = { .i = 0x7f800000 };
__asm__ (
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
);
GET_FLOAT_WORD(inum, ret);
#else
diff --git a/libc/sysdeps/powerpc/fpu/s_llround.c b/libc/sysdeps/powerpc/fpu/s_llround.c
index 9a0182653..995d0a724 100644
--- a/libc/sysdeps/powerpc/fpu/s_llround.c
+++ b/libc/sysdeps/powerpc/fpu/s_llround.c
@@ -19,29 +19,28 @@
#include <math.h>
#include <math_ldbl_opt.h>
-/* I think that what this routine is supposed to do is round a value
- to the nearest integer, with values exactly on the boundary rounded
- away from zero. */
-/* This routine relies on (long long)x, when x is out of range of a long long,
- clipping to MAX_LLONG or MIN_LLONG. */
+/* Round to the nearest integer, with values exactly on a 0.5 boundary
+ rounded away from zero, regardless of the current rounding mode.
+ If (long long)x, when x is out of range of a long long, clips at
+ LLONG_MAX or LLONG_MIN, then this implementation also clips. */
long long int
__llround (double x)
{
- double xrf;
- long long int xr;
- xr = (long long int) x;
- xrf = (double) xr;
+ long long xr = (long long) x;
+ double xrf = (double) xr;
+
if (x >= 0.0)
- if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
- return x+1;
- else
- return x;
+ {
+ if (x - xrf >= 0.5)
+ xr += (long long) ((unsigned long long) xr + 1) > 0;
+ }
else
- if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0)
- return x-1;
- else
- return x;
+ {
+ if (xrf - x >= 0.5)
+ xr -= (long long) ((unsigned long long) xr - 1) < 0;
+ }
+ return xr;
}
weak_alias (__llround, llround)
#ifdef NO_LONG_DOUBLE
diff --git a/libc/sysdeps/powerpc/fpu/s_llroundf.c b/libc/sysdeps/powerpc/fpu/s_llroundf.c
index 07d12adbf..0935de662 100644
--- a/libc/sysdeps/powerpc/fpu/s_llroundf.c
+++ b/libc/sysdeps/powerpc/fpu/s_llroundf.c
@@ -18,28 +18,27 @@
#include <math.h>
-/* I think that what this routine is supposed to do is round a value
- to the nearest integer, with values exactly on the boundary rounded
- away from zero. */
-/* This routine relies on (long long)x, when x is out of range of a long long,
- clipping to MAX_LLONG or MIN_LLONG. */
+/* Round to the nearest integer, with values exactly on a 0.5 boundary
+ rounded away from zero, regardless of the current rounding mode.
+ If (long long)x, when x is out of range of a long long, clips at
+ LLONG_MAX or LLONG_MIN, then this implementation also clips. */
long long int
__llroundf (float x)
{
- float xrf;
- long long int xr;
- xr = (long long int) x;
- xrf = (float) xr;
+ long long xr = (long long) x;
+ float xrf = (float) xr;
+
if (x >= 0.0)
- if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
- return x+1;
- else
- return x;
+ {
+ if (x - xrf >= 0.5)
+ xr += (long long) ((unsigned long long) xr + 1) > 0;
+ }
else
- if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0)
- return x-1;
- else
- return x;
+ {
+ if (xrf - x >= 0.5)
+ xr -= (long long) ((unsigned long long) xr - 1) < 0;
+ }
+ return xr;
}
weak_alias (__llroundf, llroundf)
diff --git a/libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c b/libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
index feffa6b4f..cc9b320bf 100644
--- a/libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
+++ b/libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
@@ -83,7 +83,7 @@ ElfW(Addr) query_auxv(int type)
return 0;
}
-typedef unsigned long long di_fpscr_t __attribute__ ((__mode__ (__DI__)));
+typedef unsigned int di_fpscr_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int si_fpscr_t __attribute__ ((__mode__ (__SI__)));
#define _FPSCR_RESERVED 0xfffffff8ffffff04ULL
@@ -95,50 +95,51 @@ typedef unsigned int si_fpscr_t __attribute__ ((__mode__ (__SI__)));
#define _FPSCR_TEST1_RN 0x0000000000000002ULL
/* Macros for accessing the hardware control word on Power6[x]. */
-# define _GET_DI_FPSCR(__fpscr) ({ \
- union { double d; \
- di_fpscr_t fpscr; } \
- tmp __attribute__ ((__aligned__(8))); \
- __asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
- (__fpscr)=tmp.fpscr; \
- tmp.fpscr; })
-
-/* We make sure to zero fp0 after we use it in order to prevent stale data
+#define _GET_DI_FPSCR(__fpscr) \
+ ({union { double d; di_fpscr_t fpscr; } u; \
+ register double fr; \
+ __asm__ ("mffs %0" : "=f" (fr)); \
+ u.d = fr; \
+ (__fpscr) = u.fpscr; \
+ u.fpscr; \
+ })
+
+/* We make sure to zero fp after we use it in order to prevent stale data
in an fp register from making a test-case pass erroneously. */
-# define _SET_DI_FPSCR(__fpscr) { \
- union { double d; di_fpscr_t fpscr; } \
- tmp __attribute__ ((__aligned__(8))); \
- tmp.fpscr = __fpscr; \
- /* Set the entire 64-bit FPSCR. */ \
- __asm__ ("lfd%U0 0,%0; " \
- ".machine push; " \
- ".machine \"power6\"; " \
- "mtfsf 255,0,1,0; " \
- ".machine pop" : : "m" (tmp.d) : "fr0"); \
- tmp.d = 0; \
- __asm__("lfd%U0 0,%0" : : "m" (tmp.d) : "fr0"); \
-}
-
-# define _GET_SI_FPSCR(__fpscr) ({ \
- union { double d; \
- si_fpscr_t cw[2]; } \
- tmp __attribute__ ((__aligned__(8))); \
- __asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
- (__fpscr)=tmp.cw[1]; \
- tmp.cw[0]; })
-
-/* We make sure to zero fp0 after we use it in order to prevent stale data
+# define _SET_DI_FPSCR(__fpscr) \
+ { union { double d; di_fpscr_t fpscr; } u; \
+ register double fr; \
+ u.fpscr = __fpscr; \
+ fr = u.d; \
+ /* Set the entire 64-bit FPSCR. */ \
+ __asm__ (".machine push; " \
+ ".machine \"power6\"; " \
+ "mtfsf 255,%0,1,0; " \
+ ".machine pop" : : "f" (fr)); \
+ fr = 0.0; \
+ }
+
+# define _GET_SI_FPSCR(__fpscr) \
+ ({union { double d; di_fpscr_t fpscr; } u; \
+ register double fr; \
+ __asm__ ("mffs %0" : "=f" (fr)); \
+ u.d = fr; \
+ (__fpscr) = (si_fpscr_t) u.fpscr; \
+ (si_fpscr_t) u.fpscr; \
+ })
+
+/* We make sure to zero fp after we use it in order to prevent stale data
in an fp register from making a test-case pass erroneously. */
-# define _SET_SI_FPSCR(__fpscr) { \
- union { double d; si_fpscr_t fpscr[2]; } \
- tmp __attribute__ ((__aligned__(8))); \
- /* More-or-less arbitrary; this is a QNaN. */ \
- tmp.fpscr[0] = 0xFFF80000; \
- tmp.fpscr[1] = __fpscr; \
- __asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \
- tmp.d = 0; \
- __asm__("lfd%U0 0,%0" : : "m" (tmp.d) : "fr0"); \
-}
+# define _SET_SI_FPSCR(__fpscr) \
+ { union { double d; di_fpscr_t fpscr; } u; \
+ register double fr; \
+ /* More-or-less arbitrary; this is a QNaN. */ \
+ u.fpscr = 0xfff80000ULL << 32; \
+ u.fpscr |= __fpscr & 0xffffffffULL; \
+ fr = u.d; \
+ __asm__ ("mtfsf 255,%0" : : "f" (fr)); \
+ fr = 0.0; \
+ }
void prime_special_regs(int which)
{
diff --git a/libc/sysdeps/powerpc/fpu_control.h b/libc/sysdeps/powerpc/fpu_control.h
index d03b8eb80..e82e7913c 100644
--- a/libc/sysdeps/powerpc/fpu_control.h
+++ b/libc/sysdeps/powerpc/fpu_control.h
@@ -28,7 +28,7 @@ typedef unsigned int fpu_control_t;
# define _FPU_SETCW(cw) (void) (cw)
extern fpu_control_t __fpu_control;
-#elif defined __NO_FPRS__ /* E500 */
+#elif defined __NO_FPRS__ /* e500 */
/* rounding control */
# define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
@@ -37,33 +37,28 @@ extern fpu_control_t __fpu_control;
# define _FPU_RC_ZERO 0x01
/* masking of interrupts */
-#define _FPU_MASK_ZM 0x10 /* zero divide */
-#define _FPU_MASK_OM 0x40 /* overflow */
-#define _FPU_MASK_UM 0x80 /* underflow */
-#define _FPU_MASK_XM 0x40 /* inexact */
-#define _FPU_MASK_IM 0x20 /* invalid operation */
+# define _FPU_MASK_ZM 0x10 /* zero divide */
+# define _FPU_MASK_OM 0x04 /* overflow */
+# define _FPU_MASK_UM 0x08 /* underflow */
+# define _FPU_MASK_XM 0x40 /* inexact */
+# define _FPU_MASK_IM 0x20 /* invalid operation */
-#define _FPU_RESERVED 0xff3fff7f /* These bits are reserved are not changed. */
+# define _FPU_RESERVED 0x00c10080 /* These bits are reserved and not changed. */
-/* The fdlibm code requires no interrupts for exceptions. */
-#define _FPU_DEFAULT 0x00000000 /* Default value. */
-
-/* IEEE: same as above, but (some) exceptions;
- we leave the 'inexact' exception off.
- */
-#define _FPU_IEEE 0x000003c0
+/* Correct IEEE semantics require traps to be enabled at the hardware
+ level; the kernel then does the emulation and determines whether
+ generation of signals from those traps was enabled using prctl. */
+# define _FPU_DEFAULT 0x0000003c /* Default value. */
+# define _FPU_IEEE _FPU_DEFAULT
/* Type of the control word. */
typedef unsigned int fpu_control_t;
/* Macros for accessing the hardware control word. */
-#define _FPU_GETCW(__cw) ({ \
- unsigned int env; \
- asm volatile ("mfspefscr %0" : "=r" (env)); \
- (__cw) = env; })
-#define _FPU_SETCW(__cw) ({ \
- unsigned int env = __cw; \
- asm volatile ("mtspefscr %0" : : "r" (env)); })
+# define _FPU_GETCW(cw) \
+ __asm__ volatile ("mfspefscr %0" : "=r" (cw))
+# define _FPU_SETCW(cw) \
+ __asm__ volatile ("mtspefscr %0" : : "r" (cw))
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
@@ -96,22 +91,26 @@ extern fpu_control_t __fpu_control;
# define _FPU_IEEE 0x000000f0
/* Type of the control word. */
-typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int fpu_control_t;
/* Macros for accessing the hardware control word. */
-# define _FPU_GETCW(__cw) ( { \
- union { double d; fpu_control_t cw[2]; } \
- tmp __attribute__ ((__aligned__(8))); \
- __asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
- (__cw)=tmp.cw[1]; \
- tmp.cw[1]; } )
-# define _FPU_SETCW(__cw) { \
- union { double d; fpu_control_t cw[2]; } \
- tmp __attribute__ ((__aligned__(8))); \
- tmp.cw[0] = 0xFFF80000; /* More-or-less arbitrary; this is a QNaN. */ \
- tmp.cw[1] = __cw; \
- __asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \
-}
+# define _FPU_GETCW(cw) \
+ ({union { double __d; unsigned long long __ll; } __u; \
+ register double __fr; \
+ __asm__ ("mffs %0" : "=f" (__fr)); \
+ __u.__d = __fr; \
+ (cw) = (fpu_control_t) __u.__ll; \
+ (fpu_control_t) __u.__ll; \
+ })
+
+# define _FPU_SETCW(cw) \
+ { union { double __d; unsigned long long __ll; } __u; \
+ register double __fr; \
+ __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */ \
+ __u.__ll |= (cw) & 0xffffffffLL; \
+ __fr = __u.__d; \
+ __asm__ ("mtfsf 255,%0" : : "f" (__fr)); \
+ }
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
diff --git a/libc/sysdeps/powerpc/jmpbuf-offsets.h b/libc/sysdeps/powerpc/jmpbuf-offsets.h
index 64c658a58..f2116bd70 100644
--- a/libc/sysdeps/powerpc/jmpbuf-offsets.h
+++ b/libc/sysdeps/powerpc/jmpbuf-offsets.h
@@ -21,12 +21,10 @@
#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_CR 21 /* Shared dword with VRSAVE. CR word at offset 172. */
# 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_VRSAVE 21 /* Shared dword with CR. VRSAVE word at offset 168. */
# 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. */
diff --git a/libc/sysdeps/powerpc/longjmp.c b/libc/sysdeps/powerpc/longjmp.c
index 198c89420..189fc03ab 100644
--- a/libc/sysdeps/powerpc/longjmp.c
+++ b/libc/sysdeps/powerpc/longjmp.c
@@ -55,6 +55,6 @@ weak_alias (__vmx__libc_siglongjmp, __vmxsiglongjmp)
default_symbol_version (__vmx__libc_longjmp, __libc_longjmp, GLIBC_PRIVATE);
default_symbol_version (__vmx__libc_siglongjmp, __libc_siglongjmp, GLIBC_PRIVATE);
-default_symbol_version (__vmx_longjmp, _longjmp, GLIBC_2.3.4);
-default_symbol_version (__vmxlongjmp, longjmp, GLIBC_2.3.4);
-default_symbol_version (__vmxsiglongjmp, siglongjmp, GLIBC_2.3.4);
+versioned_symbol (libc, __vmx_longjmp, _longjmp, GLIBC_2_3_4);
+versioned_symbol (libc, __vmxlongjmp, longjmp, GLIBC_2_3_4);
+versioned_symbol (libc, __vmxsiglongjmp, siglongjmp, GLIBC_2_3_4);
diff --git a/libc/ports/sysdeps/powerpc/nofpu/Makefile b/libc/sysdeps/powerpc/nofpu/Makefile
index 6bdff4546..b9cbf8023 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/Makefile
+++ b/libc/sysdeps/powerpc/nofpu/Makefile
@@ -14,6 +14,7 @@ CPPFLAGS += -I../soft-fp/
# gcc-4.1.1 and may be too late for gcc-4.2. So we need these flags
# until the fix in a gcc release and glibc drops support for earlier
# versions of gcc.
+CFLAGS-e_hypotl.c += -fno-builtin-fabsl
CFLAGS-e_powl.c += -fno-builtin-fabsl
CFLAGS-s_ccoshl.c += -fno-builtin-fabsl
CFLAGS-s_csinhl.c += -fno-builtin-fabsl
@@ -21,4 +22,9 @@ CFLAGS-s_clogl.c += -fno-builtin-fabsl
CFLAGS-s_clog10l.c += -fno-builtin-fabsl
CFLAGS-s_csinl.c += -fno-builtin-fabsl
CFLAGS-s_csqrtl.c += -fno-builtin-fabsl
+CFLAGS-w_acosl.c += -fno-builtin-fabsl
+CFLAGS-w_asinl.c += -fno-builtin-fabsl
+CFLAGS-w_atanhl.c += -fno-builtin-fabsl
+CFLAGS-w_j0l.c += -fno-builtin-fabsl
+CFLAGS-w_j1l.c += -fno-builtin-fabsl
endif
diff --git a/libc/ports/sysdeps/powerpc/nofpu/Subdirs b/libc/sysdeps/powerpc/nofpu/Subdirs
index 87eadf302..87eadf302 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/Subdirs
+++ b/libc/sysdeps/powerpc/nofpu/Subdirs
diff --git a/libc/ports/sysdeps/powerpc/nofpu/Versions b/libc/sysdeps/powerpc/nofpu/Versions
index 1a29319d5..1a29319d5 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/Versions
+++ b/libc/sysdeps/powerpc/nofpu/Versions
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c b/libc/sysdeps/powerpc/nofpu/fclrexcpt.c
index fabda0ab9..fabda0ab9 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c
+++ b/libc/sysdeps/powerpc/nofpu/fclrexcpt.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fedisblxcpt.c b/libc/sysdeps/powerpc/nofpu/fedisblxcpt.c
index e06c8f767..e06c8f767 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fedisblxcpt.c
+++ b/libc/sysdeps/powerpc/nofpu/fedisblxcpt.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/feenablxcpt.c b/libc/sysdeps/powerpc/nofpu/feenablxcpt.c
index 93249abf6..93249abf6 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/feenablxcpt.c
+++ b/libc/sysdeps/powerpc/nofpu/feenablxcpt.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fegetenv.c b/libc/sysdeps/powerpc/nofpu/fegetenv.c
index 51bcef30a..51bcef30a 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fegetenv.c
+++ b/libc/sysdeps/powerpc/nofpu/fegetenv.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fegetexcept.c b/libc/sysdeps/powerpc/nofpu/fegetexcept.c
index ea39a82b7..ea39a82b7 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fegetexcept.c
+++ b/libc/sysdeps/powerpc/nofpu/fegetexcept.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fegetround.c b/libc/sysdeps/powerpc/nofpu/fegetround.c
index c232ae379..c232ae379 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fegetround.c
+++ b/libc/sysdeps/powerpc/nofpu/fegetround.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/feholdexcpt.c b/libc/sysdeps/powerpc/nofpu/feholdexcpt.c
index ba6a53acc..ba6a53acc 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/feholdexcpt.c
+++ b/libc/sysdeps/powerpc/nofpu/feholdexcpt.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fenv_const.c b/libc/sysdeps/powerpc/nofpu/fenv_const.c
index 291b1accc..291b1accc 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fenv_const.c
+++ b/libc/sysdeps/powerpc/nofpu/fenv_const.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fenv_libc.h b/libc/sysdeps/powerpc/nofpu/fenv_libc.h
index 14a2d04a2..14a2d04a2 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fenv_libc.h
+++ b/libc/sysdeps/powerpc/nofpu/fenv_libc.h
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fesetenv.c b/libc/sysdeps/powerpc/nofpu/fesetenv.c
index 3f35909b6..3f35909b6 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fesetenv.c
+++ b/libc/sysdeps/powerpc/nofpu/fesetenv.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fesetround.c b/libc/sysdeps/powerpc/nofpu/fesetround.c
index 028c1300c..028c1300c 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fesetround.c
+++ b/libc/sysdeps/powerpc/nofpu/fesetround.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/feupdateenv.c b/libc/sysdeps/powerpc/nofpu/feupdateenv.c
index 163f67310..163f67310 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/feupdateenv.c
+++ b/libc/sysdeps/powerpc/nofpu/feupdateenv.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fgetexcptflg.c b/libc/sysdeps/powerpc/nofpu/fgetexcptflg.c
index 2373fa400..2373fa400 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fgetexcptflg.c
+++ b/libc/sysdeps/powerpc/nofpu/fgetexcptflg.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fraiseexcpt.c b/libc/sysdeps/powerpc/nofpu/fraiseexcpt.c
index cd142b60b..cd142b60b 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fraiseexcpt.c
+++ b/libc/sysdeps/powerpc/nofpu/fraiseexcpt.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fsetexcptflg.c b/libc/sysdeps/powerpc/nofpu/fsetexcptflg.c
index 3dc368fdd..3dc368fdd 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fsetexcptflg.c
+++ b/libc/sysdeps/powerpc/nofpu/fsetexcptflg.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/ftestexcept.c b/libc/sysdeps/powerpc/nofpu/ftestexcept.c
index f5d01e881..f5d01e881 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/ftestexcept.c
+++ b/libc/sysdeps/powerpc/nofpu/ftestexcept.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h b/libc/sysdeps/powerpc/nofpu/get-rounding-mode.h
index 20eb81030..20eb81030 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h
+++ b/libc/sysdeps/powerpc/nofpu/get-rounding-mode.h
diff --git a/libc/ports/sysdeps/powerpc/nofpu/libm-test-ulps b/libc/sysdeps/powerpc/nofpu/libm-test-ulps
index ad5a9cd42..ad5a9cd42 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/libc/sysdeps/powerpc/nofpu/libm-test-ulps
diff --git a/libc/ports/sysdeps/powerpc/nofpu/shlib-versions b/libc/sysdeps/powerpc/nofpu/shlib-versions
index 72085ddf4..72085ddf4 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/shlib-versions
+++ b/libc/sysdeps/powerpc/nofpu/shlib-versions
diff --git a/libc/ports/sysdeps/powerpc/nofpu/sim-full.c b/libc/sysdeps/powerpc/nofpu/sim-full.c
index e16703323..e16703323 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/sim-full.c
+++ b/libc/sysdeps/powerpc/nofpu/sim-full.c
diff --git a/libc/ports/sysdeps/powerpc/nofpu/soft-supp.h b/libc/sysdeps/powerpc/nofpu/soft-supp.h
index 64a3d2a1d..18b4550e3 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/soft-supp.h
+++ b/libc/sysdeps/powerpc/nofpu/soft-supp.h
@@ -17,7 +17,13 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv.h>
+#if defined __NO_FPRS__ && !defined _SOFT_FLOAT
+
+# include <fenv_libc.h>
+
+#else
+
+# include <fenv.h>
typedef union
{
@@ -25,6 +31,7 @@ typedef union
unsigned int l[2];
} fenv_union_t;
+#endif
/* FIXME: these variables should be thread specific (see bugzilla bug
15483) and ideally preserved across signal handlers, like hardware
diff --git a/libc/sysdeps/powerpc/novmx-longjmp.c b/libc/sysdeps/powerpc/novmx-longjmp.c
index 8f6ea357d..b2c0e4cf5 100644
--- a/libc/sysdeps/powerpc/novmx-longjmp.c
+++ b/libc/sysdeps/powerpc/novmx-longjmp.c
@@ -50,13 +50,7 @@ weak_alias (__novmx__libc_siglongjmp, __novmx_longjmp)
weak_alias (__novmx__libc_siglongjmp, __novmxlongjmp)
weak_alias (__novmx__libc_siglongjmp, __novmxsiglongjmp)
-# if __WORDSIZE == 64
-symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.3);
-symbol_version (__novmxlongjmp,longjmp,GLIBC_2.3);
-symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.3);
-# else
-symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.0);
-symbol_version (__novmxlongjmp,longjmp,GLIBC_2.0);
-symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.0);
-# endif
+compat_symbol (libc, __novmx_longjmp, _longjmp, GLIBC_2_0);
+compat_symbol (libc, __novmxlongjmp, longjmp, GLIBC_2_0);
+compat_symbol (libc, __novmxsiglongjmp, siglongjmp, GLIBC_2_0);
#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/memcmp.S b/libc/sysdeps/powerpc/powerpc32/405/memcmp.S
index 2849461cd..2849461cd 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/memcmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/memcmp.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/memcpy.S b/libc/sysdeps/powerpc/powerpc32/405/memcpy.S
index b01d53920..b01d53920 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/memcpy.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S b/libc/sysdeps/powerpc/powerpc32/405/memset.S
index b73dba887..b73dba887 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/memset.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/strcmp.S b/libc/sysdeps/powerpc/powerpc32/405/strcmp.S
index c0b21907b..c0b21907b 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/strcmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/strcmp.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/strcpy.S b/libc/sysdeps/powerpc/powerpc32/405/strcpy.S
index d7c84569d..d7c84569d 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/strcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/strcpy.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/strlen.S b/libc/sysdeps/powerpc/powerpc32/405/strlen.S
index 77d22ea67..77d22ea67 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/strlen.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/strlen.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/strncmp.S b/libc/sysdeps/powerpc/powerpc32/405/strncmp.S
index 3e2ba5f85..3e2ba5f85 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/405/strncmp.S
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/440/Implies b/libc/sysdeps/powerpc/powerpc32/440/Implies
index 70c0d2eda..70c0d2eda 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/440/Implies
+++ b/libc/sysdeps/powerpc/powerpc32/440/Implies
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/464/Implies b/libc/sysdeps/powerpc/powerpc32/464/Implies
index c3e52c550..c3e52c550 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/464/Implies
+++ b/libc/sysdeps/powerpc/powerpc32/464/Implies
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/476/Implies b/libc/sysdeps/powerpc/powerpc32/476/Implies
index 2829f9cca..2829f9cca 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/476/Implies
+++ b/libc/sysdeps/powerpc/powerpc32/476/Implies
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/476/memset.S b/libc/sysdeps/powerpc/powerpc32/476/memset.S
index 48c21d620..48c21d620 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/476/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/476/memset.S
diff --git a/libc/sysdeps/powerpc/powerpc32/Makefile b/libc/sysdeps/powerpc/powerpc32/Makefile
index 64f79003a..cf620c826 100644
--- a/libc/sysdeps/powerpc/powerpc32/Makefile
+++ b/libc/sysdeps/powerpc/powerpc32/Makefile
@@ -1,8 +1,12 @@
# Powerpc32 specific build options.
-ifeq ($(with-fp),no)
-+cflags += -msoft-float
-sysdep-LDFLAGS += -msoft-float
+# Some Powerpc32 variants assume soft-fp is the default even though there is
+# an fp variant so provide -mhard-float if --with-fp is explicitly passed.
+
+ifeq ($(with-fp),yes)
++cflags += -mhard-float
+ASFLAGS += -mhard-float
+sysdep-LDFLAGS += -mhard-float
endif
ifeq ($(subdir),gmon)
diff --git a/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
index 787447363..df1d5195f 100644
--- a/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -24,6 +24,12 @@
# include <jmpbuf-offsets.h>
#endif
+#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
+# define LOAD_GP(N) evldd r##N,((JB_FPRS+((N)-14)*2)*4)(r3)
+#else
+# define LOAD_GP(N) lwz r##N,((JB_GPRS+(N)-14)*4)(r3)
+#endif
+
ENTRY (__longjmp)
#if defined PTR_DEMANGLE || defined CHECK_SP
@@ -39,13 +45,13 @@ ENTRY (__longjmp)
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)
- lwz r16,((JB_GPRS+2)*4)(r3)
- lwz r17,((JB_GPRS+3)*4)(r3)
- lwz r18,((JB_GPRS+4)*4)(r3)
- lwz r19,((JB_GPRS+5)*4)(r3)
- lwz r20,((JB_GPRS+6)*4)(r3)
+ LOAD_GP (14)
+ LOAD_GP (15)
+ LOAD_GP (16)
+ LOAD_GP (17)
+ LOAD_GP (18)
+ LOAD_GP (19)
+ LOAD_GP (20)
#ifdef PTR_DEMANGLE
# ifndef CHECK_SP
PTR_DEMANGLE3 (r1, r24, r25)
@@ -53,19 +59,19 @@ ENTRY (__longjmp)
PTR_DEMANGLE2 (r0, r25)
#endif
mtlr r0
- lwz r21,((JB_GPRS+7)*4)(r3)
- lwz r22,((JB_GPRS+8)*4)(r3)
+ LOAD_GP (21)
+ LOAD_GP (22)
lwz r0,(JB_CR*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
- lwz r24,((JB_GPRS+10)*4)(r3)
- lwz r25,((JB_GPRS+11)*4)(r3)
+ LOAD_GP (23)
+ LOAD_GP (24)
+ LOAD_GP (25)
mtcrf 0xFF,r0
- lwz r26,((JB_GPRS+12)*4)(r3)
- lwz r27,((JB_GPRS+13)*4)(r3)
- lwz r28,((JB_GPRS+14)*4)(r3)
- lwz r29,((JB_GPRS+15)*4)(r3)
- lwz r30,((JB_GPRS+16)*4)(r3)
- lwz r31,((JB_GPRS+17)*4)(r3)
+ LOAD_GP (26)
+ LOAD_GP (27)
+ LOAD_GP (28)
+ LOAD_GP (29)
+ LOAD_GP (30)
+ LOAD_GP (31)
mr r3,r4
blr
END (__longjmp)
diff --git a/libc/sysdeps/powerpc/powerpc32/bsd-_setjmp.S b/libc/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
index 95e8a5aa1..ad2b5ffdb 100644
--- a/libc/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
@@ -30,7 +30,7 @@ libc_hidden_def (_setjmp)
/* Build a versioned object for libc. */
# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.0);
+compat_symbol (libc, __novmx_setjmp, _setjmp, GLIBC_2_0);
ENTRY (__novmx_setjmp)
li r4,0 /* Set second argument to 0. */
@@ -39,7 +39,7 @@ END (__novmx_setjmp)
libc_hidden_def (__novmx_setjmp)
# endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */
-default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmx_setjmp, _setjmp, GLIBC_2_3_4)
/* __GI__setjmp prototype is needed for ntpl i.e. _setjmp is defined
as a libc_hidden_proto & is used in sysdeps/generic/libc-start.c
if HAVE_CLEANUP_JMP_BUF is defined */
diff --git a/libc/sysdeps/powerpc/powerpc32/bsd-setjmp.S b/libc/sysdeps/powerpc/powerpc32/bsd-setjmp.S
index 1113ea533..5e1e860d8 100644
--- a/libc/sysdeps/powerpc/powerpc32/bsd-setjmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/bsd-setjmp.S
@@ -26,7 +26,7 @@ ENTRY (__novmxsetjmp)
b __novmx__sigsetjmp@local
END (__novmxsetjmp)
strong_alias (__novmxsetjmp, __novmx__setjmp)
-symbol_version (__novmxsetjmp, setjmp, GLIBC_2.0)
+compat_symbol (libc, __novmxsetjmp, setjmp, GLIBC_2_0)
#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) ) */
@@ -36,4 +36,4 @@ ENTRY (__vmxsetjmp)
END (__vmxsetjmp)
strong_alias (__vmxsetjmp, __vmx__setjmp)
strong_alias (__vmx__setjmp, __setjmp)
-default_symbol_version (__vmxsetjmp,setjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmxsetjmp, setjmp, GLIBC_2_3_4)
diff --git a/libc/sysdeps/powerpc/powerpc32/dl-machine.c b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
index 3e7202d86..aba361856 100644
--- a/libc/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -416,6 +416,12 @@ __process_machine_rela (struct link_map *map,
Elf32_Addr const finaladdr,
int rinfo)
{
+ union unaligned
+ {
+ uint16_t u2;
+ uint32_t u4;
+ } __attribute__((__packed__));
+
switch (rinfo)
{
case R_PPC_NONE:
@@ -432,10 +438,7 @@ __process_machine_rela (struct link_map *map,
return;
case R_PPC_UADDR32:
- ((char *) reloc_addr)[0] = finaladdr >> 24;
- ((char *) reloc_addr)[1] = finaladdr >> 16;
- ((char *) reloc_addr)[2] = finaladdr >> 8;
- ((char *) reloc_addr)[3] = finaladdr;
+ ((union unaligned *) reloc_addr)->u4 = finaladdr;
break;
case R_PPC_ADDR24:
@@ -453,8 +456,7 @@ __process_machine_rela (struct link_map *map,
case R_PPC_UADDR16:
if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
_dl_reloc_overflow (map, "R_PPC_UADDR16", reloc_addr, refsym);
- ((char *) reloc_addr)[0] = finaladdr >> 8;
- ((char *) reloc_addr)[1] = finaladdr;
+ ((union unaligned *) reloc_addr)->u2 = finaladdr;
break;
case R_PPC_ADDR16_LO:
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile
new file mode 100644
index 000000000..adf556870
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile
@@ -0,0 +1,9 @@
+ifeq ($(subdir),math)
+libm-routines += fexcepts_to_spe fexcepts_from_spe
+libm-routines += fexcepts_to_prctl fexcepts_from_prctl
+libm-routines += fe_note_change
+endif
+
+ifeq ($(subdir),soft-fp)
+sysdep_routines += fraiseexcept-soft
+endif
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c
index b11a64f49..92a7dd1e0 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c
@@ -1,4 +1,4 @@
-/* Clear given exceptions in current floating-point environment.
+/* Clear given exceptions in current floating-point environment. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -23,16 +23,22 @@ int
__feclearexcept (int excepts)
{
unsigned int fpescr;
+ int excepts_spe = __fexcepts_to_spe (excepts);
/* Get the current state. */
fpescr = fegetenv_register ();
/* Clear the relevant bits. */
- fpescr &= ~(excepts & FE_ALL_EXCEPT);
+ fpescr &= ~excepts_spe;
/* Put the new state in effect. */
fesetenv_register (fpescr);
+ /* Let the kernel know if the "invalid" or "underflow" bit was
+ cleared. */
+ if (excepts & (FE_INVALID | FE_UNDERFLOW))
+ __fe_note_change ();
+
/* Success. */
return 0;
}
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c
new file mode 100644
index 000000000..43a570626
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c
@@ -0,0 +1,39 @@
+/* Note a change to floating-point exceptions.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+/* Inform the kernel of a change to floating-point exceptions. */
+
+void
+__fe_note_change (void)
+{
+ int pflags, r;
+ INTERNAL_SYSCALL_DECL (err);
+
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return;
+ if ((pflags & PR_FP_EXC_SW_ENABLE) == 0)
+ INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ pflags | PR_FP_EXC_SW_ENABLE);
+}
+
+libm_hidden_def (__fe_note_change)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c
index 4008dec41..7cc963c01 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c
@@ -1,7 +1,6 @@
-/* Disable floating-point exceptions.
+/* Disable floating-point exceptions. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -24,36 +23,32 @@
int
fedisableexcept (int excepts)
{
- unsigned int result = 0, pflags, r;
+ int result = 0, pflags, r;
INTERNAL_SYSCALL_DECL (err);
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
/* Save old enable bits. */
- if (pflags & PR_FP_EXC_OVF)
- result |= FE_OVERFLOW;
- if (pflags & PR_FP_EXC_UND)
- result |= FE_UNDERFLOW;
- if (pflags & PR_FP_EXC_INV)
- result |= FE_INVALID;
- if (pflags & PR_FP_EXC_DIV)
- result |= FE_DIVBYZERO;
- if (pflags & PR_FP_EXC_RES)
- result |= FE_INEXACT;
-
- if (excepts & FE_INEXACT)
- pflags &= ~PR_FP_EXC_RES;
- if (excepts & FE_DIVBYZERO)
- pflags &= ~PR_FP_EXC_DIV;
- if (excepts & FE_UNDERFLOW)
- pflags &= ~PR_FP_EXC_UND;
- if (excepts & FE_OVERFLOW)
- pflags &= ~PR_FP_EXC_OVF;
- if (excepts & FE_INVALID)
- pflags &= ~PR_FP_EXC_INV;
- r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
+ result = __fexcepts_from_prctl (pflags);
+
+ pflags &= ~__fexcepts_to_prctl (excepts);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ pflags | PR_FP_EXC_SW_ENABLE);
if (INTERNAL_SYSCALL_ERROR_P (r, err))
return -1;
+ /* If disabling signals for "inexact", also disable trapping to the
+ kernel. */
+ if ((excepts & FE_INEXACT) != 0)
+ {
+ unsigned long fpescr;
+
+ fpescr = fegetenv_register ();
+ fpescr &= ~SPEFSCR_FINXE;
+ fesetenv_register (fpescr);
+ }
+
return result;
}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c
index f41104399..133dde7b3 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c
@@ -1,7 +1,6 @@
-/* Enable floating-point exceptions.
+/* Enable floating-point exceptions. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -27,33 +26,29 @@ feenableexcept (int excepts)
unsigned int result = 0, pflags, r;
INTERNAL_SYSCALL_DECL (err);
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
/* Save old enable bits. */
- if (pflags & PR_FP_EXC_OVF)
- result |= FE_OVERFLOW;
- if (pflags & PR_FP_EXC_UND)
- result |= FE_UNDERFLOW;
- if (pflags & PR_FP_EXC_INV)
- result |= FE_INVALID;
- if (pflags & PR_FP_EXC_DIV)
- result |= FE_DIVBYZERO;
- if (pflags & PR_FP_EXC_RES)
- result |= FE_INEXACT;
-
- if (excepts & FE_INEXACT)
- pflags |= PR_FP_EXC_RES;
- if (excepts & FE_DIVBYZERO)
- pflags |= PR_FP_EXC_DIV;
- if (excepts & FE_UNDERFLOW)
- pflags |= PR_FP_EXC_UND;
- if (excepts & FE_OVERFLOW)
- pflags |= PR_FP_EXC_OVF;
- if (excepts & FE_INVALID)
- pflags |= PR_FP_EXC_INV;
- r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
+ result = __fexcepts_from_prctl (pflags);
+
+ pflags |= __fexcepts_to_prctl (excepts);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ pflags | PR_FP_EXC_SW_ENABLE);
if (INTERNAL_SYSCALL_ERROR_P (r, err))
return -1;
+ /* If enabling signals for "inexact", also enable trapping to the
+ kernel. */
+ if ((excepts & FE_INEXACT) != 0)
+ {
+ unsigned long fpescr;
+
+ fpescr = fegetenv_register ();
+ fpescr |= SPEFSCR_FINXE;
+ fesetenv_register (fpescr);
+ }
+
return result;
}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c
index 693121306..bfcbca2ad 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c
@@ -1,6 +1,5 @@
-/* Store current floating-point environment.
+/* Store current floating-point environment. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
- Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,8 +25,12 @@ __fegetenv (fenv_t *envp)
{
fenv_union_t u;
INTERNAL_SYSCALL_DECL (err);
+ int r;
+
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
u.l[1] = fegetenv_register ();
*envp = u.fenv;
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c
index 71c1e19cb..9c7afc74f 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c
@@ -1,7 +1,6 @@
-/* Get floating-point exceptions.
+/* Get floating-point exceptions. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -18,13 +17,20 @@
<http://www.gnu.org/licenses/>. */
#include <fenv_libc.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
int
fegetexcept (void)
{
- unsigned long fpescr;
+ int result = 0, pflags, r;
+ INTERNAL_SYSCALL_DECL (err);
- fpescr = fegetenv_register ();
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
- return fpescr & FE_ALL_EXCEPT;
+ result = __fexcepts_from_prctl (pflags);
+
+ return result;
}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
index 68b60ad08..f69e9a5bd 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
@@ -1,7 +1,6 @@
-/* Return current rounding direction.
+/* Return current rounding direction. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
index b9e202d48..bd05ebd3c 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
@@ -1,7 +1,7 @@
/* Store current floating-point environment and clear exceptions.
+ e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -26,18 +26,31 @@ feholdexcept (fenv_t *envp)
{
fenv_union_t u;
INTERNAL_SYSCALL_DECL (err);
-
+ int r;
/* Get the current state. */
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
+
u.l[1] = fegetenv_register ();
*envp = u.fenv;
- /* Clear everything except for the rounding mode. */
- u.l[1] &= 3;
+ /* Clear everything except for the rounding mode and trapping to the
+ kernel. */
+ u.l[0] &= ~(PR_FP_EXC_DIV
+ | PR_FP_EXC_OVF
+ | PR_FP_EXC_UND
+ | PR_FP_EXC_RES
+ | PR_FP_EXC_INV);
+ u.l[1] &= SPEFSCR_FRMC | (SPEFSCR_ALL_EXCEPT_ENABLE & ~SPEFSCR_FINXE);
/* Put the new state in effect. */
fesetenv_register (u.l[1]);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ u.l[0] | PR_FP_EXC_SW_ENABLE);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
return 0;
}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c
index 15cf7f769..3a85f1810 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c
@@ -1,7 +1,6 @@
-/* Constants for fenv_bits.h.
+/* Constant floating-point environments for e500.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -17,10 +16,26 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* The use of "unsigned long long" as the type to define the
+ bit-pattern explicitly, rather than the type "double" used in
+ <bits/fenv.h>, means that we cannot include <fenv_libc.h> here to
+ get the enum constants for the SPEFSCR bits to enable
+ exceptions. */
+
+#include <sys/prctl.h>
+
/* If the default argument is used we use this value. */
const unsigned long long __fe_dfl_env __attribute__ ((aligned (8))) =
-0x0ULL;
+ 0x3cULL;
/* Floating-point environment where none of the exceptions are masked. */
const unsigned long long __fe_enabled_env __attribute__ ((aligned (8))) =
-0xF00000000ULL;
+ (((unsigned long long) (PR_FP_EXC_DIV
+ | PR_FP_EXC_OVF
+ | PR_FP_EXC_UND
+ | PR_FP_EXC_RES
+ | PR_FP_EXC_INV)) << 32) | 0x7cULL;
+
+/* Non-IEEE mode. */
+const unsigned long long __fe_nonieee_env __attribute__ ((aligned (8))) =
+ 0x0ULL;
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h
index e068ee357..96375808d 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h
@@ -1,6 +1,5 @@
-/* Internal libc stuff for floating point environment routines.
+/* Internal libc stuff for floating point environment routines. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
- Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,16 +21,33 @@
#include <fenv.h>
-extern int __feraiseexcept_internal (int __excepts);
+int __feraiseexcept_spe (int);
+libm_hidden_proto (__feraiseexcept_spe)
-/* Equivalent to fegetenv, but returns a fenv_t instead of taking a
- pointer. */
+int __fexcepts_to_spe (int);
+libm_hidden_proto (__fexcepts_to_spe)
+
+int __fexcepts_from_spe (int);
+libm_hidden_proto (__fexcepts_from_spe)
+
+int __fexcepts_to_prctl (int);
+libm_hidden_proto (__fexcepts_to_prctl)
+
+int __fexcepts_from_prctl (int);
+libm_hidden_proto (__fexcepts_from_prctl)
+
+void __fe_note_change (void);
+libm_hidden_proto (__fe_note_change)
+
+/* Equivalent to fegetenv, but returns an unsigned int instead of
+ taking a pointer. */
#define fegetenv_register() \
- ({ unsigned fscr; asm volatile ("mfspefscr %0" : "=r" (fscr)); fscr; })
+ ({ unsigned int fscr; asm volatile ("mfspefscr %0" : "=r" (fscr)); fscr; })
-/* Equivalent to fesetenv, but takes a fenv_t instead of a pointer. */
+/* Equivalent to fesetenv, but takes an unsigned int instead of a
+ pointer. */
#define fesetenv_register(fscr) \
- ({ asm volatile ("mtspefscr %0" : : "r" (fscr)); })
+ ({ asm volatile ("mtspefscr %0" : : "r" (fscr)); })
typedef union
{
@@ -55,6 +71,8 @@ enum {
SPEFSCR_FDBZS = 0x00080000,
SPEFSCR_FUNFS = 0x00040000,
SPEFSCR_FOVFS = 0x00020000,
+ /* Combination of the exception bits. */
+ SPEFSCR_ALL_EXCEPT = 0x003e0000,
SPEFSCR_MODE = 0x00010000,
SPEFSCR_SOV = 0x00008000,
SPEFSCR_OV = 0x00004000,
@@ -70,6 +88,8 @@ enum {
SPEFSCR_FDBZE = 0x00000010,
SPEFSCR_FUNFE = 0x00000008,
SPEFSCR_FOVFE = 0x00000004,
+ /* Combination of the exception trap enable bits. */
+ SPEFSCR_ALL_EXCEPT_ENABLE = 0x0000007c,
SPEFSCR_FRMC = 0x00000003
};
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c
index e9411a89d..411e6be8d 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c
@@ -1,4 +1,4 @@
-/* Install given floating-point environment.
+/* Install given floating-point environment. e500 version.
Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,10 +25,15 @@ __fesetenv (const fenv_t *envp)
{
fenv_union_t u;
INTERNAL_SYSCALL_DECL (err);
+ int r;
u.fenv = *envp;
- INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, &u.l[0]);
+
fesetenv_register (u.l[1]);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ u.l[0] | PR_FP_EXC_SW_ENABLE);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
/* Success. */
return 0;
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c
index 00cad37be..805008e0c 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c
@@ -1,7 +1,6 @@
-/* Set current rounding direction.
+/* Set current rounding direction. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
index 534ce9def..505c92363 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
@@ -1,7 +1,7 @@
/* Install given floating-point environment and raise exceptions.
+ e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -18,29 +18,20 @@
<http://www.gnu.org/licenses/>. */
#include <fenv_libc.h>
-#include <sysdep.h>
-#include <sys/prctl.h>
int
__feupdateenv (const fenv_t *envp)
{
- unsigned long fpescr, old, new, pflags;
- fenv_union_t u;
- INTERNAL_SYSCALL_DECL (err);
+ int exc;
/* Save the currently set exceptions. */
- u.fenv = *envp;
- new = u.l[1];
- old = fegetenv_register ();
- new |= (old & FE_ALL_EXCEPT);
-
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
- pflags |= u.l[0];
- INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
-
- /* Enable and raise (if appropriate) exceptions set in `new'. */
- fesetenv_register (new);
- feraiseexcept (new & FE_ALL_EXCEPT);
+ exc = fegetenv_register () & SPEFSCR_ALL_EXCEPT;
+
+ /* Install new environment. */
+ fesetenv (envp);
+
+ /* Raise (if appropriate) saved exceptions. */
+ __feraiseexcept_spe (exc);
/* Success. */
return 0;
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c
new file mode 100644
index 000000000..c094a04cb
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c
@@ -0,0 +1,42 @@
+/* Convert floating-point exceptions from prctl form.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <sys/prctl.h>
+
+/* Convert EXCEPTS from prctl bits to FE_* form, returning the
+ converted value. */
+
+int
+__fexcepts_from_prctl (int excepts)
+{
+ int result = 0;
+ if (excepts & PR_FP_EXC_OVF)
+ result |= FE_OVERFLOW;
+ if (excepts & PR_FP_EXC_UND)
+ result |= FE_UNDERFLOW;
+ if (excepts & PR_FP_EXC_INV)
+ result |= FE_INVALID;
+ if (excepts & PR_FP_EXC_DIV)
+ result |= FE_DIVBYZERO;
+ if (excepts & PR_FP_EXC_RES)
+ result |= FE_INEXACT;
+ return result;
+}
+
+libm_hidden_def (__fexcepts_from_prctl)
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c
new file mode 100644
index 000000000..3ec939d18
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c
@@ -0,0 +1,41 @@
+/* Convert floating-point exceptions from SPEFSCR form.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+
+/* Convert EXCEPTS from SPEFSCR bits to FE_* form, returning the
+ converted value. */
+
+int
+__fexcepts_from_spe (int excepts)
+{
+ int result = 0;
+ if (excepts & SPEFSCR_FINXS)
+ result |= FE_INEXACT;
+ if (excepts & SPEFSCR_FDBZS)
+ result |= FE_DIVBYZERO;
+ if (excepts & SPEFSCR_FUNFS)
+ result |= FE_UNDERFLOW;
+ if (excepts & SPEFSCR_FOVFS)
+ result |= FE_OVERFLOW;
+ if (excepts & SPEFSCR_FINVS)
+ result |= FE_INVALID;
+ return result;
+}
+
+libm_hidden_def (__fexcepts_from_spe)
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c
new file mode 100644
index 000000000..b9c51b125
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c
@@ -0,0 +1,42 @@
+/* Convert floating-point exceptions to prctl form.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <sys/prctl.h>
+
+/* Convert EXCEPTS from FE_* form to prctl bits, returning the
+ converted value. */
+
+int
+__fexcepts_to_prctl (int excepts)
+{
+ int result = 0;
+ if (excepts & FE_INEXACT)
+ result |= PR_FP_EXC_RES;
+ if (excepts & FE_DIVBYZERO)
+ result |= PR_FP_EXC_DIV;
+ if (excepts & FE_UNDERFLOW)
+ result |= PR_FP_EXC_UND;
+ if (excepts & FE_OVERFLOW)
+ result |= PR_FP_EXC_OVF;
+ if (excepts & FE_INVALID)
+ result |= PR_FP_EXC_INV;
+ return result;
+}
+
+libm_hidden_def (__fexcepts_to_prctl)
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c
new file mode 100644
index 000000000..570934d15
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c
@@ -0,0 +1,41 @@
+/* Convert floating-point exceptions to SPEFSCR form.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+
+/* Convert EXCEPTS from FE_* form to SPEFSCR bits, returning the
+ converted value. */
+
+int
+__fexcepts_to_spe (int excepts)
+{
+ int result = 0;
+ if (excepts & FE_INEXACT)
+ result |= SPEFSCR_FINXS;
+ if (excepts & FE_DIVBYZERO)
+ result |= SPEFSCR_FDBZS;
+ if (excepts & FE_UNDERFLOW)
+ result |= SPEFSCR_FUNFS;
+ if (excepts & FE_OVERFLOW)
+ result |= SPEFSCR_FOVFS;
+ if (excepts & FE_INVALID)
+ result |= SPEFSCR_FINVS;
+ return result;
+}
+
+libm_hidden_def (__fexcepts_to_spe)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fgetexcptflg.c
index f530c0231..b01cadeff 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fgetexcptflg.c
@@ -1,7 +1,6 @@
-/* Store current representation for exceptions.
+/* Store current representation for exceptions. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -27,10 +26,7 @@ __fegetexceptflag (fexcept_t *flagp, int excepts)
/* Get the current state. */
fpescr = fegetenv_register ();
- /* ?? Classic PPC doesn't do anything with `excepts', so we'll do
- the same here. (We should really be ignoring exceptions in
- excepts) ?? */
- *flagp = fpescr & FE_ALL_EXCEPT;
+ *flagp = fpescr & SPEFSCR_ALL_EXCEPT;
/* Success. */
return 0;
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/fraiseexcept-soft.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c
index d2bb5410f..0aed72ff3 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/fraiseexcept-soft.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c
@@ -1,4 +1,4 @@
-/* Raise given exceptions.
+/* Raise given exceptions. e500 version for use from soft-fp.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
@@ -24,5 +24,5 @@ int __feraiseexcept_soft (int);
libc_hidden_proto (__feraiseexcept_soft)
#define __FERAISEEXCEPT_INTERNAL __feraiseexcept_soft
-#include "../spe-raise.c"
+#include "spe-raise.c"
libc_hidden_def (__feraiseexcept_soft)
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
new file mode 100644
index 000000000..0eca9ffff
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
@@ -0,0 +1,40 @@
+/* Raise given exceptions. e500 version.
+ Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+
+#define __FERAISEEXCEPT_INTERNAL __feraiseexcept_spe
+#include "spe-raise.c"
+
+libm_hidden_def (__feraiseexcept_spe)
+
+#undef feraiseexcept
+int
+__feraiseexcept (int excepts)
+{
+ return __feraiseexcept_spe (__fexcepts_to_spe (excepts));
+}
+
+#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/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fsetexcptflg.c
index 33712d8cf..43f2d19d1 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fsetexcptflg.c
@@ -1,4 +1,4 @@
-/* Set floating-point environment exception handling.
+/* Set floating-point environment exception handling. e500 version.
Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -21,21 +21,27 @@
int
__fesetexceptflag (const fexcept_t *flagp, int excepts)
{
- unsigned long spefscr;
+ unsigned long old_spefscr, spefscr;
fexcept_t flag;
+ int excepts_spe = __fexcepts_to_spe (excepts);
/* Get the current state. */
- spefscr = fegetenv_register ();
+ old_spefscr = fegetenv_register ();
/* Ignore exceptions not listed in 'excepts'. */
- flag = *flagp & excepts;
+ flag = *flagp & excepts_spe;
/* Replace the exception status */
- spefscr = (spefscr & ~(FE_ALL_EXCEPT & excepts)) | flag;
+ spefscr = (old_spefscr & ~excepts_spe) | flag;
/* Store the new status word (along with the rest of the environment). */
fesetenv_register (spefscr);
+ /* If the state of the "invalid" or "underflow" flag has changed,
+ inform the kernel. */
+ if (((spefscr ^ old_spefscr) & (SPEFSCR_FINVS | SPEFSCR_FUNFS)) != 0)
+ __fe_note_change ();
+
/* Success. */
return 0;
}
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/ftestexcept.c
index ddb8f8685..f4f547d5f 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/ftestexcept.c
@@ -1,7 +1,6 @@
-/* Test exception in current environment.
+/* Test exception in current environment. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -27,6 +26,6 @@ fetestexcept (int excepts)
/* Get the current state. */
f = fegetenv_register ();
- return f & excepts;
+ return __fexcepts_from_spe (f) & excepts;
}
libm_hidden_def (fetestexcept)
diff --git a/libc/sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h
new file mode 100644
index 000000000..117e7331e
--- /dev/null
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h
@@ -0,0 +1,4 @@
+/* The generic version of get-rounding-mode.h using fpu_control.h, not
+ the one using the software rounding mode, is correct for e500. */
+
+#include <sysdeps/generic/get-rounding-mode.h>
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S
index 296e214c7..823f748ba 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S
@@ -1,7 +1,6 @@
-/* Floating-point absolute value. PowerPC E500 version.
+/* Floating-point absolute value. e500 version.
Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Aldy Hernandez <aldyh@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
@@ -19,10 +18,10 @@
#include <sysdep.h>
-ENTRY(__fabsf)
+ENTRY (__fabsf)
/* float [r3] fabsf (float [r3] x) ; */
efsabs r3,r3
blr
-END(__fabsf)
+END (__fabsf)
-weak_alias(__fabsf,fabsf)
+weak_alias (__fabsf, fabsf)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/spe-raise.c b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/spe-raise.c
index 79398e3b1..4394ddc7c 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/spe-raise.c
+++ b/libc/sysdeps/powerpc/powerpc32/e500/nofpu/spe-raise.c
@@ -1,4 +1,4 @@
-/* Raise given exceptions.
+/* Raise given exceptions, given the SPEFSCR bits for those exceptions.
Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,42 +24,29 @@ __FERAISEEXCEPT_INTERNAL (int excepts)
unsigned long f;
f = fegetenv_register ();
- f |= (excepts & FE_ALL_EXCEPT);
+ f |= (excepts & SPEFSCR_ALL_EXCEPT);
fesetenv_register (f);
/* Force the operations that cause the exceptions. */
- if ((FE_INVALID & excepts) != 0)
- {
- /* ?? Does not set sticky bit ?? */
- /* 0 / 0 */
- asm volatile ("efsdiv %0,%0,%1" : : "r" (0), "r" (0));
- }
+ if ((SPEFSCR_FINVS & excepts) != 0)
+ /* 0 / 0 */
+ asm volatile ("efsdiv %0,%0,%1" : : "r" (0), "r" (0));
- if ((FE_DIVBYZERO & excepts) != 0)
- {
- /* 1.0 / 0.0 */
- asm volatile ("efsdiv %0,%0,%1" : : "r" (1.0F), "r" (0));
- }
+ if ((SPEFSCR_FDBZS & excepts) != 0)
+ /* 1.0 / 0.0 */
+ asm volatile ("efsdiv %0,%0,%1" : : "r" (1.0F), "r" (0));
- if ((FE_OVERFLOW & excepts) != 0)
- {
- /* ?? Does not set sticky bit ?? */
- /* Largest normalized number plus itself. */
- asm volatile ("efsadd %0,%0,%1" : : "r" (0x7f7fffff), "r" (0x7f7fffff));
- }
+ if ((SPEFSCR_FOVFS & excepts) != 0)
+ /* Largest normalized number plus itself. */
+ asm volatile ("efsadd %0,%0,%1" : : "r" (0x7f7fffff), "r" (0x7f7fffff));
- if ((FE_UNDERFLOW & excepts) != 0)
- {
- /* ?? Does not set sticky bit ?? */
- /* Smallest normalized number times itself. */
- asm volatile ("efsmul %0,%0,%1" : : "r" (0x800000), "r" (0x800000));
- }
+ if ((SPEFSCR_FUNFS & excepts) != 0)
+ /* Smallest normalized number times itself. */
+ asm volatile ("efsmul %0,%0,%1" : : "r" (0x800000), "r" (0x800000));
- if ((FE_INEXACT & excepts) != 0)
- {
- /* Smallest normalized minus 1.0 raises the inexact flag. */
- asm volatile ("efssub %0,%0,%1" : : "r" (0x00800000), "r" (1.0F));
- }
+ if ((SPEFSCR_FINXS & excepts) != 0)
+ /* Smallest normalized minus 1.0 raises the inexact flag. */
+ asm volatile ("efssub %0,%0,%1" : : "r" (0x00800000), "r" (1.0F));
/* Success. */
return 0;
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index 9d34cd916..d02aa5754 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -43,16 +43,16 @@ ENTRY (__longjmp)
# endif
mtlr r6
cfi_same_value (lr)
- lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r5)
+ lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r5)
# else
lwz r5,_dl_hwcap@got(r5)
mtlr r6
cfi_same_value (lr)
- lwz r5,4(r5)
+ lwz r5,LOWORD(r5)
# endif
# else
- lis r5,(_dl_hwcap+4)@ha
- lwz r5,(_dl_hwcap+4)@l(r5)
+ lis r5,(_dl_hwcap+LOWORD)@ha
+ lwz r5,(_dl_hwcap+LOWORD)@l(r5)
# endif
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp.S b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
index 96e50de37..27166c454 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
@@ -26,14 +26,14 @@
#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__longjmp,__longjmp,GLIBC_2.3.4);
+versioned_symbol (libc, __vmx__longjmp, __longjmp, GLIBC_2_3_4);
# define __longjmp __vmx__longjmp
# include "__longjmp-common.S"
# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
# define __NO_VMX__
# undef JB_SIZE
-symbol_version (__novmx__longjmp,__longjmp,GLIBC_2.0);
+compat_symbol (libc, __novmx__longjmp, __longjmp, GLIBC_2_0);
# undef __longjmp
# define __longjmp __novmx__longjmp
# include "__longjmp-common.S"
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
index 840891f1c..1da24f492 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
@@ -29,7 +29,7 @@ ENTRY(__copysign)
stwu r1,-16(r1)
cfi_adjust_cfa_offset (16)
stfd fp2,8(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
cmpwi r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
index 4ec8389b5..2ad6de273 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
@@ -30,7 +30,7 @@ ENTRY(__copysignl)
fmr fp0,fp1
fabs fp1,fp1
fcmpu cr7,fp0,fp1
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
cmpwi cr6,r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
index 27881f8cc..249fda501 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
@@ -24,10 +24,10 @@ ENTRY (__lrint)
stwu r1,-16(r1)
fctiw fp13,fp1
stfd fp13,8(r1)
- nop /* Insure the following load is in a different dispatch group */
+ nop /* Ensure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1)
+ lwz r3,8+LOWORD(r1)
addi r1,r1,16
blr
END (__lrint)
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index 92dc3787d..6309f864b 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -67,7 +67,7 @@ ENTRY (__lround)
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1) /* Load return as integer. */
+ lwz r3,8+LOWORD(r1) /* Load return as integer. */
.Lout:
addi r1,r1,16
blr
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
index 2ed9ca7b4..8cff1563a 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
@@ -19,7 +19,7 @@
#include <sysdep.h>
.section .rodata.cst8,"aM",@progbits,8
- .align 2
+ .align 3
.LC0: /* 2**23 */
.long 0x4b000000
.LC1: /* 0.5 */
@@ -60,7 +60,6 @@ ENTRY (__roundf )
#ifdef SHARED
lfs fp10,.LC1-.LC0(r9)
#else
- lis r9,.LC1@ha
lfs fp10,.LC1@l(r9)
#endif
ble- cr6,.L4
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index 46ea2b00f..f3244060e 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -94,14 +94,14 @@ ENTRY (__sigsetjmp)
# else
lwz r5,_rtld_global_ro@got(r5)
# endif
- lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r5)
+ lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r5)
# else
lwz r5,_dl_hwcap@got(r5)
- lwz r5,4(r5)
+ lwz r5,LOWORD(r5)
# endif
# else
- lis r6,(_dl_hwcap+4)@ha
- lwz r5,(_dl_hwcap+4)@l(r6)
+ lis r6,(_dl_hwcap+LOWORD)@ha
+ lwz r5,(_dl_hwcap+LOWORD)@l(r6)
# endif
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
@@ -111,44 +111,43 @@ ENTRY (__sigsetjmp)
stw r0,((JB_VRSAVE)*4)(3)
addi r6,r5,16
beq+ L(aligned_save_vmx)
- lvsr v0,0,r5
- vspltisb v1,-1 /* set v1 to all 1's */
- vspltisb v2,0 /* set v2 to all 0's */
- vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes on left = misalignment */
+ lvsr v0,0,r5
+ lvsl v1,0,r5
+ addi r6,r5,-16
- /* Special case for v20 we need to preserve what is in save area below v20 before obliterating it */
- lvx v5,0,r5
- vperm v20,v20,v20,v0
- vsel v5,v5,v20,v3
- vsel v20,v20,v2,v3
- stvx v5,0,r5
+# define save_misaligned_vmx(savevr,prevvr,shiftvr,tmpvr,savegpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ vperm tmpvr,prevvr,savevr,shiftvr; \
+ stvx tmpvr,0,savegpr
-#define save_2vmx_partial(savevr,prev_savevr,hivr,shiftvr,maskvr,savegpr,addgpr) \
- addi addgpr,addgpr,32; \
- vperm savevr,savevr,savevr,shiftvr; \
- vsel hivr,prev_savevr,savevr,maskvr; \
- stvx hivr,0,savegpr;
+ /*
+ * We have to be careful not to corrupt the data below v20 and
+ * above v31. To keep things simple we just rotate both ends in
+ * the opposite direction to our main permute so we can use
+ * the common macro.
+ */
- save_2vmx_partial(v21,v20,v5,v0,v3,r6,r5)
- save_2vmx_partial(v22,v21,v5,v0,v3,r5,r6)
- save_2vmx_partial(v23,v22,v5,v0,v3,r6,r5)
- save_2vmx_partial(v24,v23,v5,v0,v3,r5,r6)
- save_2vmx_partial(v25,v24,v5,v0,v3,r6,r5)
- save_2vmx_partial(v26,v25,v5,v0,v3,r5,r6)
- save_2vmx_partial(v27,v26,v5,v0,v3,r6,r5)
- save_2vmx_partial(v28,v27,v5,v0,v3,r5,r6)
- save_2vmx_partial(v29,v28,v5,v0,v3,r6,r5)
- save_2vmx_partial(v30,v29,v5,v0,v3,r5,r6)
+ /* load and rotate data below v20 */
+ lvx v2,0,r5
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v20,v2,v0,v3,r5,r6)
+ save_misaligned_vmx(v21,v20,v0,v3,r6,r5)
+ save_misaligned_vmx(v22,v21,v0,v3,r5,r6)
+ save_misaligned_vmx(v23,v22,v0,v3,r6,r5)
+ save_misaligned_vmx(v24,v23,v0,v3,r5,r6)
+ save_misaligned_vmx(v25,v24,v0,v3,r6,r5)
+ save_misaligned_vmx(v26,v25,v0,v3,r5,r6)
+ save_misaligned_vmx(v27,v26,v0,v3,r6,r5)
+ save_misaligned_vmx(v28,v27,v0,v3,r5,r6)
+ save_misaligned_vmx(v29,v28,v0,v3,r6,r5)
+ save_misaligned_vmx(v30,v29,v0,v3,r5,r6)
+ save_misaligned_vmx(v31,v30,v0,v3,r6,r5)
+ /* load and rotate data above v31 */
+ lvx v2,0,r6
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v2,v31,v0,v3,r5,r6)
- /* Special case for r31 we need to preserve what is in save area above v31 before obliterating it */
- addi r5,r5,32
- vperm v31,v31,v31,v0
- lvx v4,0,r5
- vsel v5,v30,v31,v3
- stvx v5,0,r6
- vsel v4,v31,v4,v3
- stvx v4,0,r5
b L(no_vmx)
L(aligned_save_vmx):
diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp.S b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp.S
index 60cd35052..92acff1e6 100644
--- a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp.S
@@ -26,7 +26,7 @@
#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmx__sigsetjmp, __sigsetjmp, GLIBC_2_3_4)
# define __sigsetjmp __vmx__sigsetjmp
# define __sigjmp_save __vmx__sigjmp_save
# include "setjmp-common.S"
@@ -36,7 +36,7 @@ default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
# undef __sigsetjmp
# undef __sigjmp_save
# undef JB_SIZE
-symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
+compat_symbol (libc, __novmx__sigsetjmp, __sigsetjmp, GLIBC_2_0)
# define __sigsetjmp __novmx__sigsetjmp
# define __sigjmp_save __novmx__sigjmp_save
# include "setjmp-common.S"
diff --git a/libc/sysdeps/powerpc/powerpc32/mcount.c b/libc/sysdeps/powerpc/powerpc32/mcount.c
index 0476bf61d..d8c063222 100644
--- a/libc/sysdeps/powerpc/powerpc32/mcount.c
+++ b/libc/sysdeps/powerpc/powerpc32/mcount.c
@@ -9,7 +9,7 @@
/* __mcount_internal was added in glibc 2.15 with version GLIBC_PRIVATE,
but it should have been put in version GLIBC_2.15. Mark the
GLIBC_PRIVATE version obsolete and add it to GLIBC_2.16 instead. */
-default_symbol_version (___mcount_internal, __mcount_internal, GLIBC_2.16);
+versioned_symbol (libc, ___mcount_internal, __mcount_internal, GLIBC_2_16);
#if SHLIB_COMPAT (libc, GLIBC_2_15, GLIBC_2_16)
strong_alias (___mcount_internal, ___mcount_internal_private);
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
index 55b2850fd..e7a88feb4 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
@@ -29,8 +29,8 @@ ENTRY (__llrint)
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrint)
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
index cc80fcb02..da24ad38d 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
@@ -28,8 +28,8 @@ ENTRY (__llrintf)
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrintf)
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
index 631180f07..7246ca4d1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
@@ -19,12 +19,10 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>
- .section .rodata.cst12,"aM",@progbits,12
+ .section .rodata.cst8,"aM",@progbits,8
.align 3
- .LC0: /* 0x1.0000000000000p+52 == 2^52 */
- .long 0x43300000
- .long 0x00000000
- .long 0x3f000000 /* Use this for 0.5 */
+ .LC0: .long (52+127)<<23 /* 0x1p+52 */
+ .long (-1+127)<<23 /* 0.5 */
.section ".text"
@@ -57,12 +55,12 @@ ENTRY (__llround)
addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
- lfd fp9,0(r9)
- lfs fp10,8(r9)
+ lfs fp9,0(r9)
+ lfs fp10,4(r9)
#else
lis r9,.LC0@ha
- lfd fp9,.LC0@l(r9) /* Load 2^52 into fpr9. */
- lfs fp10,.LC0@l+8(r9) /* Load 0.5 into fpr10. */
+ lfs fp9,.LC0@l(r9) /* Load 2^52 into fpr9. */
+ lfs fp10,.LC0@l+4(r9) /* Load 0.5 into fpr10. */
#endif
fabs fp2,fp1 /* Get the absolute value of x. */
fsub fp12,fp10,fp10 /* Compute 0.0 into fpr12. */
@@ -80,8 +78,8 @@ ENTRY (__llround)
nop
nop
nop
- lwz r4,12(r1) /* Load return as integer. */
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1) /* Load return as integer. */
+ lwz r4,8+LOWORD(r1)
.Lout:
addi r1,r1,16
blr
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/hp-timing.h b/libc/sysdeps/powerpc/powerpc32/power4/hp-timing.h
index 7d6c96e9e..4e42374ea 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/hp-timing.h
+++ b/libc/sysdeps/powerpc/powerpc32/power4/hp-timing.h
@@ -87,18 +87,15 @@ typedef unsigned long long int hp_timing_t;
#define HP_TIMING_NOW(Var) \
do { \
- union { long long ll; long ii[2]; } _var; \
- long tmp; \
- __asm__ __volatile__ ( \
- "1: mfspr %0,269;" \
- " mfspr %1,268;" \
- " mfspr %2,269;" \
- " cmpw %0,%2;" \
- " bne 1b;" \
- : "=r" (_var.ii[0]), "=r" (_var.ii[1]) , "=r" (tmp) \
- : : "cr0" \
- ); \
- Var = _var.ll; \
+ unsigned int hi, lo, tmp; \
+ __asm__ __volatile__ ("1: mfspr %0,269;" \
+ " mfspr %1,268;" \
+ " mfspr %2,269;" \
+ " cmpw %0,%2;" \
+ " bne 1b;" \
+ : "=&r" (hi), "=&r" (lo), "=&r" (tmp) \
+ : : "cr0"); \
+ Var = ((hp_timing_t) hi << 32) | lo; \
} while (0)
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/memcmp.S b/libc/sysdeps/powerpc/powerpc32/power4/memcmp.S
index 9a455a3c6..35e162667 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/memcmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/memcmp.S
@@ -1,4 +1,4 @@
-/* Optimized strcmp implementation for PowerPC64.
+/* Optimized strcmp implementation for PowerPC32.
Copyright (C) 2003-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -18,13 +18,14 @@
#include <sysdep.h>
-/* int [r3] memcmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */
+/* int [r3] memcmp (const char *s1 [r3],
+ const char *s2 [r4],
+ size_t size [r5]) */
.machine power4
EALIGN (memcmp, 4, 0)
CALL_MCOUNT
-#define rTMP r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -35,33 +36,32 @@ EALIGN (memcmp, 4, 0)
#define rWORD4 r9 /* next word in s2 */
#define rWORD5 r10 /* next word in s1 */
#define rWORD6 r11 /* next word in s2 */
-#define rBITDIF r12 /* bits that differ in s1 & s2 words */
#define rWORD7 r30 /* next word in s1 */
#define rWORD8 r31 /* next word in s2 */
- xor rTMP, rSTR2, rSTR1
+ xor r0, rSTR2, rSTR1
cmplwi cr6, rN, 0
cmplwi cr1, rN, 12
- clrlwi. rTMP, rTMP, 30
- clrlwi rBITDIF, rSTR1, 30
- cmplwi cr5, rBITDIF, 0
+ clrlwi. r0, r0, 30
+ clrlwi r12, rSTR1, 30
+ cmplwi cr5, r12, 0
beq- cr6, L(zeroLength)
- dcbt 0,rSTR1
- dcbt 0,rSTR2
+ dcbt 0, rSTR1
+ dcbt 0, rSTR2
/* If less than 8 bytes or not aligned, use the unaligned
byte loop. */
blt cr1, L(bytealigned)
- stwu 1,-64(1)
+ stwu 1, -64(r1)
cfi_adjust_cfa_offset(64)
- stw r31,48(1)
- cfi_offset(31,(48-64))
- stw r30,44(1)
- cfi_offset(30,(44-64))
+ stw rWORD8, 48(r1)
+ cfi_offset(rWORD8, (48-64))
+ stw rWORD7, 44(r1)
+ cfi_offset(rWORD7, (44-64))
bne L(unaligned)
/* At this point we know both strings have the same alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
2 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then we are already word
+ of r12 to 0. If r12 == 0 then we are already word
aligned and can perform the word aligned loop.
Otherwise we know the two strings have the same alignment (but not
@@ -70,74 +70,95 @@ EALIGN (memcmp, 4, 0)
eliminate bits preceding the first byte. Since we want to join the
normal (word aligned) compare loop, starting at the second word,
we need to adjust the length (rN) and special case the loop
- versioning for the first word. This insures that the loop count is
+ versioning for the first word. This ensures that the loop count is
correct and the first word (shifted) is in the expected register pair. */
- .align 4
+ .align 4
L(samealignment):
clrrwi rSTR1, rSTR1, 2
clrrwi rSTR2, rSTR2, 2
beq cr5, L(Waligned)
- add rN, rN, rBITDIF
- slwi r11, rBITDIF, 3
- srwi rTMP, rN, 4 /* Divide by 16 */
- andi. rBITDIF, rN, 12 /* Get the word remainder */
+ add rN, rN, r12
+ slwi rWORD6, r12, 3
+ srwi r0, rN, 4 /* Divide by 16 */
+ andi. r12, rN, 12 /* Get the word remainder */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 0(rSTR1)
lwz rWORD2, 0(rSTR2)
- cmplwi cr1, rBITDIF, 8
+#endif
+ cmplwi cr1, r12, 8
cmplwi cr7, rN, 16
clrlwi rN, rN, 30
beq L(dPs4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
bgt cr1, L(dPs3)
beq cr1, L(dPs2)
/* Remainder is 4 */
- .align 3
+ .align 3
L(dsP1):
- slw rWORD5, rWORD1, r11
- slw rWORD6, rWORD2, r11
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD2, rWORD6
cmplw cr5, rWORD5, rWORD6
blt cr7, L(dP1x)
/* Do something useful in this cycle since we have to branch anyway. */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
b L(dP1e)
/* Remainder is 8 */
- .align 4
+ .align 4
L(dPs2):
- slw rWORD5, rWORD1, r11
- slw rWORD6, rWORD2, r11
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD2, rWORD6
cmplw cr6, rWORD5, rWORD6
blt cr7, L(dP2x)
/* Do something useful in this cycle since we have to branch anyway. */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD7, 4(rSTR1)
lwz rWORD8, 4(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
b L(dP2e)
/* Remainder is 12 */
- .align 4
+ .align 4
L(dPs3):
- slw rWORD3, rWORD1, r11
- slw rWORD4, rWORD2, r11
+ slw rWORD3, rWORD1, rWORD6
+ slw rWORD4, rWORD2, rWORD6
cmplw cr1, rWORD3, rWORD4
b L(dP3e)
/* Count is a multiple of 16, remainder is 0 */
- .align 4
+ .align 4
L(dPs4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- slw rWORD1, rWORD1, r11
- slw rWORD2, rWORD2, r11
- cmplw cr0, rWORD1, rWORD2
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ slw rWORD1, rWORD1, rWORD6
+ slw rWORD2, rWORD2, rWORD6
+ cmplw cr7, rWORD1, rWORD2
b L(dP4e)
/* At this point we know both strings are word aligned and the
compare length is at least 8 bytes. */
- .align 4
+ .align 4
L(Waligned):
- andi. rBITDIF, rN, 12 /* Get the word remainder */
- srwi rTMP, rN, 4 /* Divide by 16 */
- cmplwi cr1, rBITDIF, 8
+ andi. r12, rN, 12 /* Get the word remainder */
+ srwi r0, rN, 4 /* Divide by 16 */
+ cmplwi cr1, r12, 8
cmplwi cr7, rN, 16
clrlwi rN, rN, 30
beq L(dP4)
@@ -145,177 +166,352 @@ L(Waligned):
beq cr1, L(dP2)
/* Remainder is 4 */
- .align 4
+ .align 4
L(dP1):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
/* Normally we'd use rWORD7/rWORD8 here, but since we might exit early
(8-15 byte compare), we want to use only volatile registers. This
means we can avoid restoring non-volatile registers since we did not
change any on the early exit path. The key here is the non-early
exit path only cares about the condition code (cr5), not about which
register pair was used. */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 0(rSTR1)
lwz rWORD6, 0(rSTR2)
+#endif
cmplw cr5, rWORD5, rWORD6
blt cr7, L(dP1x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
L(dP1e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 8(rSTR1)
lwz rWORD4, 8(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 12(rSTR1)
lwz rWORD6, 12(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
- bne cr5, L(dLcr5)
- bne cr0, L(dLcr0)
+ bne cr5, L(dLcr5x)
+ bne cr7, L(dLcr7x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwzu rWORD7, 16(rSTR1)
lwzu rWORD8, 16(rSTR2)
+#endif
bne cr1, L(dLcr1)
cmplw cr5, rWORD7, rWORD8
bdnz L(dLoop)
bne cr6, L(dLcr6)
- lwz r30,44(1)
- lwz r31,48(1)
- .align 3
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+ .align 3
L(dP1x):
slwi. r12, rN, 3
- bne cr5, L(dLcr5)
+ bne cr5, L(dLcr5x)
subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
- lwz 1,0(1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
li rRTN, 0
blr
/* Remainder is 8 */
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dP2):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 0(rSTR1)
lwz rWORD6, 0(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
blt cr7, L(dP2x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD7, 4(rSTR1)
lwz rWORD8, 4(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
L(dP2e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 8(rSTR1)
lwz rWORD2, 8(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 12(rSTR1)
lwz rWORD4, 12(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 4
addi rSTR2, rSTR2, 4
+#endif
bne cr6, L(dLcr6)
bne cr5, L(dLcr5)
b L(dLoop2)
/* Again we are on a early exit path (16-23 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
- .align 4
+ .align 4
L(dP2x):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 4(rSTR1)
lwz rWORD4, 4(rSTR2)
- cmplw cr5, rWORD3, rWORD4
+#endif
+ cmplw cr1, rWORD3, rWORD4
slwi. r12, rN, 3
- bne cr6, L(dLcr6)
+ bne cr6, L(dLcr6x)
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 4
addi rSTR2, rSTR2, 4
- bne cr5, L(dLcr5)
+#endif
+ bne cr1, L(dLcr1x)
subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
- lwz 1,0(1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
li rRTN, 0
blr
/* Remainder is 12 */
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dP3):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 0(rSTR1)
lwz rWORD4, 0(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
L(dP3e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 4(rSTR1)
lwz rWORD6, 4(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
blt cr7, L(dP3x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD7, 8(rSTR1)
lwz rWORD8, 8(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 12(rSTR1)
lwz rWORD2, 12(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
+#endif
bne cr1, L(dLcr1)
bne cr6, L(dLcr6)
b L(dLoop1)
/* Again we are on a early exit path (24-31 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
- .align 4
+ .align 4
L(dP3x):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 8(rSTR1)
lwz rWORD2, 8(rSTR2)
- cmplw cr5, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
slwi. r12, rN, 3
- bne cr1, L(dLcr1)
+ bne cr1, L(dLcr1x)
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
- bne cr6, L(dLcr6)
+#endif
+ bne cr6, L(dLcr6x)
subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
- bne cr5, L(dLcr5)
- lwz 1,0(1)
+ bne cr7, L(dLcr7x)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
li rRTN, 0
blr
/* Count is a multiple of 16, remainder is 0 */
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dP4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 0(rSTR1)
lwz rWORD2, 0(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
L(dP4e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 4(rSTR1)
lwz rWORD4, 4(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 8(rSTR1)
lwz rWORD6, 8(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwzu rWORD7, 12(rSTR1)
lwzu rWORD8, 12(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
bne cr1, L(dLcr1)
bdz- L(d24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
- .align 4
+ .align 4
L(dLoop):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
bne cr6, L(dLcr6)
L(dLoop1):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 8(rSTR1)
lwz rWORD4, 8(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
bne cr5, L(dLcr5)
L(dLoop2):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 12(rSTR1)
lwz rWORD6, 12(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
L(dLoop3):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwzu rWORD7, 16(rSTR1)
lwzu rWORD8, 16(rSTR2)
+#endif
bne- cr1, L(dLcr1)
- cmplw cr0, rWORD1, rWORD2
+ cmplw cr7, rWORD1, rWORD2
bdnz+ L(dLoop)
L(dL4):
@@ -325,7 +521,7 @@ L(dL4):
bne cr5, L(dLcr5)
cmplw cr5, rWORD7, rWORD8
L(d44):
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
L(d34):
bne cr1, L(dLcr1)
L(d24):
@@ -334,69 +530,82 @@ L(d14):
slwi. r12, rN, 3
bne cr5, L(dLcr5)
L(d04):
- lwz r30,44(1)
- lwz r31,48(1)
- lwz 1,0(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
beq L(zeroLength)
/* At this point we have a remainder of 1 to 3 bytes to compare. Since
we are aligned it is safe to load the whole word, and use
- shift right to eliminate bits beyond the compare length. */
+ shift right to eliminate bits beyond the compare length. */
L(d00):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
+#endif
srw rWORD1, rWORD1, rN
srw rWORD2, rWORD2, rN
- cmplw rWORD1,rWORD2
- li rRTN,0
- beqlr
- li rRTN,1
- bgtlr
- li rRTN,-1
- blr
-
- .align 4
-L(dLcr0):
- lwz r30,44(1)
- lwz r31,48(1)
+ sub rRTN, rWORD1, rWORD2
+ blr
+
+ .align 4
+ cfi_adjust_cfa_offset(64)
+L(dLcr7):
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr7x):
li rRTN, 1
- lwz 1,0(1)
- bgtlr cr0
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
+ bgtlr cr7
li rRTN, -1
blr
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr1):
- lwz r30,44(1)
- lwz r31,48(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr1x):
li rRTN, 1
- lwz 1,0(1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr1
li rRTN, -1
blr
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr6):
- lwz r30,44(1)
- lwz r31,48(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr6x):
li rRTN, 1
- lwz 1,0(1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr6
li rRTN, -1
blr
- .align 4
+ .align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr5):
- lwz r30,44(1)
- lwz r31,48(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
L(dLcr5x):
li rRTN, 1
- lwz 1,0(1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr5
li rRTN, -1
blr
- .align 4
+ .align 4
L(bytealigned):
- cfi_adjust_cfa_offset(-64)
- mtctr rN /* Power4 wants mtctr 1st in dispatch group */
+ mtctr rN /* Power4 wants mtctr 1st in dispatch group */
/* We need to prime this loop. This loop is swing modulo scheduled
to avoid pipe delays. The dependent instruction latencies (load to
@@ -411,7 +620,7 @@ L(bytealigned):
lbz rWORD1, 0(rSTR1)
lbz rWORD2, 0(rSTR2)
bdz- L(b11)
- cmplw cr0, rWORD1, rWORD2
+ cmplw cr7, rWORD1, rWORD2
lbz rWORD3, 1(rSTR1)
lbz rWORD4, 1(rSTR2)
bdz- L(b12)
@@ -419,11 +628,11 @@ L(bytealigned):
lbzu rWORD5, 2(rSTR1)
lbzu rWORD6, 2(rSTR2)
bdz- L(b13)
- .align 4
+ .align 4
L(bLoop):
lbzu rWORD1, 1(rSTR1)
lbzu rWORD2, 1(rSTR2)
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
cmplw cr6, rWORD5, rWORD6
bdz- L(b3i)
@@ -432,7 +641,7 @@ L(bLoop):
lbzu rWORD4, 1(rSTR2)
bne- cr1, L(bLcr1)
- cmplw cr0, rWORD1, rWORD2
+ cmplw cr7, rWORD1, rWORD2
bdz- L(b2i)
lbzu rWORD5, 1(rSTR1)
@@ -449,23 +658,23 @@ L(bLoop):
tested. In this case we must complete the pending operations
before returning. */
L(b1i):
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
bne- cr1, L(bLcr1)
b L(bx56)
- .align 4
+ .align 4
L(b2i):
bne- cr6, L(bLcr6)
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
b L(bx34)
- .align 4
+ .align 4
L(b3i):
bne- cr1, L(bLcr1)
bne- cr6, L(bLcr6)
b L(bx12)
- .align 4
-L(bLcr0):
+ .align 4
+L(bLcr7):
li rRTN, 1
- bgtlr cr0
+ bgtlr cr7
li rRTN, -1
blr
L(bLcr1):
@@ -480,36 +689,31 @@ L(bLcr6):
blr
L(b13):
- bne- cr0, L(bx12)
+ bne- cr7, L(bx12)
bne- cr1, L(bx34)
L(bx56):
sub rRTN, rWORD5, rWORD6
blr
nop
L(b12):
- bne- cr0, L(bx12)
+ bne- cr7, L(bx12)
L(bx34):
sub rRTN, rWORD3, rWORD4
blr
-
L(b11):
L(bx12):
sub rRTN, rWORD1, rWORD2
blr
-
- .align 4
-L(zeroLengthReturn):
-
+ .align 4
L(zeroLength):
li rRTN, 0
blr
- cfi_adjust_cfa_offset(64)
- .align 4
+ .align 4
/* At this point we know the strings have different alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
2 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then rStr1 is word aligned and can
+ of r12 to 0. If r12 == 0 then rStr1 is word aligned and can
perform the Wunaligned loop.
Otherwise we know that rSTR1 is not already word aligned yet.
@@ -518,79 +722,88 @@ L(zeroLength):
eliminate bits preceding the first byte. Since we want to join the
normal (Wualigned) compare loop, starting at the second word,
we need to adjust the length (rN) and special case the loop
- versioning for the first W. This insures that the loop count is
+ versioning for the first W. This ensures that the loop count is
correct and the first W (shifted) is in the expected resister pair. */
#define rSHL r29 /* Unaligned shift left count. */
#define rSHR r28 /* Unaligned shift right count. */
-#define rB r27 /* Left rotation temp for rWORD2. */
-#define rD r26 /* Left rotation temp for rWORD4. */
-#define rF r25 /* Left rotation temp for rWORD6. */
-#define rH r24 /* Left rotation temp for rWORD8. */
-#define rA r0 /* Right rotation temp for rWORD2. */
-#define rC r12 /* Right rotation temp for rWORD4. */
-#define rE r0 /* Right rotation temp for rWORD6. */
-#define rG r12 /* Right rotation temp for rWORD8. */
+#define rWORD8_SHIFT r27 /* Left rotation temp for rWORD2. */
+#define rWORD2_SHIFT r26 /* Left rotation temp for rWORD4. */
+#define rWORD4_SHIFT r25 /* Left rotation temp for rWORD6. */
+#define rWORD6_SHIFT r24 /* Left rotation temp for rWORD8. */
+ cfi_adjust_cfa_offset(64)
L(unaligned):
- stw r29,40(r1)
- cfi_offset(r29,(40-64))
+ stw rSHL, 40(r1)
+ cfi_offset(rSHL, (40-64))
clrlwi rSHL, rSTR2, 30
- stw r28,36(r1)
- cfi_offset(r28,(36-64))
+ stw rSHR, 36(r1)
+ cfi_offset(rSHR, (36-64))
beq cr5, L(Wunaligned)
- stw r27,32(r1)
- cfi_offset(r27,(32-64))
+ stw rWORD8_SHIFT, 32(r1)
+ cfi_offset(rWORD8_SHIFT, (32-64))
/* Adjust the logical start of rSTR2 to compensate for the extra bits
in the 1st rSTR1 W. */
- sub r27, rSTR2, rBITDIF
+ sub rWORD8_SHIFT, rSTR2, r12
/* But do not attempt to address the W before that W that contains
the actual start of rSTR2. */
clrrwi rSTR2, rSTR2, 2
- stw r26,28(r1)
- cfi_offset(r26,(28-64))
-/* Compute the left/right shift counts for the unalign rSTR2,
+ stw rWORD2_SHIFT, 28(r1)
+ cfi_offset(rWORD2_SHIFT, (28-64))
+/* Compute the left/right shift counts for the unaligned rSTR2,
compensating for the logical (W aligned) start of rSTR1. */
- clrlwi rSHL, r27, 30
+ clrlwi rSHL, rWORD8_SHIFT, 30
clrrwi rSTR1, rSTR1, 2
- stw r25,24(r1)
- cfi_offset(r25,(24-64))
+ stw rWORD4_SHIFT, 24(r1)
+ cfi_offset(rWORD4_SHIFT, (24-64))
slwi rSHL, rSHL, 3
- cmplw cr5, r27, rSTR2
- add rN, rN, rBITDIF
- slwi r11, rBITDIF, 3
- stw r24,20(r1)
- cfi_offset(r24,(20-64))
+ cmplw cr5, rWORD8_SHIFT, rSTR2
+ add rN, rN, r12
+ slwi rWORD6, r12, 3
+ stw rWORD6_SHIFT, 20(r1)
+ cfi_offset(rWORD6_SHIFT, (20-64))
subfic rSHR, rSHL, 32
- srwi rTMP, rN, 4 /* Divide by 16 */
- andi. rBITDIF, rN, 12 /* Get the W remainder */
+ srwi r0, rN, 4 /* Divide by 16 */
+ andi. r12, rN, 12 /* Get the W remainder */
/* We normally need to load 2 Ws to start the unaligned rSTR2, but in
this special case those bits may be discarded anyway. Also we
must avoid loading a W where none of the bits are part of rSTR2 as
this may cross a page boundary and cause a page fault. */
li rWORD8, 0
blt cr5, L(dus0)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD8, 0(rSTR2)
- la rSTR2, 4(rSTR2)
+ addi rSTR2, rSTR2, 4
+#endif
slw rWORD8, rWORD8, rSHL
L(dus0):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 0(rSTR1)
lwz rWORD2, 0(rSTR2)
- cmplwi cr1, rBITDIF, 8
+#endif
+ cmplwi cr1, r12, 8
cmplwi cr7, rN, 16
- srw rG, rWORD2, rSHR
+ srw r12, rWORD2, rSHR
clrlwi rN, rN, 30
beq L(duPs4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- or rWORD8, rG, rWORD8
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ or rWORD8, r12, rWORD8
bgt cr1, L(duPs3)
beq cr1, L(duPs2)
/* Remainder is 4 */
- .align 4
+ .align 4
L(dusP1):
- slw rB, rWORD2, rSHL
- slw rWORD7, rWORD1, r11
- slw rWORD8, rWORD8, r11
+ slw rWORD8_SHIFT, rWORD2, rSHL
+ slw rWORD7, rWORD1, rWORD6
+ slw rWORD8, rWORD8, rWORD6
bge cr7, L(duP1e)
/* At this point we exit early with the first word compare
complete and remainder of 0 to 3 bytes. See L(du14) for details on
@@ -600,95 +813,133 @@ L(dusP1):
bne cr5, L(duLcr5)
cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD2, 4(rSTR2)
- srw rA, rWORD2, rSHR
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 8 */
- .align 4
+ .align 4
L(duPs2):
- slw rH, rWORD2, rSHL
- slw rWORD5, rWORD1, r11
- slw rWORD6, rWORD8, r11
+ slw rWORD6_SHIFT, rWORD2, rSHL
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD8, rWORD6
b L(duP2e)
/* Remainder is 12 */
- .align 4
+ .align 4
L(duPs3):
- slw rF, rWORD2, rSHL
- slw rWORD3, rWORD1, r11
- slw rWORD4, rWORD8, r11
+ slw rWORD4_SHIFT, rWORD2, rSHL
+ slw rWORD3, rWORD1, rWORD6
+ slw rWORD4, rWORD8, rWORD6
b L(duP3e)
/* Count is a multiple of 16, remainder is 0 */
- .align 4
+ .align 4
L(duPs4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- or rWORD8, rG, rWORD8
- slw rD, rWORD2, rSHL
- slw rWORD1, rWORD1, r11
- slw rWORD2, rWORD8, r11
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ or rWORD8, r12, rWORD8
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ slw rWORD1, rWORD1, rWORD6
+ slw rWORD2, rWORD8, rWORD6
b L(duP4e)
/* At this point we know rSTR1 is word aligned and the
compare length is at least 8 bytes. */
- .align 4
+ .align 4
L(Wunaligned):
- stw r27,32(r1)
- cfi_offset(r27,(32-64))
+ stw rWORD8_SHIFT, 32(r1)
+ cfi_offset(rWORD8_SHIFT, (32-64))
clrrwi rSTR2, rSTR2, 2
- stw r26,28(r1)
- cfi_offset(r26,(28-64))
- srwi rTMP, rN, 4 /* Divide by 16 */
- stw r25,24(r1)
- cfi_offset(r25,(24-64))
- andi. rBITDIF, rN, 12 /* Get the W remainder */
- stw r24,20(r1)
- cfi_offset(r24,(20-64))
+ stw rWORD2_SHIFT, 28(r1)
+ cfi_offset(rWORD2_SHIFT, (28-64))
+ srwi r0, rN, 4 /* Divide by 16 */
+ stw rWORD4_SHIFT, 24(r1)
+ cfi_offset(rWORD4_SHIFT, (24-64))
+ andi. r12, rN, 12 /* Get the W remainder */
+ stw rWORD6_SHIFT, 20(r1)
+ cfi_offset(rWORD6_SHIFT, (20-64))
slwi rSHL, rSHL, 3
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD6, 0(rSTR2)
lwzu rWORD8, 4(rSTR2)
- cmplwi cr1, rBITDIF, 8
+#endif
+ cmplwi cr1, r12, 8
cmplwi cr7, rN, 16
clrlwi rN, rN, 30
subfic rSHR, rSHL, 32
- slw rH, rWORD6, rSHL
+ slw rWORD6_SHIFT, rWORD6, rSHL
beq L(duP4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
bgt cr1, L(duP3)
beq cr1, L(duP2)
/* Remainder is 4 */
- .align 4
+ .align 4
L(duP1):
- srw rG, rWORD8, rSHR
+ srw r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
lwz rWORD7, 0(rSTR1)
- slw rB, rWORD8, rSHL
- or rWORD8, rG, rH
+#endif
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP1x)
L(duP1e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
- srw rA, rWORD2, rSHR
- slw rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 8(rSTR1)
lwz rWORD4, 8(rSTR2)
- cmplw cr0, rWORD1, rWORD2
- srw rC, rWORD4, rSHR
- slw rF, rWORD4, rSHL
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
bne cr5, L(duLcr5)
- or rWORD4, rC, rD
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 12(rSTR1)
lwz rWORD6, 12(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
- srw rE, rWORD6, rSHR
- slw rH, rWORD6, rSHL
- bne cr0, L(duLcr0)
- or rWORD6, rE, rF
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ bne cr7, L(duLcr7)
+ or rWORD6, r0, rWORD4_SHIFT
cmplw cr6, rWORD5, rWORD6
b L(duLoop3)
- .align 4
+ .align 4
/* At this point we exit early with the first word compare
complete and remainder of 0 to 3 bytes. See L(du14) for details on
how we handle the remaining bytes. */
@@ -698,186 +949,321 @@ L(duP1x):
bne cr5, L(duLcr5)
cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
- ld rWORD2, 8(rSTR2)
- srw rA, rWORD2, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 8(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 8 */
- .align 4
+ .align 4
L(duP2):
- srw rE, rWORD8, rSHR
+ srw r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
lwz rWORD5, 0(rSTR1)
- or rWORD6, rE, rH
- slw rH, rWORD8, rSHL
+#endif
+ or rWORD6, r0, rWORD6_SHIFT
+ slw rWORD6_SHIFT, rWORD8, rSHL
L(duP2e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD7, 4(rSTR1)
lwz rWORD8, 4(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
- srw rG, rWORD8, rSHR
- slw rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP2x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 8(rSTR1)
lwz rWORD2, 8(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
- srw rA, rWORD2, rSHR
- slw rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 12(rSTR1)
lwz rWORD4, 12(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
bne cr5, L(duLcr5)
- srw rC, rWORD4, rSHR
- slw rF, rWORD4, rSHL
- or rWORD4, rC, rD
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 4
addi rSTR2, rSTR2, 4
+#endif
cmplw cr1, rWORD3, rWORD4
b L(duLoop2)
- .align 4
+ .align 4
L(duP2x):
cmplw cr5, rWORD7, rWORD8
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 4
addi rSTR2, rSTR2, 4
+#endif
bne cr6, L(duLcr6)
slwi. rN, rN, 3
bne cr5, L(duLcr5)
cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD2, 4(rSTR2)
- srw rA, rWORD2, rSHR
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 12 */
- .align 4
+ .align 4
L(duP3):
- srw rC, rWORD8, rSHR
+ srw r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
lwz rWORD3, 0(rSTR1)
- slw rF, rWORD8, rSHL
- or rWORD4, rC, rH
+#endif
+ slw rWORD4_SHIFT, rWORD8, rSHL
+ or rWORD4, r12, rWORD6_SHIFT
L(duP3e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 4(rSTR1)
lwz rWORD6, 4(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
- srw rE, rWORD6, rSHR
- slw rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD7, 8(rSTR1)
lwz rWORD8, 8(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
bne cr1, L(duLcr1)
- srw rG, rWORD8, rSHR
- slw rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP3x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 12(rSTR1)
lwz rWORD2, 12(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
- srw rA, rWORD2, rSHR
- slw rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
b L(duLoop1)
- .align 4
+ .align 4
L(duP3x):
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
+#endif
+#if 0
+/* Huh? We've already branched on cr1! */
bne cr1, L(duLcr1)
+#endif
cmplw cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
slwi. rN, rN, 3
bne cr5, L(duLcr5)
cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD2, 4(rSTR2)
- srw rA, rWORD2, rSHR
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Count is a multiple of 16, remainder is 0 */
- .align 4
+ .align 4
L(duP4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- srw rA, rWORD8, rSHR
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ srw r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
lwz rWORD1, 0(rSTR1)
- slw rD, rWORD8, rSHL
- or rWORD2, rA, rH
+#endif
+ slw rWORD2_SHIFT, rWORD8, rSHL
+ or rWORD2, r0, rWORD6_SHIFT
L(duP4e):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 4(rSTR1)
lwz rWORD4, 4(rSTR2)
- cmplw cr0, rWORD1, rWORD2
- srw rC, rWORD4, rSHR
- slw rF, rWORD4, rSHL
- or rWORD4, rC, rD
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 8(rSTR1)
lwz rWORD6, 8(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
- bne cr0, L(duLcr0)
- srw rE, rWORD6, rSHR
- slw rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ bne cr7, L(duLcr7)
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwzu rWORD7, 12(rSTR1)
lwzu rWORD8, 12(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
bne cr1, L(duLcr1)
- srw rG, rWORD8, rSHR
- slw rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
cmplw cr5, rWORD7, rWORD8
bdz- L(du24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
- .align 4
+ .align 4
L(duLoop):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD1, 4(rSTR1)
lwz rWORD2, 4(rSTR2)
+#endif
cmplw cr1, rWORD3, rWORD4
bne cr6, L(duLcr6)
- srw rA, rWORD2, rSHR
- slw rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
L(duLoop1):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD3, 8(rSTR1)
lwz rWORD4, 8(rSTR2)
+#endif
cmplw cr6, rWORD5, rWORD6
bne cr5, L(duLcr5)
- srw rC, rWORD4, rSHR
- slw rF, rWORD4, rSHL
- or rWORD4, rC, rD
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
L(duLoop2):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD5, 12(rSTR1)
lwz rWORD6, 12(rSTR2)
+#endif
cmplw cr5, rWORD7, rWORD8
- bne cr0, L(duLcr0)
- srw rE, rWORD6, rSHR
- slw rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ bne cr7, L(duLcr7)
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
L(duLoop3):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
lwzu rWORD7, 16(rSTR1)
lwzu rWORD8, 16(rSTR2)
- cmplw cr0, rWORD1, rWORD2
+#endif
+ cmplw cr7, rWORD1, rWORD2
bne- cr1, L(duLcr1)
- srw rG, rWORD8, rSHR
- slw rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
bdnz+ L(duLoop)
L(duL4):
+#if 0
+/* Huh? We've already branched on cr1! */
bne cr1, L(duLcr1)
+#endif
cmplw cr1, rWORD3, rWORD4
bne cr6, L(duLcr6)
cmplw cr6, rWORD5, rWORD6
bne cr5, L(duLcr5)
cmplw cr5, rWORD7, rWORD8
L(du44):
- bne cr0, L(duLcr0)
+ bne cr7, L(duLcr7)
L(du34):
bne cr1, L(duLcr1)
L(du24):
@@ -887,95 +1273,101 @@ L(du14):
bne cr5, L(duLcr5)
/* At this point we have a remainder of 1 to 3 bytes to compare. We use
shift right to eliminate bits beyond the compare length.
+ This allows the use of word subtract to compute the final result.
However it may not be safe to load rWORD2 which may be beyond the
string length. So we compare the bit length of the remainder to
the right shift count (rSHR). If the bit count is less than or equal
we do not need to load rWORD2 (all significant bits are already in
- rB). */
+ rWORD8_SHIFT). */
cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
lwz rWORD2, 4(rSTR2)
- srw rA, rWORD2, rSHR
- .align 4
+#endif
+ srw r0, rWORD2, rSHR
+ .align 4
L(dutrim):
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+#else
lwz rWORD1, 4(rSTR1)
- lwz r31,48(1)
+#endif
+ lwz rWORD8, 48(r1)
subfic rN, rN, 32 /* Shift count is 32 - (rN * 8). */
- or rWORD2, rA, rB
- lwz r30,44(1)
- lwz r29,40(r1)
+ or rWORD2, r0, rWORD8_SHIFT
+ lwz rWORD7, 44(r1)
+ lwz rSHL, 40(r1)
srw rWORD1, rWORD1, rN
srw rWORD2, rWORD2, rN
- lwz r28,36(r1)
- lwz r27,32(r1)
- cmplw rWORD1,rWORD2
- li rRTN,0
- beq L(dureturn26)
- li rRTN,1
- bgt L(dureturn26)
- li rRTN,-1
- b L(dureturn26)
- .align 4
-L(duLcr0):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rSHR, 36(r1)
+ lwz rWORD8_SHIFT, 32(r1)
+ sub rRTN, rWORD1, rWORD2
+ b L(dureturn26)
+ .align 4
+L(duLcr7):
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
li rRTN, 1
- bgt cr0, L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
+ bgt cr7, L(dureturn29)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr1):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
li rRTN, 1
bgt cr1, L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr6):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
li rRTN, 1
bgt cr6, L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr5):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
li rRTN, 1
bgt cr5, L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
li rRTN, -1
b L(dureturn27)
.align 3
L(duZeroReturn):
- li rRTN,0
+ li rRTN, 0
.align 4
L(dureturn):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
L(dureturn29):
- lwz r29,40(r1)
- lwz r28,36(r1)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
L(dureturn27):
- lwz r27,32(r1)
+ lwz rWORD8_SHIFT, 32(r1)
L(dureturn26):
- lwz r26,28(r1)
+ lwz rWORD2_SHIFT, 28(r1)
L(dureturn25):
- lwz r25,24(r1)
- lwz r24,20(r1)
- lwz 1,0(1)
+ lwz rWORD4_SHIFT, 24(r1)
+ lwz rWORD6_SHIFT, 20(r1)
+ addi 1, 1, 64
+ cfi_adjust_cfa_offset(-64)
blr
END (memcmp)
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/memcpy.S b/libc/sysdeps/powerpc/powerpc32/power4/memcpy.S
index d9146631e..338d3cce3 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/memcpy.S
@@ -203,15 +203,28 @@ EALIGN (memcpy, 5, 0)
blt cr6,5f
srwi 7,6,16
bgt cr6,3f
+#ifdef __LITTLE_ENDIAN__
+ sth 7,0(3)
+#else
sth 6,0(3)
+#endif
b 7f
.align 4
3:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,24
+ stb 6,0(3)
+ sth 7,1(3)
+#else
stb 7,0(3)
sth 6,1(3)
+#endif
b 7f
.align 4
5:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,8
+#endif
stb 6,0(3)
7:
cmplwi cr1,10,16
@@ -339,13 +352,23 @@ EALIGN (memcpy, 5, 0)
bf 30,1f
/* there are at least two words to copy, so copy them */
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10 /* shift 1st src word to left align it in R0 */
srw 8,7,9 /* shift 2nd src word to right align it in R8 */
+#endif
or 0,0,8 /* or them to get word to store */
lwz 6,8(5) /* load the 3rd src word */
stw 0,0(4) /* store the 1st dst word */
+#ifdef __LITTLE_ENDIAN__
+ srw 0,7,10
+ slw 8,6,9
+#else
slw 0,7,10 /* now left align 2nd src word into R0 */
srw 8,6,9 /* shift 3rd src word to right align it in R8 */
+#endif
or 0,0,8 /* or them to get word to store */
lwz 7,12(5)
stw 0,4(4) /* store the 2nd dst word */
@@ -353,8 +376,13 @@ EALIGN (memcpy, 5, 0)
addi 5,5,16
bf 31,4f
/* there is a third word to copy, so copy it */
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10 /* shift 3rd src word to left align it in R0 */
srw 8,7,9 /* shift 4th src word to right align it in R8 */
+#endif
or 0,0,8 /* or them to get word to store */
stw 0,0(4) /* store 3rd dst word */
mr 6,7
@@ -364,8 +392,13 @@ EALIGN (memcpy, 5, 0)
b 4f
.align 4
1:
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10 /* shift 1st src word to left align it in R0 */
srw 8,7,9 /* shift 2nd src word to right align it in R8 */
+#endif
addi 5,5,8
or 0,0,8 /* or them to get word to store */
bf 31,4f
@@ -378,23 +411,43 @@ EALIGN (memcpy, 5, 0)
.align 4
4:
/* copy 16 bytes at a time */
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10
srw 8,7,9
+#endif
or 0,0,8
lwz 6,0(5)
stw 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srw 0,7,10
+ slw 8,6,9
+#else
slw 0,7,10
srw 8,6,9
+#endif
or 0,0,8
lwz 7,4(5)
stw 0,4(4)
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10
srw 8,7,9
+#endif
or 0,0,8
lwz 6,8(5)
stw 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srw 0,7,10
+ slw 8,6,9
+#else
slw 0,7,10
srw 8,6,9
+#endif
or 0,0,8
lwz 7,12(5)
stw 0,12(4)
@@ -403,8 +456,13 @@ EALIGN (memcpy, 5, 0)
bdnz+ 4b
8:
/* calculate and store the final word */
+#ifdef __LITTLE_ENDIAN__
+ srw 0,6,10
+ slw 8,7,9
+#else
slw 0,6,10
srw 8,7,9
+#endif
or 0,0,8
stw 0,0(4)
3:
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/memset.S b/libc/sysdeps/powerpc/powerpc32/power4/memset.S
index c2d288b38..4fd9d8cb4 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -50,7 +50,7 @@ L(_memset):
/* Align to word boundary. */
cmplwi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
@@ -65,7 +65,7 @@ L(g0):
/* Handle the case of size < 31. */
L(aligned):
mtcrf 0x01, rLEN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x1C
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/strncmp.S b/libc/sysdeps/powerpc/powerpc32/power4/strncmp.S
index 724d9084a..89b961e78 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/power4/strncmp.S
@@ -24,7 +24,7 @@
EALIGN (strncmp, 4, 0)
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -37,6 +37,7 @@ EALIGN (strncmp, 4, 0)
#define r7F7F r9 /* constant 0x7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -75,12 +76,45 @@ L(g1): add rTMP, rFEFE, rWORD1
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ slwi rTMP, rTMP, 1
+ addi rTMP2, rTMP, -1
+ andc rTMP2, rTMP2, rTMP
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rldimi rTMP2, rWORD2, 24, 32
+ rldimi rTMP, rWORD1, 24, 32
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+L(different):
+ lwz rWORD1, -4(rSTR1)
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rldimi rTMP2, rWORD2, 24, 32
+ rldimi rTMP, rWORD1, 24, 32
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
@@ -88,28 +122,20 @@ L(endstring):
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
- blt- cr1, L(equal)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+ cr1
L(equal):
li rRTN, 0
blr
L(different):
- lwzu rWORD1, -4(rSTR1)
+ lwz rWORD1, -4(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
- blt- L(highbit)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+
L(highbit):
- srwi rWORD2, rWORD2, 24
- srwi rWORD1, rWORD1, 24
- sub rRTN, rWORD1, rWORD2
+ ori rRTN, rWORD2, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S b/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
index ecd37c3cd..49c8a0866 100644
--- a/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
+++ b/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
@@ -39,8 +39,8 @@ ENTRY (__llround)
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r4,12(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llround)
diff --git a/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S b/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
index d4da625bb..780dd9ca4 100644
--- a/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
+++ b/libc/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
@@ -38,7 +38,7 @@ ENTRY (__lround)
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1)
+ lwz r3,8+LOWORD(r1)
addi r1,r1,16
blr
END (__lround)
diff --git a/libc/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S b/libc/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
index f2417fdf4..5f7ba43a2 100644
--- a/libc/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
+++ b/libc/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
@@ -27,8 +27,8 @@ EALIGN (__isnan, 4, 0)
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
- lwz r4,24(r1)
- lwz r5,28(r1)
+ lwz r4,24+HIWORD(r1)
+ lwz r5,24+LOWORD(r1)
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
index 2c095db1d..3ea18589c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
@@ -27,8 +27,8 @@ EALIGN (__isnan, 4, 0)
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
- lwz r4,24(r1)
- lwz r5,28(r1)
+ lwz r4,24+HIWORD(r1)
+ lwz r5,24+LOWORD(r1)
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
index 3344b312e..c0660cf6e 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
@@ -29,8 +29,8 @@ ENTRY (__llrint)
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrint)
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
index 7f64f8d12..ce298905c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
@@ -28,8 +28,8 @@ ENTRY (__llrintf)
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrintf)
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
index 0ff04cb71..abb0840d1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
@@ -39,8 +39,8 @@ ENTRY (__llround)
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
- lwz r4,12(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llround)
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S b/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
index a76f71e04..f58114a0c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
@@ -219,15 +219,28 @@ L(word_unaligned_short):
blt cr6,5f
srwi 7,6,16
bgt cr6,3f
+#ifdef __LITTLE_ENDIAN__
+ sth 7,0(3)
+#else
sth 6,0(3)
+#endif
b 7f
.align 4
3:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,24
+ stb 6,0(3)
+ sth 7,1(3)
+#else
stb 7,0(3)
sth 6,1(3)
+#endif
b 7f
.align 4
5:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,8
+#endif
stb 6,0(3)
7:
cmplwi cr1,10,16
@@ -577,7 +590,11 @@ L(wdu1_32):
lwz 6,-1(4)
cmplwi cr6,31,4
srwi 8,31,5 /* calculate the 32 byte loop count */
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,6,8
+#else
slwi 6,6,8
+#endif
clrlwi 31,31,27 /* The remaining bytes, < 32. */
blt cr5,L(wdu1_32tail)
mtctr 8
@@ -585,8 +602,12 @@ L(wdu1_32):
lwz 8,3(4)
lwz 7,4(4)
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,24,32
+#else
/* Equivalent to: srwi 8,8,32-8; or 6,6,8 */
rlwimi 6,8,8,(32-8),31
+#endif
b L(wdu1_loop32x)
.align 4
L(wdu1_loop32):
@@ -595,8 +616,12 @@ L(wdu1_loop32):
lwz 7,4(4)
stw 10,-8(3)
stw 11,-4(3)
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,24,32
+#else
/* Equivalent to srwi 8,8,32-8; or 6,6,8 */
rlwimi 6,8,8,(32-8),31
+#endif
L(wdu1_loop32x):
lwz 10,8(4)
lwz 11,12(4)
@@ -613,7 +638,11 @@ L(wdu1_loop32x):
stw 6,16(3)
stw 7,20(3)
addi 3,3,32
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,8,8
+#else
slwi 6,8,8
+#endif
bdnz+ L(wdu1_loop32)
stw 10,-8(3)
stw 11,-4(3)
@@ -624,8 +653,12 @@ L(wdu1_32tail):
blt cr6,L(wdu_4tail)
/* calculate and store the final word */
lwz 8,3(4)
-/* Equivalent to: srwi 8,8,32-9; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,24,32
+#else
+/* Equivalent to: srwi 8,8,32-8; or 6,6,8 */
rlwimi 6,8,8,(32-8),31
+#endif
b L(wdu_32tailx)
L(wdu2_32):
@@ -633,7 +666,11 @@ L(wdu2_32):
lwz 6,-2(4)
cmplwi cr6,31,4
srwi 8,31,5 /* calculate the 32 byte loop count */
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,6,16
+#else
slwi 6,6,16
+#endif
clrlwi 31,31,27 /* The remaining bytes, < 32. */
blt cr5,L(wdu2_32tail)
mtctr 8
@@ -641,8 +678,11 @@ L(wdu2_32):
lwz 8,2(4)
lwz 7,4(4)
-/* Equivalent to: srwi 8,8,32-8; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,16,32
+#else
rlwimi 6,8,16,(32-16),31
+#endif
b L(wdu2_loop32x)
.align 4
L(wdu2_loop32):
@@ -651,8 +691,11 @@ L(wdu2_loop32):
lwz 7,4(4)
stw 10,-8(3)
stw 11,-4(3)
-/* Equivalent to srwi 8,8,32-8; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,16,32
+#else
rlwimi 6,8,16,(32-16),31
+#endif
L(wdu2_loop32x):
lwz 10,8(4)
lwz 11,12(4)
@@ -670,7 +713,11 @@ L(wdu2_loop32x):
stw 6,16(3)
stw 7,20(3)
addi 3,3,32
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,8,16
+#else
slwi 6,8,16
+#endif
bdnz+ L(wdu2_loop32)
stw 10,-8(3)
stw 11,-4(3)
@@ -681,8 +728,11 @@ L(wdu2_32tail):
blt cr6,L(wdu_4tail)
/* calculate and store the final word */
lwz 8,2(4)
-/* Equivalent to: srwi 8,8,32-9; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,16,32
+#else
rlwimi 6,8,16,(32-16),31
+#endif
b L(wdu_32tailx)
L(wdu3_32):
@@ -690,7 +740,11 @@ L(wdu3_32):
lwz 6,-3(4)
cmplwi cr6,31,4
srwi 8,31,5 /* calculate the 32 byte loop count */
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,6,24
+#else
slwi 6,6,24
+#endif
clrlwi 31,31,27 /* The remaining bytes, < 32. */
blt cr5,L(wdu3_32tail)
mtctr 8
@@ -698,8 +752,11 @@ L(wdu3_32):
lwz 8,1(4)
lwz 7,4(4)
-/* Equivalent to: srwi 8,8,32-8; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,8,32
+#else
rlwimi 6,8,24,(32-24),31
+#endif
b L(wdu3_loop32x)
.align 4
L(wdu3_loop32):
@@ -708,8 +765,11 @@ L(wdu3_loop32):
lwz 7,4(4)
stw 10,-8(3)
stw 11,-4(3)
-/* Equivalent to srwi 8,8,32-8; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,8,32
+#else
rlwimi 6,8,24,(32-24),31
+#endif
L(wdu3_loop32x):
lwz 10,8(4)
lwz 11,12(4)
@@ -726,7 +786,11 @@ L(wdu3_loop32x):
stw 6,16(3)
stw 7,20(3)
addi 3,3,32
+#ifdef __LITTLE_ENDIAN__
+ srwi 6,8,24
+#else
slwi 6,8,24
+#endif
bdnz+ L(wdu3_loop32)
stw 10,-8(3)
stw 11,-4(3)
@@ -737,8 +801,11 @@ L(wdu3_32tail):
blt cr6,L(wdu_4tail)
/* calculate and store the final word */
lwz 8,1(4)
-/* Equivalent to: srwi 8,8,32-9; or 6,6,8 */
+#ifdef __LITTLE_ENDIAN__
+ rldimi 6,8,8,32
+#else
rlwimi 6,8,24,(32-24),31
+#endif
b L(wdu_32tailx)
.align 4
L(wdu_32tailx):
diff --git a/libc/sysdeps/powerpc/powerpc32/power6/memset.S b/libc/sysdeps/powerpc/powerpc32/power6/memset.S
index 8c23c8d13..a4b002a96 100644
--- a/libc/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -48,7 +48,7 @@ L(_memset):
ble- cr1, L(small)
/* Align to word boundary. */
cmplwi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
@@ -64,7 +64,7 @@ L(g0):
/* Handle the case of size < 31. */
L(aligned):
mtcrf 0x01, rLEN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x1C
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
index b2ab5bfe7..095c15547 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
@@ -54,9 +54,8 @@ ENTRY (__finite)
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r0,8(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r0,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
clrlwi r0,r0,17 /* r0 = abs(r0). */
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r0,0x7ff0 /* r4 == 0x7ff0?. */
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
index 3f8af60a5..0101c8fa1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
@@ -48,14 +48,13 @@ ENTRY (__isinf)
li r3,0
bflr 29 /* If not INF, return. */
- /* Either we have -INF/+INF or a denormal. */
+ /* Either we have +INF or -INF. */
stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r4,8(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
index 99ff12696..0ad1dcf1f 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
@@ -53,8 +53,8 @@ ENTRY (__isnan)
stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lwz r4,8(r1) /* Load the upper half of the FP value. */
- lwz r5,12(r1) /* Load the lower half of the FP value. */
+ lwz r4,8+HIWORD(r1) /* Load the upper half of the FP value. */
+ lwz r5,8+LOWORD(r1) /* Load the lower half of the FP value. */
addi r1,r1,16 /* Reset the stack pointer. */
lis r0,0x7ff0 /* Load the upper portion for an INF/NaN. */
clrlwi r4,r4,1 /* r4 = abs(r4). */
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
index e008ed0c3..1c82577f5 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
+++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
@@ -35,14 +35,14 @@ static const union {
long double
__logbl (long double x)
{
- double xh, xl;
+ double xh;
double ret;
if (__builtin_expect (x == 0.0L, 0))
/* Raise FE_DIVBYZERO and return -HUGE_VAL[LF]. */
return -1.0L / __builtin_fabsl (x);
- ldbl_unpack (x, &xh, &xl);
+ xh = ldbl_high (x);
/* ret = x & 0x7ff0000000000000; */
asm (
"xxland %x0,%x1,%x2\n"
@@ -58,9 +58,9 @@ __logbl (long double x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int64_t lx, hx;
+ int64_t hx;
- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ EXTRACT_WORDS64 (hx, xh);
return (long double) (-1023 - (__builtin_clzll (hx) - 12));
}
/* Test to avoid logb_downward (0.0) == -0.0. */
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memchr.S b/libc/sysdeps/powerpc/powerpc32/power7/memchr.S
index 369e5e048..85754f3f1 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memchr.S
@@ -25,107 +25,111 @@ ENTRY (__memchr)
CALL_MCOUNT
dcbt 0,r3
clrrwi r8,r3,2
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
add r7,r3,r5 /* Calculate the last acceptable address. */
+ insrdi r4,r4,16,32
cmplwi r5,16
+ li r9, -1
+ rlwinm r6,r3,3,27,28 /* Calculate padding. */
+ addi r7,r7,-1
+#ifdef __LITTLE_ENDIAN__
+ slw r9,r9,r6
+#else
+ srw r9,r9,r6
+#endif
ble L(small_range)
- cmplw cr7,r3,r7 /* Compare the starting address (r3) with the
- ending address (r7). If (r3 >= r7), the size
- passed in is zero or negative. */
- ble cr7,L(proceed)
-
- li r7,-1 /* Artificially set our ending address (r7)
- such that we will exit early. */
-L(proceed):
- rlwinm r6,r3,3,27,28 /* Calculate padding. */
- cmpli cr6,r6,0 /* cr6 == Do we have padding? */
lwz r12,0(r8) /* Load word from memory. */
- cmpb r10,r12,r4 /* Check for BYTEs in WORD1. */
- beq cr6,L(proceed_no_padding)
- slw r10,r10,r6
- srw r10,r10,r6
-L(proceed_no_padding):
- cmplwi cr7,r10,0 /* If r10 == 0, no BYTEs have been found. */
+ cmpb r3,r12,r4 /* Check for BYTEs in WORD1. */
+ and r3,r3,r9
+ clrlwi r5,r7,30 /* Byte count - 1 in last word. */
+ clrrwi r7,r7,2 /* Address of last word. */
+ cmplwi cr7,r3,0 /* If r3 == 0, no BYTEs have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
- bge cr6,L(null)
-
mtcrf 0x01,r8
/* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
-
bt 29,L(loop_setup)
/* Handle WORD2 of pair. */
lwzu r12,4(r8)
- cmpb r10,r12,r4
- cmplwi cr7,r10,0
+ cmpb r3,r12,r4
+ cmplwi cr7,r3,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
- bge cr6,L(null)
-
L(loop_setup):
- sub r5,r7,r9
- srwi r6,r5,3 /* Number of loop iterations. */
+ /* The last word we want to read in the loop below is the one
+ containing the last byte of the string, ie. the word at
+ (s + size - 1) & ~3, or r7. The first word read is at
+ r8 + 4, we read 2 * cnt words, so the last word read will
+ be at r8 + 4 + 8 * cnt - 4. Solving for cnt gives
+ cnt = (r7 - r8) / 8 */
+ sub r6,r7,r8
+ srwi r6,r6,3 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for BYTE backwards in the string. Since
- it's a small loop (< 8 instructions), align it to 32-bytes. */
- .p2align 5
+
+ /* Main loop to look for BYTE in the string. Since
+ it's a small loop (8 instructions), align it to 32-bytes. */
+ .align 5
L(loop):
/* Load two words, compare and merge in a
single register for speed. This is an attempt
to speed up the byte-checking process for bigger strings. */
lwz r12,4(r8)
lwzu r11,8(r8)
- cmpb r10,r12,r4
+ cmpb r3,r12,r4
cmpb r9,r11,r4
- or r5,r9,r10 /* Merge everything in one word. */
- cmplwi cr7,r5,0
+ or r6,r9,r3 /* Merge everything in one word. */
+ cmplwi cr7,r6,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for BYTE in the whole range. */
- subi r11,r7,4
- cmplw cr6,r8,r11
- blt cr6,L(loop_small)
- b L(null)
+ /* We may have one more dword to read. */
+ cmplw r8,r7
+ beqlr
+
+ lwzu r12,4(r8)
+ cmpb r3,r12,r4
+ cmplwi cr6,r3,0
+ bne cr6,L(done)
+ blr
+ .align 4
+L(found):
/* OK, one (or both) of the words contains BYTE. Check
the first word and decrement the address in case the first
word really contains BYTE. */
- .align 4
-L(found):
- cmplwi cr6,r10,0
+ cmplwi cr6,r3,0
addi r8,r8,-4
bne cr6,L(done)
/* BYTE must be in the second word. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
+ again and move the result of cmpb to r3 so we can calculate the
pointer. */
- mr r10,r9
+ mr r3,r9
addi r8,r8,4
- /* r10 has the output of the cmpb instruction, that is, it contains
+ /* r3 has the output of the cmpb instruction, that is, it contains
0xff in the same position as BYTE in the original
word from the string. Use that to calculate the pointer.
We need to make sure BYTE is *before* the end of the range. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r3,-1
+ andc r0,r0,r3
+ popcntw r0,r0 /* Count trailing zeros. */
+#else
+ cntlzw r0,r3 /* Count leading zeros before the match. */
+#endif
+ cmplw r8,r7 /* Are we on the last word? */
+ srwi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
add r3,r8,r0
- cmplw r3,r7
- bge L(null)
+ cmplw cr7,r0,r5 /* If on the last dword, check byte offset. */
+ bnelr
+ blelr cr7
+ li r3,0
blr
.align 4
@@ -137,67 +141,42 @@ L(null):
.align 4
L(small_range):
cmplwi r5,0
- rlwinm r6,r3,3,27,28 /* Calculate padding. */
- beq L(null) /* This branch is for the cmplwi r5,0 above */
+ beq L(null)
lwz r12,0(r8) /* Load word from memory. */
- cmplwi cr6,r6,0 /* cr6 == Do we have padding? */
- cmpb r10,r12,r4 /* Check for BYTE in DWORD1. */
- beq cr6,L(small_no_padding)
- slw r10,r10,r6
- srw r10,r10,r6
-L(small_no_padding):
- cmplwi cr7,r10,0
+ cmpb r3,r12,r4 /* Check for BYTE in DWORD1. */
+ and r3,r3,r9
+ cmplwi cr7,r3,0
+ clrlwi r5,r7,30 /* Byte count - 1 in last word. */
+ clrrwi r7,r7,2 /* Address of last word. */
+ cmplw r8,r7 /* Are we done already? */
bne cr7,L(done)
+ beqlr
- /* Are we done already? */
- addi r9,r8,4
- cmplw r9,r7
- bge L(null)
-
-L(loop_small): /* loop_small has been unrolled. */
lwzu r12,4(r8)
- cmpb r10,r12,r4
- addi r9,r8,4
- cmplwi cr6,r10,0
- cmplw r9,r7
+ cmpb r3,r12,r4
+ cmplwi cr6,r3,0
+ cmplw r8,r7
bne cr6,L(done)
- bge L(null)
+ beqlr
lwzu r12,4(r8)
- cmpb r10,r12,r4
- addi r9,r8,4
- cmplwi cr6,r10,0
- cmplw r9,r7
+ cmpb r3,r12,r4
+ cmplwi cr6,r3,0
+ cmplw r8,r7
bne cr6,L(done)
- bge L(null)
+ beqlr
lwzu r12,4(r8)
- cmpb r10,r12,r4
- addi r9,r8,4
- cmplwi cr6,r10,0
- cmplw r9,r7
+ cmpb r3,r12,r4
+ cmplwi cr6,r3,0
+ cmplw r8,r7
bne cr6,L(done)
- bge L(null)
+ beqlr
lwzu r12,4(r8)
- cmpb r10,r12,r4
- addi r9,r8,4
- cmplwi cr6,r10,0
- cmplw r9,r7
+ cmpb r3,r12,r4
+ cmplwi cr6,r3,0
bne cr6,L(done)
- bge L(null)
-
- /* For most cases we will never get here. Under some combinations of
- padding + length there is a leftover word that still needs to be
- checked. */
- lwzu r12,4(r8)
- cmpb r10,r12,r4
- addi r9,r8,4
- cmplwi cr6,r10,0
- bne cr6,L(done)
-
- /* save a branch and exit directly */
- li r3,0
blr
END (__memchr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memcmp.S b/libc/sysdeps/powerpc/powerpc32/power7/memcmp.S
index 075e19f14..f160ddebf 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memcmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memcmp.S
@@ -23,10 +23,9 @@
size_t size [r5]) */
.machine power7
-EALIGN (memcmp,4,0)
+EALIGN (memcmp, 4, 0)
CALL_MCOUNT
-#define rTMP r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -37,35 +36,32 @@ EALIGN (memcmp,4,0)
#define rWORD4 r9 /* next word in s2 */
#define rWORD5 r10 /* next word in s1 */
#define rWORD6 r11 /* next word in s2 */
-#define rBITDIF r12 /* bits that differ in s1 & s2 words */
#define rWORD7 r30 /* next word in s1 */
#define rWORD8 r31 /* next word in s2 */
- xor rTMP,rSTR2,rSTR1
- cmplwi cr6,rN,0
- cmplwi cr1,rN,12
- clrlwi. rTMP,rTMP,30
- clrlwi rBITDIF,rSTR1,30
- cmplwi cr5,rBITDIF,0
- beq- cr6,L(zeroLength)
- dcbt 0,rSTR1
- dcbt 0,rSTR2
-
- /* If less than 8 bytes or not aligned, use the unaligned
- byte loop. */
-
- blt cr1,L(bytealigned)
- stwu 1,-64(1)
+ xor r0, rSTR2, rSTR1
+ cmplwi cr6, rN, 0
+ cmplwi cr1, rN, 12
+ clrlwi. r0, r0, 30
+ clrlwi r12, rSTR1, 30
+ cmplwi cr5, r12, 0
+ beq- cr6, L(zeroLength)
+ dcbt 0, rSTR1
+ dcbt 0, rSTR2
+/* If less than 8 bytes or not aligned, use the unaligned
+ byte loop. */
+ blt cr1, L(bytealigned)
+ stwu 1, -64(r1)
cfi_adjust_cfa_offset(64)
- stw r31,48(1)
- cfi_offset(31,(48-64))
- stw r30,44(1)
- cfi_offset(30,(44-64))
+ stw rWORD8, 48(r1)
+ cfi_offset(rWORD8, (48-64))
+ stw rWORD7, 44(r1)
+ cfi_offset(rWORD7, (44-64))
bne L(unaligned)
/* At this point we know both strings have the same alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
2 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then we are already word
+ of r12 to 0. If r12 == 0 then we are already word
aligned and can perform the word aligned loop.
Otherwise we know the two strings have the same alignment (but not
@@ -74,332 +70,541 @@ EALIGN (memcmp,4,0)
eliminate bits preceding the first byte. Since we want to join the
normal (word aligned) compare loop, starting at the second word,
we need to adjust the length (rN) and special case the loop
- versioning for the first word. This insures that the loop count is
+ versioning for the first word. This ensures that the loop count is
correct and the first word (shifted) is in the expected register pair. */
.align 4
L(samealignment):
- clrrwi rSTR1,rSTR1,2
- clrrwi rSTR2,rSTR2,2
- beq cr5,L(Waligned)
- add rN,rN,rBITDIF
- slwi r11,rBITDIF,3
- srwi rTMP,rN,4 /* Divide by 16 */
- andi. rBITDIF,rN,12 /* Get the word remainder */
- lwz rWORD1,0(rSTR1)
- lwz rWORD2,0(rSTR2)
- cmplwi cr1,rBITDIF,8
- cmplwi cr7,rN,16
- clrlwi rN,rN,30
+ clrrwi rSTR1, rSTR1, 2
+ clrrwi rSTR2, rSTR2, 2
+ beq cr5, L(Waligned)
+ add rN, rN, r12
+ slwi rWORD6, r12, 3
+ srwi r0, rN, 4 /* Divide by 16 */
+ andi. r12, rN, 12 /* Get the word remainder */
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 0(rSTR1)
+ lwz rWORD2, 0(rSTR2)
+#endif
+ cmplwi cr1, r12, 8
+ cmplwi cr7, rN, 16
+ clrlwi rN, rN, 30
beq L(dPs4)
- mtctr rTMP
- bgt cr1,L(dPs3)
- beq cr1,L(dPs2)
+ mtctr r0
+ bgt cr1, L(dPs3)
+ beq cr1, L(dPs2)
/* Remainder is 4 */
.align 3
L(dsP1):
- slw rWORD5,rWORD1,r11
- slw rWORD6,rWORD2,r11
- cmplw cr5,rWORD5,rWORD6
- blt cr7,L(dP1x)
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD2, rWORD6
+ cmplw cr5, rWORD5, rWORD6
+ blt cr7, L(dP1x)
/* Do something useful in this cycle since we have to branch anyway. */
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- cmplw cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
b L(dP1e)
/* Remainder is 8 */
.align 4
L(dPs2):
- slw rWORD5,rWORD1,r11
- slw rWORD6,rWORD2,r11
- cmplw cr6,rWORD5,rWORD6
- blt cr7,L(dP2x)
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD2, rWORD6
+ cmplw cr6, rWORD5, rWORD6
+ blt cr7, L(dP2x)
/* Do something useful in this cycle since we have to branch anyway. */
- lwz rWORD7,4(rSTR1)
- lwz rWORD8,4(rSTR2)
- cmplw cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD7, 4(rSTR1)
+ lwz rWORD8, 4(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
b L(dP2e)
/* Remainder is 12 */
.align 4
L(dPs3):
- slw rWORD3,rWORD1,r11
- slw rWORD4,rWORD2,r11
- cmplw cr1,rWORD3,rWORD4
+ slw rWORD3, rWORD1, rWORD6
+ slw rWORD4, rWORD2, rWORD6
+ cmplw cr1, rWORD3, rWORD4
b L(dP3e)
/* Count is a multiple of 16, remainder is 0 */
.align 4
L(dPs4):
- mtctr rTMP
- slw rWORD1,rWORD1,r11
- slw rWORD2,rWORD2,r11
- cmplw cr0,rWORD1,rWORD2
+ mtctr r0
+ slw rWORD1, rWORD1, rWORD6
+ slw rWORD2, rWORD2, rWORD6
+ cmplw cr7, rWORD1, rWORD2
b L(dP4e)
/* At this point we know both strings are word aligned and the
compare length is at least 8 bytes. */
.align 4
L(Waligned):
- andi. rBITDIF,rN,12 /* Get the word remainder */
- srwi rTMP,rN,4 /* Divide by 16 */
- cmplwi cr1,rBITDIF,8
- cmplwi cr7,rN,16
- clrlwi rN,rN,30
+ andi. r12, rN, 12 /* Get the word remainder */
+ srwi r0, rN, 4 /* Divide by 16 */
+ cmplwi cr1, r12, 8
+ cmplwi cr7, rN, 16
+ clrlwi rN, rN, 30
beq L(dP4)
- bgt cr1,L(dP3)
- beq cr1,L(dP2)
+ bgt cr1, L(dP3)
+ beq cr1, L(dP2)
/* Remainder is 4 */
.align 4
L(dP1):
- mtctr rTMP
+ mtctr r0
/* Normally we'd use rWORD7/rWORD8 here, but since we might exit early
(8-15 byte compare), we want to use only volatile registers. This
means we can avoid restoring non-volatile registers since we did not
change any on the early exit path. The key here is the non-early
exit path only cares about the condition code (cr5), not about which
register pair was used. */
- lwz rWORD5,0(rSTR1)
- lwz rWORD6,0(rSTR2)
- cmplw cr5,rWORD5,rWORD6
- blt cr7,L(dP1x)
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- cmplw cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 0(rSTR1)
+ lwz rWORD6, 0(rSTR2)
+#endif
+ cmplw cr5, rWORD5, rWORD6
+ blt cr7, L(dP1x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
L(dP1e):
- lwz rWORD3,8(rSTR1)
- lwz rWORD4,8(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- lwz rWORD5,12(rSTR1)
- lwz rWORD6,12(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
- bne cr0,L(dLcr0)
-
- lwzu rWORD7,16(rSTR1)
- lwzu rWORD8,16(rSTR2)
- bne cr1,L(dLcr1)
- cmplw cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 8(rSTR1)
+ lwz rWORD4, 8(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 12(rSTR1)
+ lwz rWORD6, 12(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5x)
+ bne cr7, L(dLcr7x)
+
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwzu rWORD7, 16(rSTR1)
+ lwzu rWORD8, 16(rSTR2)
+#endif
+ bne cr1, L(dLcr1)
+ cmplw cr5, rWORD7, rWORD8
bdnz L(dLoop)
- bne cr6,L(dLcr6)
- lwz r30,44(1)
- lwz r31,48(1)
+ bne cr6, L(dLcr6)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
.align 3
L(dP1x):
- slwi. r12,rN,3
- bne cr5,L(dLcr5)
- subfic rN,r12,32 /* Shift count is 32 - (rN * 8). */
- lwz 1,0(1)
+ slwi. r12, rN, 3
+ bne cr5, L(dLcr5x)
+ subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Remainder is 8 */
.align 4
+ cfi_adjust_cfa_offset(64)
L(dP2):
- mtctr rTMP
- lwz rWORD5,0(rSTR1)
- lwz rWORD6,0(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- blt cr7,L(dP2x)
- lwz rWORD7,4(rSTR1)
- lwz rWORD8,4(rSTR2)
- cmplw cr5,rWORD7,rWORD8
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 0(rSTR1)
+ lwz rWORD6, 0(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ blt cr7, L(dP2x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD7, 4(rSTR1)
+ lwz rWORD8, 4(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
L(dP2e):
- lwz rWORD1,8(rSTR1)
- lwz rWORD2,8(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- lwz rWORD3,12(rSTR1)
- lwz rWORD4,12(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- addi rSTR1,rSTR1,4
- addi rSTR2,rSTR2,4
- bne cr6,L(dLcr6)
- bne cr5,L(dLcr5)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 8(rSTR1)
+ lwz rWORD2, 8(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 12(rSTR1)
+ lwz rWORD4, 12(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#endif
+ bne cr6, L(dLcr6)
+ bne cr5, L(dLcr5)
b L(dLoop2)
/* Again we are on a early exit path (16-23 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
.align 4
L(dP2x):
- lwz rWORD3,4(rSTR1)
- lwz rWORD4,4(rSTR2)
- cmplw cr5,rWORD3,rWORD4
- slwi. r12,rN,3
- bne cr6,L(dLcr6)
- addi rSTR1,rSTR1,4
- addi rSTR2,rSTR2,4
- bne cr5,L(dLcr5)
- subfic rN,r12,32 /* Shift count is 32 - (rN * 8). */
- lwz 1,0(1)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 4(rSTR1)
+ lwz rWORD4, 4(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ slwi. r12, rN, 3
+ bne cr6, L(dLcr6x)
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#endif
+ bne cr1, L(dLcr1x)
+ subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Remainder is 12 */
.align 4
+ cfi_adjust_cfa_offset(64)
L(dP3):
- mtctr rTMP
- lwz rWORD3,0(rSTR1)
- lwz rWORD4,0(rSTR2)
- cmplw cr1,rWORD3,rWORD4
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 0(rSTR1)
+ lwz rWORD4, 0(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
L(dP3e):
- lwz rWORD5,4(rSTR1)
- lwz rWORD6,4(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- blt cr7,L(dP3x)
- lwz rWORD7,8(rSTR1)
- lwz rWORD8,8(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- lwz rWORD1,12(rSTR1)
- lwz rWORD2,12(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr1,L(dLcr1)
- bne cr6,L(dLcr6)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 4(rSTR1)
+ lwz rWORD6, 4(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ blt cr7, L(dP3x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD7, 8(rSTR1)
+ lwz rWORD8, 8(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 12(rSTR1)
+ lwz rWORD2, 12(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ bne cr1, L(dLcr1)
+ bne cr6, L(dLcr6)
b L(dLoop1)
/* Again we are on a early exit path (24-31 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
.align 4
L(dP3x):
- lwz rWORD1,8(rSTR1)
- lwz rWORD2,8(rSTR2)
- cmplw cr5,rWORD1,rWORD2
- slwi. r12,rN,3
- bne cr1,L(dLcr1)
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr6,L(dLcr6)
- subfic rN,r12,32 /* Shift count is 32 - (rN * 8). */
- bne cr5,L(dLcr5)
- lwz 1,0(1)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 8(rSTR1)
+ lwz rWORD2, 8(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ slwi. r12, rN, 3
+ bne cr1, L(dLcr1x)
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ bne cr6, L(dLcr6x)
+ subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
+ bne cr7, L(dLcr7x)
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Count is a multiple of 16, remainder is 0 */
.align 4
+ cfi_adjust_cfa_offset(64)
L(dP4):
- mtctr rTMP
- lwz rWORD1,0(rSTR1)
- lwz rWORD2,0(rSTR2)
- cmplw cr0,rWORD1,rWORD2
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 0(rSTR1)
+ lwz rWORD2, 0(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
L(dP4e):
- lwz rWORD3,4(rSTR1)
- lwz rWORD4,4(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- lwz rWORD5,8(rSTR1)
- lwz rWORD6,8(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- lwzu rWORD7,12(rSTR1)
- lwzu rWORD8,12(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- bne cr0,L(dLcr0)
- bne cr1,L(dLcr1)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 4(rSTR1)
+ lwz rWORD4, 4(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 8(rSTR1)
+ lwz rWORD6, 8(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwzu rWORD7, 12(rSTR1)
+ lwzu rWORD8, 12(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr7, L(dLcr7)
+ bne cr1, L(dLcr1)
bdz- L(d24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
.align 4
L(dLoop):
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- bne cr6,L(dLcr6)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ bne cr6, L(dLcr6)
L(dLoop1):
- lwz rWORD3,8(rSTR1)
- lwz rWORD4,8(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 8(rSTR1)
+ lwz rWORD4, 8(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5)
L(dLoop2):
- lwz rWORD5,12(rSTR1)
- lwz rWORD6,12(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- bne cr0,L(dLcr0)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 12(rSTR1)
+ lwz rWORD6, 12(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr7, L(dLcr7)
L(dLoop3):
- lwzu rWORD7,16(rSTR1)
- lwzu rWORD8,16(rSTR2)
- bne cr1,L(dLcr1)
- cmplw cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwzu rWORD7, 16(rSTR1)
+ lwzu rWORD8, 16(rSTR2)
+#endif
+ bne cr1, L(dLcr1)
+ cmplw cr7, rWORD1, rWORD2
bdnz L(dLoop)
L(dL4):
- cmplw cr1,rWORD3,rWORD4
- bne cr6,L(dLcr6)
- cmplw cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
- cmplw cr5,rWORD7,rWORD8
+ cmplw cr1, rWORD3, rWORD4
+ bne cr6, L(dLcr6)
+ cmplw cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5)
+ cmplw cr5, rWORD7, rWORD8
L(d44):
- bne cr0,L(dLcr0)
+ bne cr7, L(dLcr7)
L(d34):
- bne cr1,L(dLcr1)
+ bne cr1, L(dLcr1)
L(d24):
- bne cr6,L(dLcr6)
+ bne cr6, L(dLcr6)
L(d14):
- slwi. r12,rN,3
- bne cr5,L(dLcr5)
+ slwi. r12, rN, 3
+ bne cr5, L(dLcr5)
L(d04):
- lwz r30,44(1)
- lwz r31,48(1)
- lwz 1,0(1)
- subfic rN,r12,32 /* Shift count is 32 - (rN * 8). */
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
+ subfic rN, r12, 32 /* Shift count is 32 - (rN * 8). */
beq L(zeroLength)
/* At this point we have a remainder of 1 to 3 bytes to compare. Since
we are aligned it is safe to load the whole word, and use
- shift right to eliminate bits beyond the compare length. */
+ shift right to eliminate bits beyond the compare length. */
L(d00):
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- srw rWORD1,rWORD1,rN
- srw rWORD2,rWORD2,rN
- cmplw rWORD1,rWORD2
- li rRTN,0
- beqlr
- li rRTN,1
- bgtlr
- li rRTN,-1
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ srw rWORD1, rWORD1, rN
+ srw rWORD2, rWORD2, rN
+ sub rRTN, rWORD1, rWORD2
blr
.align 4
-L(dLcr0):
- lwz r30,44(1)
- lwz r31,48(1)
- li rRTN,1
- lwz 1,0(1)
- bgtlr cr0
- li rRTN,-1
+ cfi_adjust_cfa_offset(64)
+L(dLcr7):
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr7x):
+ li rRTN, 1
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
+ bgtlr cr7
+ li rRTN, -1
blr
.align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr1):
- lwz r30,44(1)
- lwz r31,48(1)
- li rRTN,1
- lwz 1,0(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr1x):
+ li rRTN, 1
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr1
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr6):
- lwz r30,44(1)
- lwz r31,48(1)
- li rRTN,1
- lwz 1,0(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
+L(dLcr6x):
+ li rRTN, 1
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr6
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
+ cfi_adjust_cfa_offset(64)
L(dLcr5):
- lwz r30,44(1)
- lwz r31,48(1)
+ lwz rWORD7, 44(r1)
+ lwz rWORD8, 48(r1)
L(dLcr5x):
- li rRTN,1
- lwz 1,0(1)
+ li rRTN, 1
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
bgtlr cr5
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
L(bytealigned):
- cfi_adjust_cfa_offset(-64)
mtctr rN
/* We need to prime this loop. This loop is swing modulo scheduled
@@ -411,38 +616,39 @@ L(bytealigned):
So we must precondition some registers and condition codes so that
we don't exit the loop early on the first iteration. */
- lbz rWORD1,0(rSTR1)
- lbz rWORD2,0(rSTR2)
+
+ lbz rWORD1, 0(rSTR1)
+ lbz rWORD2, 0(rSTR2)
bdz L(b11)
- cmplw cr0,rWORD1,rWORD2
- lbz rWORD3,1(rSTR1)
- lbz rWORD4,1(rSTR2)
+ cmplw cr7, rWORD1, rWORD2
+ lbz rWORD3, 1(rSTR1)
+ lbz rWORD4, 1(rSTR2)
bdz L(b12)
- cmplw cr1,rWORD3,rWORD4
- lbzu rWORD5,2(rSTR1)
- lbzu rWORD6,2(rSTR2)
+ cmplw cr1, rWORD3, rWORD4
+ lbzu rWORD5, 2(rSTR1)
+ lbzu rWORD6, 2(rSTR2)
bdz L(b13)
.align 4
L(bLoop):
- lbzu rWORD1,1(rSTR1)
- lbzu rWORD2,1(rSTR2)
- bne cr0,L(bLcr0)
+ lbzu rWORD1, 1(rSTR1)
+ lbzu rWORD2, 1(rSTR2)
+ bne cr7, L(bLcr7)
- cmplw cr6,rWORD5,rWORD6
+ cmplw cr6, rWORD5, rWORD6
bdz L(b3i)
- lbzu rWORD3,1(rSTR1)
- lbzu rWORD4,1(rSTR2)
- bne cr1,L(bLcr1)
+ lbzu rWORD3, 1(rSTR1)
+ lbzu rWORD4, 1(rSTR2)
+ bne cr1, L(bLcr1)
- cmplw cr0,rWORD1,rWORD2
+ cmplw cr7, rWORD1, rWORD2
bdz L(b2i)
- lbzu rWORD5,1(rSTR1)
- lbzu rWORD6,1(rSTR2)
- bne cr6,L(bLcr6)
+ lbzu rWORD5, 1(rSTR1)
+ lbzu rWORD6, 1(rSTR2)
+ bne cr6, L(bLcr6)
- cmplw cr1,rWORD3,rWORD4
+ cmplw cr1, rWORD3, rWORD4
bdnz L(bLoop)
/* We speculatively loading bytes before we have tested the previous
@@ -452,67 +658,62 @@ L(bLoop):
tested. In this case we must complete the pending operations
before returning. */
L(b1i):
- bne cr0,L(bLcr0)
- bne cr1,L(bLcr1)
+ bne cr7, L(bLcr7)
+ bne cr1, L(bLcr1)
b L(bx56)
.align 4
L(b2i):
- bne cr6,L(bLcr6)
- bne cr0,L(bLcr0)
+ bne cr6, L(bLcr6)
+ bne cr7, L(bLcr7)
b L(bx34)
.align 4
L(b3i):
- bne cr1,L(bLcr1)
- bne cr6,L(bLcr6)
+ bne cr1, L(bLcr1)
+ bne cr6, L(bLcr6)
b L(bx12)
.align 4
-L(bLcr0):
- li rRTN,1
- bgtlr cr0
- li rRTN,-1
+L(bLcr7):
+ li rRTN, 1
+ bgtlr cr7
+ li rRTN, -1
blr
L(bLcr1):
- li rRTN,1
+ li rRTN, 1
bgtlr cr1
- li rRTN,-1
+ li rRTN, -1
blr
L(bLcr6):
- li rRTN,1
+ li rRTN, 1
bgtlr cr6
- li rRTN,-1
+ li rRTN, -1
blr
L(b13):
- bne cr0,L(bx12)
- bne cr1,L(bx34)
+ bne cr7, L(bx12)
+ bne cr1, L(bx34)
L(bx56):
- sub rRTN,rWORD5,rWORD6
+ sub rRTN, rWORD5, rWORD6
blr
nop
L(b12):
- bne cr0,L(bx12)
+ bne cr7, L(bx12)
L(bx34):
- sub rRTN,rWORD3,rWORD4
+ sub rRTN, rWORD3, rWORD4
blr
-
L(b11):
L(bx12):
- sub rRTN,rWORD1,rWORD2
+ sub rRTN, rWORD1, rWORD2
blr
-
.align 4
-L(zeroLengthReturn):
-
L(zeroLength):
- li rRTN,0
+ li rRTN, 0
blr
- cfi_adjust_cfa_offset(64)
.align 4
/* At this point we know the strings have different alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
2 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then rStr1 is word aligned and can
+ of r12 to 0. If r12 == 0 then rStr1 is word aligned and can
perform the Wunaligned loop.
Otherwise we know that rSTR1 is not already word aligned yet.
@@ -521,465 +722,654 @@ L(zeroLength):
eliminate bits preceding the first byte. Since we want to join the
normal (Wualigned) compare loop, starting at the second word,
we need to adjust the length (rN) and special case the loop
- versioning for the first W. This insures that the loop count is
+ versioning for the first W. This ensures that the loop count is
correct and the first W (shifted) is in the expected resister pair. */
#define rSHL r29 /* Unaligned shift left count. */
#define rSHR r28 /* Unaligned shift right count. */
-#define rB r27 /* Left rotation temp for rWORD2. */
-#define rD r26 /* Left rotation temp for rWORD4. */
-#define rF r25 /* Left rotation temp for rWORD6. */
-#define rH r24 /* Left rotation temp for rWORD8. */
-#define rA r0 /* Right rotation temp for rWORD2. */
-#define rC r12 /* Right rotation temp for rWORD4. */
-#define rE r0 /* Right rotation temp for rWORD6. */
-#define rG r12 /* Right rotation temp for rWORD8. */
+#define rWORD8_SHIFT r27 /* Left rotation temp for rWORD2. */
+#define rWORD2_SHIFT r26 /* Left rotation temp for rWORD4. */
+#define rWORD4_SHIFT r25 /* Left rotation temp for rWORD6. */
+#define rWORD6_SHIFT r24 /* Left rotation temp for rWORD8. */
+ cfi_adjust_cfa_offset(64)
L(unaligned):
- stw r29,40(r1)
- cfi_offset(r29,(40-64))
- clrlwi rSHL,rSTR2,30
- stw r28,36(r1)
- cfi_offset(r28,(36-64))
- beq cr5,L(Wunaligned)
- stw r27,32(r1)
- cfi_offset(r27,(32-64))
+ stw rSHL, 40(r1)
+ cfi_offset(rSHL, (40-64))
+ clrlwi rSHL, rSTR2, 30
+ stw rSHR, 36(r1)
+ cfi_offset(rSHR, (36-64))
+ beq cr5, L(Wunaligned)
+ stw rWORD8_SHIFT, 32(r1)
+ cfi_offset(rWORD8_SHIFT, (32-64))
/* Adjust the logical start of rSTR2 to compensate for the extra bits
in the 1st rSTR1 W. */
- sub r27,rSTR2,rBITDIF
+ sub rWORD8_SHIFT, rSTR2, r12
/* But do not attempt to address the W before that W that contains
the actual start of rSTR2. */
- clrrwi rSTR2,rSTR2,2
- stw r26,28(r1)
- cfi_offset(r26,(28-64))
-/* Compute the left/right shift counts for the unalign rSTR2,
+ clrrwi rSTR2, rSTR2, 2
+ stw rWORD2_SHIFT, 28(r1)
+ cfi_offset(rWORD2_SHIFT, (28-64))
+/* Compute the left/right shift counts for the unaligned rSTR2,
compensating for the logical (W aligned) start of rSTR1. */
- clrlwi rSHL,r27,30
- clrrwi rSTR1,rSTR1,2
- stw r25,24(r1)
- cfi_offset(r25,(24-64))
- slwi rSHL,rSHL,3
- cmplw cr5,r27,rSTR2
- add rN,rN,rBITDIF
- slwi r11,rBITDIF,3
- stw r24,20(r1)
- cfi_offset(r24,(20-64))
- subfic rSHR,rSHL,32
- srwi rTMP,rN,4 /* Divide by 16 */
- andi. rBITDIF,rN,12 /* Get the W remainder */
+ clrlwi rSHL, rWORD8_SHIFT, 30
+ clrrwi rSTR1, rSTR1, 2
+ stw rWORD4_SHIFT, 24(r1)
+ cfi_offset(rWORD4_SHIFT, (24-64))
+ slwi rSHL, rSHL, 3
+ cmplw cr5, rWORD8_SHIFT, rSTR2
+ add rN, rN, r12
+ slwi rWORD6, r12, 3
+ stw rWORD6_SHIFT, 20(r1)
+ cfi_offset(rWORD6_SHIFT, (20-64))
+ subfic rSHR, rSHL, 32
+ srwi r0, rN, 4 /* Divide by 16 */
+ andi. r12, rN, 12 /* Get the W remainder */
/* We normally need to load 2 Ws to start the unaligned rSTR2, but in
this special case those bits may be discarded anyway. Also we
must avoid loading a W where none of the bits are part of rSTR2 as
this may cross a page boundary and cause a page fault. */
- li rWORD8,0
- blt cr5,L(dus0)
- lwz rWORD8,0(rSTR2)
- la rSTR2,4(rSTR2)
- slw rWORD8,rWORD8,rSHL
+ li rWORD8, 0
+ blt cr5, L(dus0)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD8, 0(rSTR2)
+ addi rSTR2, rSTR2, 4
+#endif
+ slw rWORD8, rWORD8, rSHL
L(dus0):
- lwz rWORD1,0(rSTR1)
- lwz rWORD2,0(rSTR2)
- cmplwi cr1,rBITDIF,8
- cmplwi cr7,rN,16
- srw rG,rWORD2,rSHR
- clrlwi rN,rN,30
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 0(rSTR1)
+ lwz rWORD2, 0(rSTR2)
+#endif
+ cmplwi cr1, r12, 8
+ cmplwi cr7, rN, 16
+ srw r12, rWORD2, rSHR
+ clrlwi rN, rN, 30
beq L(duPs4)
- mtctr rTMP
- or rWORD8,rG,rWORD8
- bgt cr1,L(duPs3)
- beq cr1,L(duPs2)
+ mtctr r0
+ or rWORD8, r12, rWORD8
+ bgt cr1, L(duPs3)
+ beq cr1, L(duPs2)
/* Remainder is 4 */
.align 4
L(dusP1):
- slw rB,rWORD2,rSHL
- slw rWORD7,rWORD1,r11
- slw rWORD8,rWORD8,r11
- bge cr7,L(duP1e)
+ slw rWORD8_SHIFT, rWORD2, rSHL
+ slw rWORD7, rWORD1, rWORD6
+ slw rWORD8, rWORD8, rWORD6
+ bge cr7, L(duP1e)
/* At this point we exit early with the first word compare
complete and remainder of 0 to 3 bytes. See L(du14) for details on
how we handle the remaining bytes. */
- cmplw cr5,rWORD7,rWORD8
- slwi. rN,rN,3
- bne cr5,L(duLcr5)
- cmplw cr7,rN,rSHR
+ cmplw cr5, rWORD7, rWORD8
+ slwi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- lwz rWORD2,4(rSTR2)
- srw rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 4(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 8 */
.align 4
L(duPs2):
- slw rH,rWORD2,rSHL
- slw rWORD5,rWORD1,r11
- slw rWORD6,rWORD8,r11
+ slw rWORD6_SHIFT, rWORD2, rSHL
+ slw rWORD5, rWORD1, rWORD6
+ slw rWORD6, rWORD8, rWORD6
b L(duP2e)
/* Remainder is 12 */
.align 4
L(duPs3):
- slw rF,rWORD2,rSHL
- slw rWORD3,rWORD1,r11
- slw rWORD4,rWORD8,r11
+ slw rWORD4_SHIFT, rWORD2, rSHL
+ slw rWORD3, rWORD1, rWORD6
+ slw rWORD4, rWORD8, rWORD6
b L(duP3e)
/* Count is a multiple of 16, remainder is 0 */
.align 4
L(duPs4):
- mtctr rTMP
- or rWORD8,rG,rWORD8
- slw rD,rWORD2,rSHL
- slw rWORD1,rWORD1,r11
- slw rWORD2,rWORD8,r11
+ mtctr r0
+ or rWORD8, r12, rWORD8
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ slw rWORD1, rWORD1, rWORD6
+ slw rWORD2, rWORD8, rWORD6
b L(duP4e)
/* At this point we know rSTR1 is word aligned and the
compare length is at least 8 bytes. */
.align 4
L(Wunaligned):
- stw r27,32(r1)
- cfi_offset(r27,(32-64))
- clrrwi rSTR2,rSTR2,2
- stw r26,28(r1)
- cfi_offset(r26,(28-64))
- srwi rTMP,rN,4 /* Divide by 16 */
- stw r25,24(r1)
- cfi_offset(r25,(24-64))
- andi. rBITDIF,rN,12 /* Get the W remainder */
- stw r24,20(r1)
- cfi_offset(r24,(24-64))
- slwi rSHL,rSHL,3
- lwz rWORD6,0(rSTR2)
- lwzu rWORD8,4(rSTR2)
- cmplwi cr1,rBITDIF,8
- cmplwi cr7,rN,16
- clrlwi rN,rN,30
- subfic rSHR,rSHL,32
- slw rH,rWORD6,rSHL
+ stw rWORD8_SHIFT, 32(r1)
+ cfi_offset(rWORD8_SHIFT, (32-64))
+ clrrwi rSTR2, rSTR2, 2
+ stw rWORD2_SHIFT, 28(r1)
+ cfi_offset(rWORD2_SHIFT, (28-64))
+ srwi r0, rN, 4 /* Divide by 16 */
+ stw rWORD4_SHIFT, 24(r1)
+ cfi_offset(rWORD4_SHIFT, (24-64))
+ andi. r12, rN, 12 /* Get the W remainder */
+ stw rWORD6_SHIFT, 20(r1)
+ cfi_offset(rWORD6_SHIFT, (20-64))
+ slwi rSHL, rSHL, 3
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD6, 0(rSTR2)
+ lwzu rWORD8, 4(rSTR2)
+#endif
+ cmplwi cr1, r12, 8
+ cmplwi cr7, rN, 16
+ clrlwi rN, rN, 30
+ subfic rSHR, rSHL, 32
+ slw rWORD6_SHIFT, rWORD6, rSHL
beq L(duP4)
- mtctr rTMP
- bgt cr1,L(duP3)
- beq cr1,L(duP2)
+ mtctr r0
+ bgt cr1, L(duP3)
+ beq cr1, L(duP2)
/* Remainder is 4 */
.align 4
L(duP1):
- srw rG,rWORD8,rSHR
- lwz rWORD7,0(rSTR1)
- slw rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP1x)
+ srw r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
+ lwz rWORD7, 0(rSTR1)
+#endif
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP1x)
L(duP1e):
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- srw rA,rWORD2,rSHR
- slw rD,rWORD2,rSHL
- or rWORD2,rA,rB
- lwz rWORD3,8(rSTR1)
- lwz rWORD4,8(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- srw rC,rWORD4,rSHR
- slw rF,rWORD4,rSHL
- bne cr5,L(duLcr5)
- or rWORD4,rC,rD
- lwz rWORD5,12(rSTR1)
- lwz rWORD6,12(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- srw rE,rWORD6,rSHR
- slw rH,rWORD6,rSHL
- bne cr0,L(duLcr0)
- or rWORD6,rE,rF
- cmplw cr6,rWORD5,rWORD6
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 8(rSTR1)
+ lwz rWORD4, 8(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ bne cr5, L(duLcr5)
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 12(rSTR1)
+ lwz rWORD6, 12(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ bne cr7, L(duLcr7)
+ or rWORD6, r0, rWORD4_SHIFT
+ cmplw cr6, rWORD5, rWORD6
b L(duLoop3)
.align 4
/* At this point we exit early with the first word compare
complete and remainder of 0 to 3 bytes. See L(du14) for details on
how we handle the remaining bytes. */
L(duP1x):
- cmplw cr5,rWORD7,rWORD8
- slwi. rN,rN,3
- bne cr5,L(duLcr5)
- cmplw cr7,rN,rSHR
+ cmplw cr5, rWORD7, rWORD8
+ slwi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srw rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 8(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 8 */
.align 4
L(duP2):
- srw rE,rWORD8,rSHR
- lwz rWORD5,0(rSTR1)
- or rWORD6,rE,rH
- slw rH,rWORD8,rSHL
+ srw r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
+ lwz rWORD5, 0(rSTR1)
+#endif
+ or rWORD6, r0, rWORD6_SHIFT
+ slw rWORD6_SHIFT, rWORD8, rSHL
L(duP2e):
- lwz rWORD7,4(rSTR1)
- lwz rWORD8,4(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- srw rG,rWORD8,rSHR
- slw rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP2x)
- lwz rWORD1,8(rSTR1)
- lwz rWORD2,8(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- srw rA,rWORD2,rSHR
- slw rD,rWORD2,rSHL
- or rWORD2,rA,rB
- lwz rWORD3,12(rSTR1)
- lwz rWORD4,12(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- bne cr5,L(duLcr5)
- srw rC,rWORD4,rSHR
- slw rF,rWORD4,rSHL
- or rWORD4,rC,rD
- addi rSTR1,rSTR1,4
- addi rSTR2,rSTR2,4
- cmplw cr1,rWORD3,rWORD4
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD7, 4(rSTR1)
+ lwz rWORD8, 4(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP2x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 8(rSTR1)
+ lwz rWORD2, 8(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 12(rSTR1)
+ lwz rWORD4, 12(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ bne cr5, L(duLcr5)
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#endif
+ cmplw cr1, rWORD3, rWORD4
b L(duLoop2)
.align 4
L(duP2x):
- cmplw cr5,rWORD7,rWORD8
- addi rSTR1,rSTR1,4
- addi rSTR2,rSTR2,4
- bne cr6,L(duLcr6)
- slwi. rN,rN,3
- bne cr5,L(duLcr5)
- cmplw cr7,rN,rSHR
+ cmplw cr5, rWORD7, rWORD8
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#endif
+ bne cr6, L(duLcr6)
+ slwi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- lwz rWORD2,4(rSTR2)
- srw rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 4(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 12 */
.align 4
L(duP3):
- srw rC,rWORD8,rSHR
- lwz rWORD3,0(rSTR1)
- slw rF,rWORD8,rSHL
- or rWORD4,rC,rH
+ srw r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
+ lwz rWORD3, 0(rSTR1)
+#endif
+ slw rWORD4_SHIFT, rWORD8, rSHL
+ or rWORD4, r12, rWORD6_SHIFT
L(duP3e):
- lwz rWORD5,4(rSTR1)
- lwz rWORD6,4(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- srw rE,rWORD6,rSHR
- slw rH,rWORD6,rSHL
- or rWORD6,rE,rF
- lwz rWORD7,8(rSTR1)
- lwz rWORD8,8(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- bne cr1,L(duLcr1)
- srw rG,rWORD8,rSHR
- slw rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP3x)
- lwz rWORD1,12(rSTR1)
- lwz rWORD2,12(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- srw rA,rWORD2,rSHR
- slw rD,rWORD2,rSHL
- or rWORD2,rA,rB
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- cmplw cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 4(rSTR1)
+ lwz rWORD6, 4(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD7, 8(rSTR1)
+ lwz rWORD8, 8(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ bne cr1, L(duLcr1)
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP3x)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 12(rSTR1)
+ lwz rWORD2, 12(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ cmplw cr7, rWORD1, rWORD2
b L(duLoop1)
.align 4
L(duP3x):
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr1,L(duLcr1)
- cmplw cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- slwi. rN,rN,3
- bne cr5,L(duLcr5)
- cmplw cr7,rN,rSHR
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+#if 0
+/* Huh? We've already branched on cr1! */
+ bne cr1, L(duLcr1)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ slwi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- lwz rWORD2,4(rSTR2)
- srw rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 4(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
b L(dutrim)
/* Count is a multiple of 16, remainder is 0 */
.align 4
L(duP4):
- mtctr rTMP
- srw rA,rWORD8,rSHR
- lwz rWORD1,0(rSTR1)
- slw rD,rWORD8,rSHL
- or rWORD2,rA,rH
+ mtctr r0
+ srw r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ addi rSTR1, rSTR1, 4
+#else
+ lwz rWORD1, 0(rSTR1)
+#endif
+ slw rWORD2_SHIFT, rWORD8, rSHL
+ or rWORD2, r0, rWORD6_SHIFT
L(duP4e):
- lwz rWORD3,4(rSTR1)
- lwz rWORD4,4(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- srw rC,rWORD4,rSHR
- slw rF,rWORD4,rSHL
- or rWORD4,rC,rD
- lwz rWORD5,8(rSTR1)
- lwz rWORD6,8(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- bne cr0,L(duLcr0)
- srw rE,rWORD6,rSHR
- slw rH,rWORD6,rSHL
- or rWORD6,rE,rF
- lwzu rWORD7,12(rSTR1)
- lwzu rWORD8,12(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- bne cr1,L(duLcr1)
- srw rG,rWORD8,rSHR
- slw rB,rWORD8,rSHL
- or rWORD8,rG,rH
- cmplw cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 4(rSTR1)
+ lwz rWORD4, 4(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 8(rSTR1)
+ lwz rWORD6, 8(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ bne cr7, L(duLcr7)
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwzu rWORD7, 12(rSTR1)
+ lwzu rWORD8, 12(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ bne cr1, L(duLcr1)
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ cmplw cr5, rWORD7, rWORD8
bdz L(du24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
.align 4
L(duLoop):
- lwz rWORD1,4(rSTR1)
- lwz rWORD2,4(rSTR2)
- cmplw cr1,rWORD3,rWORD4
- bne cr6,L(duLcr6)
- srw rA,rWORD2,rSHR
- slw rD,rWORD2,rSHL
- or rWORD2,rA,rB
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD1, 4(rSTR1)
+ lwz rWORD2, 4(rSTR2)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ bne cr6, L(duLcr6)
+ srw r0, rWORD2, rSHR
+ slw rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
L(duLoop1):
- lwz rWORD3,8(rSTR1)
- lwz rWORD4,8(rSTR2)
- cmplw cr6,rWORD5,rWORD6
- bne cr5,L(duLcr5)
- srw rC,rWORD4,rSHR
- slw rF,rWORD4,rSHL
- or rWORD4,rC,rD
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD3, 0, rSTR1
+ lwbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD3, 8(rSTR1)
+ lwz rWORD4, 8(rSTR2)
+#endif
+ cmplw cr6, rWORD5, rWORD6
+ bne cr5, L(duLcr5)
+ srw r12, rWORD4, rSHR
+ slw rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
L(duLoop2):
- lwz rWORD5,12(rSTR1)
- lwz rWORD6,12(rSTR2)
- cmplw cr5,rWORD7,rWORD8
- bne cr0,L(duLcr0)
- srw rE,rWORD6,rSHR
- slw rH,rWORD6,rSHL
- or rWORD6,rE,rF
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD5, 0, rSTR1
+ lwbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD5, 12(rSTR1)
+ lwz rWORD6, 12(rSTR2)
+#endif
+ cmplw cr5, rWORD7, rWORD8
+ bne cr7, L(duLcr7)
+ srw r0, rWORD6, rSHR
+ slw rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
L(duLoop3):
- lwzu rWORD7,16(rSTR1)
- lwzu rWORD8,16(rSTR2)
- cmplw cr0,rWORD1,rWORD2
- bne cr1,L(duLcr1)
- srw rG,rWORD8,rSHR
- slw rB,rWORD8,rSHL
- or rWORD8,rG,rH
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD7, 0, rSTR1
+ lwbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 4
+ addi rSTR2, rSTR2, 4
+#else
+ lwzu rWORD7, 16(rSTR1)
+ lwzu rWORD8, 16(rSTR2)
+#endif
+ cmplw cr7, rWORD1, rWORD2
+ bne cr1, L(duLcr1)
+ srw r12, rWORD8, rSHR
+ slw rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
bdnz L(duLoop)
L(duL4):
- bne cr1,L(duLcr1)
- cmplw cr1,rWORD3,rWORD4
- bne cr6,L(duLcr6)
- cmplw cr6,rWORD5,rWORD6
- bne cr5,L(duLcr5)
- cmplw cr5,rWORD7,rWORD8
+#if 0
+/* Huh? We've already branched on cr1! */
+ bne cr1, L(duLcr1)
+#endif
+ cmplw cr1, rWORD3, rWORD4
+ bne cr6, L(duLcr6)
+ cmplw cr6, rWORD5, rWORD6
+ bne cr5, L(duLcr5)
+ cmplw cr5, rWORD7, rWORD8
L(du44):
- bne cr0,L(duLcr0)
+ bne cr7, L(duLcr7)
L(du34):
- bne cr1,L(duLcr1)
+ bne cr1, L(duLcr1)
L(du24):
- bne cr6,L(duLcr6)
+ bne cr6, L(duLcr6)
L(du14):
- slwi. rN,rN,3
- bne cr5,L(duLcr5)
+ slwi. rN, rN, 3
+ bne cr5, L(duLcr5)
/* At this point we have a remainder of 1 to 3 bytes to compare. We use
shift right to eliminate bits beyond the compare length.
+ This allows the use of word subtract to compute the final result.
However it may not be safe to load rWORD2 which may be beyond the
string length. So we compare the bit length of the remainder to
the right shift count (rSHR). If the bit count is less than or equal
we do not need to load rWORD2 (all significant bits are already in
- rB). */
- cmplw cr7,rN,rSHR
+ rWORD8_SHIFT). */
+ cmplw cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- lwz rWORD2,4(rSTR2)
- srw rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 4
+#else
+ lwz rWORD2, 4(rSTR2)
+#endif
+ srw r0, rWORD2, rSHR
.align 4
L(dutrim):
- lwz rWORD1,4(rSTR1)
- lwz r31,48(1)
- subfic rN,rN,32 /* Shift count is 32 - (rN * 8). */
- or rWORD2,rA,rB
- lwz r30,44(1)
- lwz r29,40(r1)
- srw rWORD1,rWORD1,rN
- srw rWORD2,rWORD2,rN
- lwz r28,36(r1)
- lwz r27,32(r1)
- cmplw rWORD1,rWORD2
- li rRTN,0
- beq L(dureturn26)
- li rRTN,1
- bgt L(dureturn26)
- li rRTN,-1
+#ifdef __LITTLE_ENDIAN__
+ lwbrx rWORD1, 0, rSTR1
+#else
+ lwz rWORD1, 4(rSTR1)
+#endif
+ lwz rWORD8, 48(r1)
+ subfic rN, rN, 32 /* Shift count is 32 - (rN * 8). */
+ or rWORD2, r0, rWORD8_SHIFT
+ lwz rWORD7, 44(r1)
+ lwz rSHL, 40(r1)
+ srw rWORD1, rWORD1, rN
+ srw rWORD2, rWORD2, rN
+ lwz rSHR, 36(r1)
+ lwz rWORD8_SHIFT, 32(r1)
+ sub rRTN, rWORD1, rWORD2
b L(dureturn26)
.align 4
-L(duLcr0):
- lwz r31,48(1)
- lwz r30,44(1)
- li rRTN,1
- bgt cr0,L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
- li rRTN,-1
+L(duLcr7):
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
+ li rRTN, 1
+ bgt cr7, L(dureturn29)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr1):
- lwz r31,48(1)
- lwz r30,44(1)
- li rRTN,1
- bgt cr1,L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
- li rRTN,-1
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
+ li rRTN, 1
+ bgt cr1, L(dureturn29)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr6):
- lwz r31,48(1)
- lwz r30,44(1)
- li rRTN,1
- bgt cr6,L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
- li rRTN,-1
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
+ li rRTN, 1
+ bgt cr6, L(dureturn29)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr5):
- lwz r31,48(1)
- lwz r30,44(1)
- li rRTN,1
- bgt cr5,L(dureturn29)
- lwz r29,40(r1)
- lwz r28,36(r1)
- li rRTN,-1
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
+ li rRTN, 1
+ bgt cr5, L(dureturn29)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
+ li rRTN, -1
b L(dureturn27)
.align 3
L(duZeroReturn):
- li rRTN,0
+ li rRTN, 0
.align 4
L(dureturn):
- lwz r31,48(1)
- lwz r30,44(1)
+ lwz rWORD8, 48(r1)
+ lwz rWORD7, 44(r1)
L(dureturn29):
- lwz r29,40(r1)
- lwz r28,36(r1)
+ lwz rSHL, 40(r1)
+ lwz rSHR, 36(r1)
L(dureturn27):
- lwz r27,32(r1)
+ lwz rWORD8_SHIFT, 32(r1)
L(dureturn26):
- lwz r26,28(r1)
+ lwz rWORD2_SHIFT, 28(r1)
L(dureturn25):
- lwz r25,24(r1)
- lwz r24,20(r1)
- lwz 1,0(1)
+ lwz rWORD4_SHIFT, 24(r1)
+ lwz rWORD6_SHIFT, 20(r1)
+ addi r1, r1, 64
+ cfi_adjust_cfa_offset(-64)
blr
END (memcmp)
+
libc_hidden_builtin_def (memcmp)
-weak_alias (memcmp,bcmp)
+weak_alias (memcmp, bcmp)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memcpy.S b/libc/sysdeps/powerpc/powerpc32/power7/memcpy.S
index 7f0077823..acf3c1019 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memcpy.S
@@ -383,7 +383,7 @@ L(copy_GE_32_unaligned):
beq L(copy_GE_32_unaligned_cont)
- /* SRC is not quadword aligned, get it aligned. */
+ /* DST is not quadword aligned, get it aligned. */
mtcrf 0x01,0
subf 31,0,5
@@ -435,13 +435,21 @@ L(copy_GE_32_unaligned_cont):
mr 11,12
mtcrf 0x01,9
cmplwi cr6,9,1
+#ifdef __LITTLE_ENDIAN__
+ lvsr 5,0,12
+#else
lvsl 5,0,12
+#endif
lvx 3,0,12
bf 31,L(setup_unaligned_loop)
/* Copy another 16 bytes to align to 32-bytes due to the loop . */
lvx 4,12,6
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
vperm 6,3,4,5
+#endif
addi 11,12,16
addi 10,3,16
stvx 6,0,3
@@ -461,11 +469,17 @@ L(unaligned_loop):
vector instructions though. */
lvx 4,11,6 /* vr4 = r11+16. */
- vperm 6,3,4,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr6. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
lvx 3,11,7 /* vr3 = r11+32. */
- vperm 10,4,3,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr10. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 10,3,4,5
+#else
+ vperm 10,4,3,5
+#endif
addi 11,11,32
stvx 6,0,10
stvx 10,10,6
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S b/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S
index 5ad4edb58..4610ec5b5 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S
@@ -325,7 +325,7 @@ L(copy_GE_32_unaligned):
beq L(copy_GE_32_unaligned_cont)
- /* SRC is not quadword aligned, get it aligned. */
+ /* DST is not quadword aligned, get it aligned. */
mtcrf 0x01,0
subf 31,0,5
@@ -377,13 +377,21 @@ L(copy_GE_32_unaligned_cont):
mr 11,12
mtcrf 0x01,9
cmplwi cr6,9,1
- lvsl 5,0,12
+#ifdef __LITTLE_ENDIAN__
+ lvsr 5,0,12
+#else
+ lvsl 5,0,12
+#endif
lvx 3,0,12
bf 31,L(setup_unaligned_loop)
/* Copy another 16 bytes to align to 32-bytes due to the loop . */
lvx 4,12,6
- vperm 6,3,4,5
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
addi 11,12,16
addi 10,3,16
stvx 6,0,3
@@ -403,11 +411,17 @@ L(unaligned_loop):
vector instructions though. */
lvx 4,11,6 /* vr4 = r11+16. */
- vperm 6,3,4,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr6. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
lvx 3,11,7 /* vr3 = r11+32. */
- vperm 10,4,3,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr10. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 10,3,4,5
+#else
+ vperm 10,4,3,5
+#endif
addi 11,11,32
stvx 6,0,10
stvx 10,10,6
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S b/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
index defd832b0..9601aa799 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memrchr.S
@@ -23,117 +23,131 @@
.machine power7
ENTRY (__memrchr)
CALL_MCOUNT
- dcbt 0,r3
- mr r7,r3
- add r3,r7,r5 /* Calculate the last acceptable address. */
- cmplw cr7,r3,r7 /* Is the address equal or less than r3? */
+ add r7,r3,r5 /* Calculate the last acceptable address. */
+ neg r0,r7
+ addi r7,r7,-1
+ mr r10,r3
+ clrrwi r6,r7,7
+ li r9,3<<5
+ dcbt r9,r6,16 /* Stream hint, decreasing addresses. */
/* Replicate BYTE to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
- bge cr7,L(proceed)
-
- li r3,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
+ rldimi r4,r4,8,48
+ rldimi r4,r4,16,32
li r6,-4
- addi r9,r3,-1
- clrrwi r8,r9,2
- addi r8,r8,4
- neg r0,r3
+ li r9,-1
rlwinm r0,r0,3,27,28 /* Calculate padding. */
-
+ clrrwi r8,r7,2
+ srw r9,r9,r0
cmplwi r5,16
+ clrrwi r0,r10,2
ble L(small_range)
- lwbrx r12,r8,r6 /* Load reversed word from memory. */
- cmpb r10,r12,r4 /* Check for BYTE in WORD1. */
- slw r10,r10,r0
- srw r10,r10,r0
- cmplwi cr7,r10,0 /* If r10 == 0, no BYTEs have been found. */
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,0,r8
+#else
+ lwbrx r12,0,r8 /* Load reversed word from memory. */
+#endif
+ cmpb r3,r12,r4 /* Check for BYTE in WORD1. */
+ and r3,r3,r9
+ cmplwi cr7,r3,0 /* If r3 == 0, no BYTEs have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,-4
- cmplw cr6,r9,r7
- ble cr6,L(null)
-
mtcrf 0x01,r8
/* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
- mr r8,r9
- bt 29,L(loop_setup)
+ bf 29,L(loop_setup)
/* Handle WORD2 of pair. */
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,r8,r6
+#else
lwbrx r12,r8,r6
- cmpb r10,r12,r4
- cmplwi cr7,r10,0
- bne cr7,L(done)
-
- /* Are we done already? */
+#endif
addi r8,r8,-4
- cmplw cr6,r8,r7
- ble cr6,L(null)
+ cmpb r3,r12,r4
+ cmplwi cr7,r3,0
+ bne cr7,L(done)
L(loop_setup):
- li r0,-8
- sub r5,r8,r7
- srwi r9,r5,3 /* Number of loop iterations. */
+ /* The last word we want to read in the loop below is the one
+ containing the first byte of the string, ie. the word at
+ s & ~3, or r0. The first word read is at r8 - 4, we
+ read 2 * cnt words, so the last word read will be at
+ r8 - 4 - 8 * cnt + 4. Solving for cnt gives
+ cnt = (r8 - r0) / 8 */
+ sub r5,r8,r0
+ addi r8,r8,-4
+ srwi r9,r5,3 /* Number of loop iterations. */
mtctr r9 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for BYTE backwards in the string. Since it's a
- small loop (< 8 instructions), align it to 32-bytes. */
- .p2align 5
+
+ /* Main loop to look for BYTE backwards in the string.
+ FIXME: Investigate whether 32 byte align helps with this
+ 9 instruction loop. */
+ .align 5
L(loop):
/* Load two words, compare and merge in a
single register for speed. This is an attempt
to speed up the byte-checking process for bigger strings. */
- lwbrx r12,r8,r6
- lwbrx r11,r8,r0
- addi r8,r8,-4
- cmpb r10,r12,r4
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,0,r8
+ lwzx r11,r8,r6
+#else
+ lwbrx r12,0,r8
+ lwbrx r11,r8,r6
+#endif
+ cmpb r3,r12,r4
cmpb r9,r11,r4
- or r5,r9,r10 /* Merge everything in one word. */
+ or r5,r9,r3 /* Merge everything in one word. */
cmplwi cr7,r5,0
bne cr7,L(found)
- addi r8,r8,-4
+ addi r8,r8,-8
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for BYTE in the whole range. Just return
- the original range. */
- addi r8,r8,4
- cmplw cr6,r8,r7
- bgt cr6,L(loop_small)
- b L(null)
- /* OK, one (or both) of the words contains BYTE. Check
- the first word and decrement the address in case the first
- word really contains BYTE. */
+ /* We may have one more word to read. */
+ cmplw r8,r0
+ bnelr
+
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,0,r8
+#else
+ lwbrx r12,0,r8
+#endif
+ cmpb r3,r12,r4
+ cmplwi cr7,r3,0
+ bne cr7,L(done)
+ blr
+
.align 4
L(found):
- cmplwi cr6,r10,0
- addi r8,r8,4
+ /* OK, one (or both) of the words contains BYTE. Check
+ the first word. */
+ cmplwi cr6,r3,0
bne cr6,L(done)
/* BYTE must be in the second word. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
+ again and move the result of cmpb to r3 so we can calculate the
pointer. */
- mr r10,r9
+ mr r3,r9
addi r8,r8,-4
- /* r10 has the output of the cmpb instruction, that is, it contains
+ /* r3 has the output of the cmpb instruction, that is, it contains
0xff in the same position as BYTE in the original
word from the string. Use that to calculate the pointer.
We need to make sure BYTE is *before* the end of the
range. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
- srwi r6,r0,3 /* Convert leading zeroes to bytes. */
- addi r0,r6,1
+ cntlzw r9,r3 /* Count leading zeros before the match. */
+ cmplw r8,r0 /* Are we on the last word? */
+ srwi r6,r9,3 /* Convert leading zeros to bytes. */
+ addi r0,r6,-3
sub r3,r8,r0
- cmplw r3,r7
- blt L(null)
+ cmplw cr7,r3,r10
+ bnelr
+ bgelr cr7
+ li r3,0
blr
.align 4
@@ -147,28 +161,35 @@ L(small_range):
cmplwi r5,0
beq L(null)
- lwbrx r12,r8,r6 /* Load reversed word from memory. */
- cmpb r10,r12,r4 /* Check for null bytes in WORD1. */
- slw r10,r10,r0
- srw r10,r10,r0
- cmplwi cr7,r10,0
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,0,r8
+#else
+ lwbrx r12,0,r8 /* Load reversed word from memory. */
+#endif
+ cmpb r3,r12,r4 /* Check for BYTE in WORD1. */
+ and r3,r3,r9
+ cmplwi cr7,r3,0
bne cr7,L(done)
+ /* Are we done already? */
+ cmplw r8,r0
addi r8,r8,-4
- cmplw r8,r7
- ble L(null)
- b L(loop_small)
+ beqlr
- .p2align 5
+ .align 5
L(loop_small):
- lwbrx r12,r8,r6
- cmpb r10,r12,r4
- cmplwi cr6,r10,0
- bne cr6,L(done)
+#ifdef __LITTLE_ENDIAN__
+ lwzx r12,0,r8
+#else
+ lwbrx r12,0,r8
+#endif
+ cmpb r3,r12,r4
+ cmplw r8,r0
+ cmplwi cr7,r3,0
+ bne cr7,L(done)
addi r8,r8,-4
- cmplw r8,r7
- ble L(null)
- b L(loop_small)
+ bne L(loop_small)
+ blr
END (__memrchr)
weak_alias (__memrchr, memrchr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/memset.S b/libc/sysdeps/powerpc/powerpc32/power7/memset.S
index 360ea717f..aadda2558 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -35,8 +35,8 @@ L(_memset):
cfi_offset(31,-8)
/* Replicate byte to word. */
- rlwimi 4,4,8,16,23
- rlwimi 4,4,16,0,15
+ insrdi 4,4,8,48
+ insrdi 4,4,16,32
ble cr6,L(small) /* If length <= 8, use short copy code. */
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/rawmemchr.S b/libc/sysdeps/powerpc/powerpc32/power7/rawmemchr.S
index a80c74a09..c2d8c4b7b 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/rawmemchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/rawmemchr.S
@@ -27,16 +27,21 @@ ENTRY (__rawmemchr)
clrrwi r8,r3,2 /* Align the address to word boundary. */
/* Replicate byte to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ rldimi r4,r4,8,48
+ rldimi r4,r4,16,32
/* Now r4 has a word of c bytes. */
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r5,r12,r4 /* Compare each byte against c byte. */
+#ifdef __LITTLE_ENDIAN__
+ srw r5,r5,r6
+ slw r5,r5,r6
+#else
slw r5,r5,r6 /* Move left to discard ignored bits. */
srw r5,r5,r6 /* Bring the bits back as zeros. */
+#endif
cmpwi cr7,r5,0 /* If r5 == 0, no c bytes have been found. */
bne cr7,L(done)
@@ -90,8 +95,14 @@ L(loop):
word from the string. Use that fact to find out what is
the position of the byte inside the string. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntw r0,r0
+#else
cntlzw r0,r5 /* Count leading zeros before the match. */
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
+#endif
+ srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching char. */
blr
END (__rawmemchr)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strchr.S b/libc/sysdeps/powerpc/powerpc32/power7/strchr.S
index 0ecadb271..b66265967 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/strchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strchr.S
@@ -35,8 +35,8 @@ ENTRY (strchr)
beq cr7,L(null_match)
/* Replicate byte to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
/* Now r4 has a word of c bytes and r0 has
a word of null bytes. */
@@ -46,11 +46,17 @@ ENTRY (strchr)
/* Move the words left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ srw r11,r11,r6
+ slw r10,r10,r6
+ slw r11,r11,r6
+#else
slw r10,r10,r6
slw r11,r11,r6
srw r10,r10,r6
srw r11,r11,r6
+#endif
or r5,r10,r11 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -65,7 +71,7 @@ ENTRY (strchr)
/* Handle WORD2 of pair. */
lwzu r12,4(r8)
- cmpb r10,r12,r4
+ cmpb r10,r12,r4
cmpb r11,r12,r0
or r5,r10,r11
cmpwi cr7,r5,0
@@ -100,22 +106,31 @@ L(loop):
bne cr6,L(done)
/* The c/null byte must be in the second word. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
- pointer. */
+ again and move the result of cmpb to r10/r11 so we can calculate
+ the pointer. */
mr r10,r6
mr r11,r7
addi r8,r8,4
- /* r5 has the output of the cmpb instruction, that is, it contains
+ /* r10/r11 have the output of the cmpb instructions, that is,
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
L(done):
- cntlzw r4,r10 /* Count leading zeroes before c matches. */
- cntlzw r0,r11 /* Count leading zeroes before null matches. */
- cmplw cr7,r4,r0
+#ifdef __LITTLE_ENDIAN__
+ addi r3,r10,-1
+ andc r3,r3,r10
+ popcntw r0,r3
+ addi r4,r11,-1
+ andc r4,r4,r11
+ cmplw cr7,r3,r4
+ bgt cr7,L(no_match)
+#else
+ cntlzw r0,r10 /* Count leading zeros before c matches. */
+ cmplw cr7,r11,r10
bgt cr7,L(no_match)
- srwi r0,r4,3 /* Convert leading zeroes to bytes. */
+#endif
+ srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
@@ -133,10 +148,14 @@ L(null_match):
cmpb r5,r12,r0 /* Compare each byte against null bytes. */
/* Move the words left and right to discard the bits that are
- not part of the string and to bring them back as zeros. */
-
+ not part of the string and bring them back as zeros. */
+#ifdef __LITTLE_ENDIAN__
+ srw r5,r5,r6
+ slw r5,r5,r6
+#else
slw r5,r5,r6
srw r5,r5,r6
+#endif
cmpwi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
@@ -191,7 +210,13 @@ L(loop_null):
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the pointer. */
L(done_null):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntw r0,r0
+#else
cntlzw r0,r5 /* Count leading zeros before the match. */
+#endif
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strchrnul.S b/libc/sysdeps/powerpc/powerpc32/power7/strchrnul.S
index d4cacab60..f5d24d434 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/strchrnul.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strchrnul.S
@@ -27,8 +27,8 @@ ENTRY (__strchrnul)
clrrwi r8,r3,2 /* Align the address to word boundary. */
/* Replicate byte to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
@@ -43,10 +43,17 @@ ENTRY (__strchrnul)
/* Move the words left and right to discard the bits that are
not part of the string and bring them back as zeros. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ srw r9,r9,r6
+ slw r10,r10,r6
+ slw r9,r9,r6
+#else
slw r10,r10,r6
slw r9,r9,r6
srw r10,r10,r6
srw r9,r9,r6
+#endif
or r5,r9,r10 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -54,7 +61,7 @@ ENTRY (__strchrnul)
mtcrf 0x01,r8
- /* Are we now aligned to a quadword boundary? If so, skip to
+ /* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
bt 29,L(loop)
@@ -76,7 +83,7 @@ L(loop):
single register for speed. This is an attempt
to speed up the null-checking process for bigger strings. */
lwz r12,4(r8)
- lwzu r11,8(r8)
+ lwzu r11,8(r8)
cmpb r10,r12,r0
cmpb r9,r12,r4
cmpb r6,r11,r0
@@ -95,9 +102,9 @@ L(loop):
addi r8,r8,-4
bne cr6,L(done)
- /* The c/null byte must be in the second word. Adjust the
- address again and move the result of cmpb to r10 so we can calculate
- the pointer. */
+ /* The c/null byte must be in the second word. Adjust the address
+ again and move the result of cmpb to r5 so we can calculate the
+ pointer. */
mr r5,r10
addi r8,r8,4
@@ -105,7 +112,13 @@ L(loop):
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntw r0,r0
+#else
cntlzw r0,r5 /* Count leading zeros before the match. */
+#endif
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strlen.S b/libc/sysdeps/powerpc/powerpc32/power7/strlen.S
index b71a10f5c..b08d6c028 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/strlen.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strlen.S
@@ -29,7 +29,11 @@ ENTRY (strlen)
li r0,0 /* Word with null chars to use with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
lwz r12,0(r4) /* Load word from memory. */
+#ifdef __LITTLE_ENDIAN__
+ slw r5,r5,r6
+#else
srw r5,r5,r6 /* MASK = MASK >> padding. */
+#endif
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in WORD1. */
cmpwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
@@ -47,9 +51,6 @@ ENTRY (strlen)
cmpb r10,r12,r0
cmpwi cr7,r10,0
bne cr7,L(done)
- b L(loop) /* We branch here (rather than falling through)
- to skip the nops due to heavy alignment
- of the loop below. */
/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
@@ -86,9 +87,15 @@ L(loop):
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the length. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
+#ifdef __LITTLE_ENDIAN__
+ addi r9, r10, -1 /* Form a mask from trailing zeros. */
+ andc r9, r9, r10
+ popcntw r0, r9 /* Count the bits in the mask. */
+#else
+ cntlzw r0,r10 /* Count leading zeros before the match. */
+#endif
subf r5,r3,r4
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
+ srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r5,r0 /* Compute final length. */
blr
END (strlen)
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strncmp.S b/libc/sysdeps/powerpc/powerpc32/power7/strncmp.S
index fdae44d26..10c9d251b 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strncmp.S
@@ -26,7 +26,7 @@
EALIGN (strncmp,5,0)
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -39,6 +39,7 @@ EALIGN (strncmp,5,0)
#define r7F7F r9 /* constant 0x7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
nop
@@ -78,13 +79,45 @@ L(g1): add rTMP,rFEFE,rWORD1
/* OK. We've hit the end of the string. We need to be careful that
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ slwi rTMP, rTMP, 1
+ addi rTMP2, rTMP, -1
+ andc rTMP2, rTMP2, rTMP
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rldimi rTMP2, rWORD2, 24, 32
+ rldimi rTMP, rWORD1, 24, 32
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr
+ ori rRTN, rTMP2, 1
+ blr
+
+L(different):
+ lwz rWORD1, -4(rSTR1)
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rldimi rTMP2, rWORD2, 24, 32
+ rldimi rTMP, rWORD1, 24, 32
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr
+ ori rRTN, rTMP2, 1
+ blr
+#else
L(endstring):
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
-
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzw rBITDIF,rBITDIF
@@ -92,28 +125,20 @@ L(endstring):
addi rNEG,rNEG,7
cmpw cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
- blt cr1,L(equal)
- srawi rRTN,rRTN,31
- ori rRTN,rRTN,1
- blr
+ bgelr cr1
L(equal):
li rRTN,0
blr
L(different):
- lwzu rWORD1,-4(rSTR1)
+ lwz rWORD1,-4(rSTR1)
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
- blt L(highbit)
- srawi rRTN,rRTN,31
- ori rRTN,rRTN,1
- blr
+ bgelr
L(highbit):
- srwi rWORD2,rWORD2,24
- srwi rWORD1,rWORD1,24
- sub rRTN,rWORD1,rWORD2
+ ori rRTN, rWORD2, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strnlen.S b/libc/sysdeps/powerpc/powerpc32/power7/strnlen.S
index ed088366a..eb52afd1a 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/strnlen.S
+++ b/libc/sysdeps/powerpc/powerpc32/power7/strnlen.S
@@ -28,51 +28,47 @@ ENTRY (__strnlen)
add r7,r3,r4 /* Calculate the last acceptable address. */
cmplwi r4,16
li r0,0 /* Word with null chars. */
+ addi r7,r7,-1
ble L(small_range)
- cmplw cr7,r3,r7 /* Is the address equal or less than r3? If
- it's equal or less, it means size is either 0
- or a negative number. */
- ble cr7,L(proceed)
-
- li r7,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ slw r10,r10,r6
+#else
slw r10,r10,r6
srw r10,r10,r6
+#endif
cmplwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
- bge cr6,L(end_max)
-
+ clrrwi r7,r7,2 /* Address of last word. */
mtcrf 0x01,r8
/* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
bt 29,L(loop_setup)
- /* Handle DWORD2 of pair. */
+ /* Handle WORD2 of pair. */
lwzu r12,4(r8)
cmpb r10,r12,r0
cmplwi cr7,r10,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
- bge cr6,L(end_max)
-
L(loop_setup):
- sub r5,r7,r9
+ /* The last word we want to read in the loop below is the one
+ containing the last byte of the string, ie. the word at
+ (s + size - 1) & ~3, or r7. The first word read is at
+ r8 + 4, we read 2 * cnt words, so the last word read will
+ be at r8 + 4 + 8 * cnt - 4. Solving for cnt gives
+ cnt = (r7 - r8) / 8 */
+ sub r5,r7,r8
srwi r6,r5,3 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for the null byte backwards in the string. Since
+
+ /* Main loop to look for the null byte in the string. Since
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
L(loop):
@@ -88,15 +84,18 @@ L(loop):
cmplwi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for null in the whole range. Just return
- the original size. */
- addi r9,r8,4
- cmplw cr6,r9,r7
- blt cr6,L(loop_small)
+
+ /* We may have one more word to read. */
+ cmplw cr6,r8,r7
+ beq cr6,L(end_max)
+
+ lwzu r12,4(r8)
+ cmpb r10,r12,r0
+ cmplwi cr6,r10,0
+ bne cr6,L(done)
L(end_max):
- sub r3,r7,r3
+ mr r3,r4
blr
/* OK, one (or both) of the words contains a null byte. Check
@@ -121,49 +120,56 @@ L(found):
We need to make sure the null char is *before* the end of the
range. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
- add r9,r8,r0
- sub r6,r9,r3 /* Length until the match. */
- cmplw r9,r7
- bgt L(end_max)
- mr r3,r6
- blr
-
- .align 4
-L(zero):
- li r3,0
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r10,-1
+ andc r0,r0,r10
+ popcntw r0,r0
+#else
+ cntlzw r0,r10 /* Count leading zeros before the match. */
+#endif
+ sub r3,r8,r3
+ srwi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
+ add r3,r3,r0 /* Length until the match. */
+ cmplw r3,r4
+ blelr
+ mr r3,r4
blr
-/* Deals with size <= 32. */
+/* Deals with size <= 16. */
.align 4
L(small_range):
cmplwi r4,0
- beq L(zero)
+ beq L(end_max)
+
+ clrrwi r7,r7,2 /* Address of last word. */
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in WORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ slw r10,r10,r6
+#else
slw r10,r10,r6
srw r10,r10,r6
+#endif
cmplwi cr7,r10,0
bne cr7,L(done)
- addi r9,r8,4
- cmplw r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmplw r8,r7
+ beq L(end_max)
.p2align 5
L(loop_small):
lwzu r12,4(r8)
cmpb r10,r12,r0
- addi r9,r8,4
cmplwi cr6,r10,0
bne cr6,L(done)
- cmplw r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmplw r8,r7
+ bne L(loop_small)
+ mr r3,r4
+ blr
+
END (__strnlen)
weak_alias (__strnlen, strnlen)
libc_hidden_builtin_def (strnlen)
diff --git a/libc/sysdeps/powerpc/powerpc32/setjmp-common.S b/libc/sysdeps/powerpc/powerpc32/setjmp-common.S
index 60b0026fa..3fb65b5f7 100644
--- a/libc/sysdeps/powerpc/powerpc32/setjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc32/setjmp-common.S
@@ -24,6 +24,11 @@
# include <jmpbuf-offsets.h>
#endif
+#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
+# define SAVE_GP(N) evstdd r##N,((JB_FPRS+((N)-14)*2)*4)(3)
+#else
+# define SAVE_GP(N) stw r##N,((JB_GPRS+(N)-14)*4)(3)
+#endif
ENTRY (__sigsetjmp)
@@ -35,31 +40,31 @@ ENTRY (__sigsetjmp)
stw r1,(JB_GPR1*4)(3)
#endif
mflr r0
- stw r14,((JB_GPRS+0)*4)(3)
+ SAVE_GP (14)
#ifdef PTR_MANGLE
PTR_MANGLE2 (r0, r10)
li r10,0
#endif
stw r0,(JB_LR*4)(3)
- stw r15,((JB_GPRS+1)*4)(3)
+ SAVE_GP (15)
mfcr r0
- stw r16,((JB_GPRS+2)*4)(3)
+ SAVE_GP (16)
stw r0,(JB_CR*4)(3)
- stw r17,((JB_GPRS+3)*4)(3)
- stw r18,((JB_GPRS+4)*4)(3)
- stw r19,((JB_GPRS+5)*4)(3)
- stw r20,((JB_GPRS+6)*4)(3)
- stw r21,((JB_GPRS+7)*4)(3)
- stw r22,((JB_GPRS+8)*4)(3)
- stw r23,((JB_GPRS+9)*4)(3)
- stw r24,((JB_GPRS+10)*4)(3)
- stw r25,((JB_GPRS+11)*4)(3)
- stw r26,((JB_GPRS+12)*4)(3)
- stw r27,((JB_GPRS+13)*4)(3)
- stw r28,((JB_GPRS+14)*4)(3)
- stw r29,((JB_GPRS+15)*4)(3)
- stw r30,((JB_GPRS+16)*4)(3)
- stw r31,((JB_GPRS+17)*4)(3)
+ SAVE_GP (17)
+ SAVE_GP (18)
+ SAVE_GP (19)
+ SAVE_GP (20)
+ SAVE_GP (21)
+ SAVE_GP (22)
+ SAVE_GP (23)
+ SAVE_GP (24)
+ SAVE_GP (25)
+ SAVE_GP (26)
+ SAVE_GP (27)
+ SAVE_GP (28)
+ SAVE_GP (29)
+ SAVE_GP (30)
+ SAVE_GP (31)
#if defined NOT_IN_libc && defined IS_IN_rtld
li r3,0
blr
diff --git a/libc/sysdeps/powerpc/powerpc32/setjmp.S b/libc/sysdeps/powerpc/powerpc32/setjmp.S
index 8a8cf0d6e..49b64ecf0 100644
--- a/libc/sysdeps/powerpc/powerpc32/setjmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/setjmp.S
@@ -25,7 +25,7 @@
#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmx__sigsetjmp, __sigsetjmp, GLIBC_2_3_4)
# define __sigsetjmp __vmx__sigsetjmp
# define __sigjmp_save __vmx__sigjmp_save
# include "setjmp-common.S"
@@ -35,7 +35,7 @@ default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
# undef __sigsetjmp
# undef __sigjmp_save
# undef JB_SIZE
-symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
+compat_symbol (libc, __novmx__sigsetjmp, __sigsetjmp, GLIBC_2_0)
# define __sigsetjmp __novmx__sigsetjmp
# define __sigjmp_save __novmx__sigjmp_save
# include "setjmp-common.S"
diff --git a/libc/sysdeps/powerpc/powerpc32/stackguard-macros.h b/libc/sysdeps/powerpc/powerpc32/stackguard-macros.h
index 839f6a4b9..b3d0af830 100644
--- a/libc/sysdeps/powerpc/powerpc32/stackguard-macros.h
+++ b/libc/sysdeps/powerpc/powerpc32/stackguard-macros.h
@@ -2,3 +2,13 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ \
+ uintptr_t x; \
+ asm ("lwz %0,%1(2)" \
+ : "=r" (x) \
+ : "i" (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) \
+ ); \
+ x; \
+ })
diff --git a/libc/sysdeps/powerpc/powerpc32/stpcpy.S b/libc/sysdeps/powerpc/powerpc32/stpcpy.S
index 03c6dddc3..7e106e0e6 100644
--- a/libc/sysdeps/powerpc/powerpc32/stpcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/stpcpy.S
@@ -62,7 +62,22 @@ L(g2): add rTMP, rFEFE, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
+#ifdef __LITTLE_ENDIAN__
+ rlwinm. rTMP, rALT, 0, 24, 31
+ stbu rALT, 4(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 24, 24, 31
+ stbu rTMP, 1(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 16, 24, 31
+ stbu rTMP, 1(rDEST)
+ beqlr-
+ rlwinm rTMP, rALT, 8, 24, 31
+ stbu rTMP, 1(rDEST)
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -73,6 +88,7 @@ L(g1): rlwinm. rTMP, rALT, 8, 24, 31
beqlr-
stbu rALT, 1(rDEST)
blr
+#endif
/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc32/strchr.S b/libc/sysdeps/powerpc/powerpc32/strchr.S
index c9952eecc..605056577 100644
--- a/libc/sysdeps/powerpc/powerpc32/strchr.S
+++ b/libc/sysdeps/powerpc/powerpc32/strchr.S
@@ -36,6 +36,8 @@ ENTRY (strchr)
#define rIGN r10 /* number of bits we should ignore in the first word */
#define rMASK r11 /* mask with the bits to ignore set to 0 */
#define rTMP3 r12
+#define rTMP4 rIGN
+#define rTMP5 rMASK
rlwimi rCHR, rCHR, 8, 16, 23
@@ -49,64 +51,93 @@ ENTRY (strchr)
addi r7F7F, r7F7F, 0x7f7f
/* Test the first (partial?) word. */
lwz rWORD, 0(rSTR)
+#ifdef __LITTLE_ENDIAN__
+ slw rMASK, rMASK, rIGN
+#else
srw rMASK, rMASK, rIGN
+#endif
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2
xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)
/* The loop. */
-L(loop):lwzu rWORD, 4(rSTR)
- and. rTMP1, rTMP1, rTMP2
+L(loop):
+ lwzu rWORD, 4(rSTR)
+ and. rTMP5, rTMP1, rTMP2
/* Test for 0. */
- add rTMP1, rFEFE, rWORD
- nor rTMP2, r7F7F, rWORD
+ add rTMP1, rFEFE, rWORD /* x - 0x01010101. */
+ nor rTMP2, r7F7F, rWORD /* ~(x | 0x7f7f7f7f) == ~x & 0x80808080. */
bne L(foundit)
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2 /* (x - 0x01010101) & ~x & 0x80808080. */
/* Start test for the bytes we're looking for. */
xor rTMP3, rCHR, rWORD
L(loopentry):
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
+
/* There is a zero byte in the word, but may also be a matching byte (either
before or after the zero byte). In fact, we may be looking for a
- zero byte, in which case we return a match. We guess that this hasn't
- happened, though. */
-L(missed):
- and. rTMP1, rTMP1, rTMP2
+ zero byte, in which case we return a match. */
+ and. rTMP5, rTMP1, rTMP2
li rRTN, 0
beqlr
-/* It did happen. Decide which one was first...
- I'm not sure if this is actually faster than a sequence of
- rotates, compares, and branches (we use it anyway because it's shorter). */
+/* At this point:
+ rTMP5 bytes are 0x80 for each match of c, 0 otherwise.
+ rTMP4 bytes are 0x80 for each match of 0, 0 otherwise.
+ But there may be false matches in the next most significant byte from
+ a true match due to carries. This means we need to recalculate the
+ matches using a longer method for big-endian. */
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
+ andc rTMP1, rTMP1, rTMP5
+ cntlzw rCLZB, rTMP1
+ addi rTMP2, rTMP4, -1
+ andc rTMP2, rTMP2, rTMP4
+ cmplw rTMP1, rTMP2
+ bgtlr
+ subfic rCLZB, rCLZB, 32-7
+#else
+/* I think we could reduce this by two instructions by keeping the "nor"
+ results from the loop for reuse here. See strlen.S tail. Similarly
+ one instruction could be pruned from L(foundit). */
and rFEFE, r7F7F, rWORD
- or rMASK, r7F7F, rWORD
+ or rTMP5, r7F7F, rWORD
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rWORD, rMASK, rFEFE
- nor rTMP2, rIGN, rTMP1
+ nor rWORD, rTMP5, rFEFE
+ nor rTMP2, rTMP4, rTMP1
+ cntlzw rCLZB, rTMP2
cmplw rWORD, rTMP2
bgtlr
- cntlzw rCLZB, rTMP2
+#endif
srwi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
blr
L(foundit):
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
+ andc rTMP1, rTMP1, rTMP5
+ cntlzw rCLZB, rTMP1
+ subfic rCLZB, rCLZB, 32-7-32
+ srawi rCLZB, rCLZB, 3
+#else
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rTMP1, rTMP1, r7F7F
- nor rTMP2, rIGN, rTMP1
+ nor rTMP2, rTMP4, rTMP1
cntlzw rCLZB, rTMP2
subi rSTR, rSTR, 4
srwi rCLZB, rCLZB, 3
+#endif
add rRTN, rSTR, rCLZB
blr
END (strchr)
diff --git a/libc/sysdeps/powerpc/powerpc32/strcmp.S b/libc/sysdeps/powerpc/powerpc32/strcmp.S
index 297ca3c1b..91d60c905 100644
--- a/libc/sysdeps/powerpc/powerpc32/strcmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/strcmp.S
@@ -24,7 +24,7 @@
EALIGN (strcmp, 4, 0)
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -34,6 +34,7 @@ EALIGN (strcmp, 4, 0)
#define r7F7F r8 /* constant 0x7f7f7f7f */
#define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r10 /* bits that differ in s1 & s2 words */
+#define rTMP r11
or rTMP, rSTR2, rSTR1
@@ -56,10 +57,45 @@ L(g1): add rTMP, rFEFE, rWORD1
and. rTMP, rTMP, rNEG
cmpw cr1, rWORD1, rWORD2
beq+ L(g0)
-L(endstring):
+
/* OK. We've hit the end of the string. We need to be careful that
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
+ andc rTMP2, rTMP2, rTMP
+ rlwimi rTMP2, rTMP2, 1, 0, 30
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rlwimi rTMP2, rWORD2, 24, 0, 7
+ rlwimi rTMP, rWORD1, 24, 0, 7
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+L(different):
+ lwz rWORD1, -4(rSTR1)
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rlwimi rTMP2, rWORD2, 24, 0, 7
+ rlwimi rTMP, rWORD1, 24, 0, 7
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+#else
+L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
@@ -84,7 +120,7 @@ L(different):
L(highbit):
ori rRTN, rWORD2, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc32/strcpy.S b/libc/sysdeps/powerpc/powerpc32/strcpy.S
index 4ae577dbb..e938cc42a 100644
--- a/libc/sysdeps/powerpc/powerpc32/strcpy.S
+++ b/libc/sysdeps/powerpc/powerpc32/strcpy.S
@@ -62,7 +62,22 @@ L(g2): add rTMP, rFEFE, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
+#ifdef __LITTLE_ENDIAN__
+ rlwinm. rTMP, rALT, 0, 24, 31
+ stb rALT, 4(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 24, 24, 31
+ stb rTMP, 5(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 16, 24, 31
+ stb rTMP, 6(rDEST)
+ beqlr-
+ rlwinm rTMP, rALT, 8, 24, 31
+ stb rTMP, 7(rDEST)
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stb rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -73,6 +88,7 @@ L(g1): rlwinm. rTMP, rALT, 8, 24, 31
beqlr-
stb rALT, 7(rDEST)
blr
+#endif
/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc32/strlen.S b/libc/sysdeps/powerpc/powerpc32/strlen.S
index 9a6eafc38..a7153ed7a 100644
--- a/libc/sysdeps/powerpc/powerpc32/strlen.S
+++ b/libc/sysdeps/powerpc/powerpc32/strlen.S
@@ -29,7 +29,12 @@
1 is subtracted you get a value in the range 0x00-0x7f, none of which
have their high bit set. The expression here is
(x + 0xfefefeff) & ~(x | 0x7f7f7f7f), which gives 0x00000000 when
- there were no 0x00 bytes in the word.
+ there were no 0x00 bytes in the word. You get 0x80 in bytes that
+ match, but possibly false 0x80 matches in the next more significant
+ byte to a true match due to carries. For little-endian this is
+ of no consequence since the least significant match is the one
+ we're interested in, but big-endian needs method 2 to find which
+ byte matches.
2) Given a word 'x', we can test to see _which_ byte was zero by
calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f).
@@ -72,7 +77,7 @@
ENTRY (strlen)
-#define rTMP1 r0
+#define rTMP4 r0
#define rRTN r3 /* incoming STR arg, outgoing result */
#define rSTR r4 /* current string position */
#define rPADN r5 /* number of padding bits we prepend to the
@@ -82,9 +87,9 @@ ENTRY (strlen)
#define rWORD1 r8 /* current string word */
#define rWORD2 r9 /* next string word */
#define rMASK r9 /* mask for first string word */
-#define rTMP2 r10
-#define rTMP3 r11
-#define rTMP4 r12
+#define rTMP1 r10
+#define rTMP2 r11
+#define rTMP3 r12
clrrwi rSTR, rRTN, 2
@@ -93,15 +98,20 @@ ENTRY (strlen)
lwz rWORD1, 0(rSTR)
li rMASK, -1
addi r7F7F, r7F7F, 0x7f7f
-/* That's the setup done, now do the first pair of words.
- We make an exception and use method (2) on the first two words, to reduce
- overhead. */
+/* We use method (2) on the first two words, because rFEFE isn't
+ required which reduces setup overhead. Also gives a faster return
+ for small strings on big-endian due to needing to recalculate with
+ method (2) anyway. */
+#ifdef __LITTLE_ENDIAN__
+ slw rMASK, rMASK, rPADN
+#else
srw rMASK, rMASK, rPADN
+#endif
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor rTMP1, rTMP2, rTMP1
- and. rWORD1, rTMP1, rMASK
+ nor rTMP3, rTMP2, rTMP1
+ and. rTMP3, rTMP3, rMASK
mtcrf 0x01, rRTN
bne L(done0)
lis rFEFE, -0x101
@@ -110,11 +120,12 @@ ENTRY (strlen)
bt 29, L(loop)
/* Handle second word of pair. */
+/* Perhaps use method (1) here for little-endian, saving one instruction? */
lwzu rWORD1, 4(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor. rWORD1, rTMP2, rTMP1
+ nor. rTMP3, rTMP2, rTMP1
bne L(done0)
/* The loop. */
@@ -128,28 +139,52 @@ L(loop):
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
- and. rTMP1, rTMP3, rTMP4
+ and. rTMP3, rTMP3, rTMP4
beq L(loop)
+#ifndef __LITTLE_ENDIAN__
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP4, rTMP1
+ andc rTMP3, rTMP4, rTMP1
b L(done0)
L(done1):
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 4
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP2, rTMP1
+ andc rTMP3, rTMP2, rTMP1
/* When we get to here, rSTR points to the first word in the string that
- contains a zero byte, and the most significant set bit in rWORD1 is in that
- byte. */
+ contains a zero byte, and rTMP3 has 0x80 for bytes that are zero,
+ and 0x00 otherwise. */
L(done0):
- cntlzw rTMP3, rWORD1
+ cntlzw rTMP3, rTMP3
subf rTMP1, rRTN, rSTR
srwi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
blr
+#else
+
+L(done0):
+ addi rTMP1, rTMP3, -1 /* Form a mask from trailing zeros. */
+ andc rTMP1, rTMP1, rTMP3
+ cntlzw rTMP1, rTMP1 /* Count bits not in the mask. */
+ subf rTMP3, rRTN, rSTR
+ subfic rTMP1, rTMP1, 32-7
+ srwi rTMP1, rTMP1, 3
+ add rRTN, rTMP1, rTMP3
+ blr
+
+L(done1):
+ addi rTMP3, rTMP1, -1
+ andc rTMP3, rTMP3, rTMP1
+ cntlzw rTMP3, rTMP3
+ subf rTMP1, rRTN, rSTR
+ subfic rTMP3, rTMP3, 32-7-32
+ srawi rTMP3, rTMP3, 3
+ add rRTN, rTMP1, rTMP3
+ blr
+#endif
+
END (strlen)
libc_hidden_builtin_def (strlen)
diff --git a/libc/sysdeps/powerpc/powerpc32/strncmp.S b/libc/sysdeps/powerpc/powerpc32/strncmp.S
index fa345d293..e36a160a8 100644
--- a/libc/sysdeps/powerpc/powerpc32/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc32/strncmp.S
@@ -24,7 +24,7 @@
EALIGN (strncmp, 4, 0)
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -35,6 +35,7 @@ EALIGN (strncmp, 4, 0)
#define r7F7F r9 /* constant 0x7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -73,12 +74,45 @@ L(g1): add rTMP, rFEFE, rWORD1
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ slwi rTMP, rTMP, 1
+ addi rTMP2, rTMP, -1
+ andc rTMP2, rTMP2, rTMP
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rlwimi rTMP2, rWORD2, 24, 0, 7
+ rlwimi rTMP, rWORD1, 24, 0, 7
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+L(different):
+ lwz rWORD1, -4(rSTR1)
+ rlwinm rTMP2, rWORD2, 8, 0xffffffff /* Byte reverse word. */
+ rlwinm rTMP, rWORD1, 8, 0xffffffff
+ rlwimi rTMP2, rWORD2, 24, 0, 7
+ rlwimi rTMP, rWORD1, 24, 0, 7
+ rlwimi rTMP2, rWORD2, 24, 16, 23
+ rlwimi rTMP, rWORD1, 24, 16, 23
+ xor. rBITDIF, rTMP, rTMP2
+ sub rRTN, rTMP, rTMP2
+ bgelr+
+ ori rRTN, rTMP2, 1
+ blr
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
@@ -86,28 +120,20 @@ L(endstring):
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
- blt- cr1, L(equal)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+ cr1
L(equal):
li rRTN, 0
blr
L(different):
- lwzu rWORD1, -4(rSTR1)
+ lwz rWORD1, -4(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
- blt- L(highbit)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+
L(highbit):
- srwi rWORD2, rWORD2, 24
- srwi rWORD1, rWORD1, 24
- sub rRTN, rWORD1, rWORD2
+ ori rRTN, rWORD2, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S
index 70c370439..4f1e3c88d 100644
--- a/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -57,7 +57,7 @@ ENTRY (__longjmp)
beq L(no_vmx)
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
- lwz r0,((JB_VRSAVE)*8)(3)
+ lwz r0,((JB_VRSAVE)*8)(3) /* 32-bit VRSAVE. */
mtspr VRSAVE,r0
beq+ L(aligned_restore_vmx)
addi r6,r5,16
@@ -153,7 +153,7 @@ L(no_vmx):
lfd fp21,((JB_FPRS+7)*8)(r3)
ld r22,((JB_GPRS+8)*8)(r3)
lfd fp22,((JB_FPRS+8)*8)(r3)
- ld r0,(JB_CR*8)(r3)
+ lwz r0,((JB_CR*8)+4)(r3) /* 32-bit CR. */
ld r23,((JB_GPRS+9)*8)(r3)
lfd fp23,((JB_FPRS+9)*8)(r3)
ld r24,((JB_GPRS+10)*8)(r3)
diff --git a/libc/sysdeps/powerpc/powerpc64/dl-machine.h b/libc/sysdeps/powerpc/powerpc64/dl-machine.h
index 059fdafd5..18cf15738 100644
--- a/libc/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/libc/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -561,6 +561,12 @@ elf_machine_rela (struct link_map *map,
Elf64_Addr *const reloc_addr = reloc_addr_arg;
const int r_type = ELF64_R_TYPE (reloc->r_info);
const Elf64_Sym *const refsym = sym;
+ union unaligned
+ {
+ uint16_t u2;
+ uint32_t u4;
+ uint64_t u8;
+ } __attribute__ ((__packed__));
if (r_type == R_PPC64_RELATIVE)
{
@@ -741,23 +747,11 @@ elf_machine_rela (struct link_map *map,
return;
case R_PPC64_UADDR64:
- /* We are big-endian. */
- ((char *) reloc_addr_arg)[0] = (value >> 56) & 0xff;
- ((char *) reloc_addr_arg)[1] = (value >> 48) & 0xff;
- ((char *) reloc_addr_arg)[2] = (value >> 40) & 0xff;
- ((char *) reloc_addr_arg)[3] = (value >> 32) & 0xff;
- ((char *) reloc_addr_arg)[4] = (value >> 24) & 0xff;
- ((char *) reloc_addr_arg)[5] = (value >> 16) & 0xff;
- ((char *) reloc_addr_arg)[6] = (value >> 8) & 0xff;
- ((char *) reloc_addr_arg)[7] = (value >> 0) & 0xff;
+ ((union unaligned *) reloc_addr)->u8 = value;
return;
case R_PPC64_UADDR32:
- /* We are big-endian. */
- ((char *) reloc_addr_arg)[0] = (value >> 24) & 0xff;
- ((char *) reloc_addr_arg)[1] = (value >> 16) & 0xff;
- ((char *) reloc_addr_arg)[2] = (value >> 8) & 0xff;
- ((char *) reloc_addr_arg)[3] = (value >> 0) & 0xff;
+ ((union unaligned *) reloc_addr)->u4 = value;
return;
case R_PPC64_ADDR32:
@@ -781,10 +775,8 @@ elf_machine_rela (struct link_map *map,
case R_PPC64_UADDR16:
if (dont_expect ((value + 0x8000) >= 0x10000))
_dl_reloc_overflow (map, "R_PPC64_UADDR16", reloc_addr, refsym);
- /* We are big-endian. */
- ((char *) reloc_addr_arg)[0] = (value >> 8) & 0xff;
- ((char *) reloc_addr_arg)[1] = (value >> 0) & 0xff;
- break;
+ ((union unaligned *) reloc_addr)->u2 = value;
+ return;
case R_PPC64_ADDR16_DS:
if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
index 801af5d0a..45f71d7ac 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
@@ -19,8 +19,10 @@
#include <sysdep.h>
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"
EALIGN (__ceilf, 4, 0)
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
index a0a22e7eb..e85b820b2 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
@@ -19,8 +19,10 @@
#include <sysdep.h>
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"
EALIGN (__floorf, 4, 0)
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
index 876707c76..b1a2b8cd6 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
@@ -26,8 +26,10 @@
/* float [fp1] nearbyintf(float [fp1]) */
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"
EALIGN (__nearbyintf, 4, 0)
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
index cb28ec748..188771742 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
@@ -19,8 +19,10 @@
#include <sysdep.h>
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"
EALIGN (__rintf, 4, 0)
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
index 980a77bde..4f2c85163 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
@@ -19,10 +19,12 @@
#include <sysdep.h>
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
.LC1: /* 0.5 */
- .tc FD_3f000000_0[TC],0x3f00000000000000
+ .long 0x3f000000
+
.section ".text"
/* float [fp1] roundf (float x [fp1])
diff --git a/libc/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/libc/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
index 5ea5f3d04..b8fd05031 100644
--- a/libc/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ b/libc/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
@@ -19,8 +19,10 @@
#include <sysdep.h>
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"
/* float [fp1] truncf (float x [fp1])
diff --git a/libc/sysdeps/powerpc/powerpc64/memcpy.S b/libc/sysdeps/powerpc/powerpc64/memcpy.S
index b8c4cc8b1..5fc7401c9 100644
--- a/libc/sysdeps/powerpc/powerpc64/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/memcpy.S
@@ -212,15 +212,28 @@ EALIGN (memcpy, 5, 0)
blt cr6,5f
srdi 7,6,16
bgt cr6,3f
+#ifdef __LITTLE_ENDIAN__
+ sth 7,0(3)
+#else
sth 6,0(3)
+#endif
b 7f
.align 4
3:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,24
+ stb 6,0(3)
+ sth 7,1(3)
+#else
stb 7,0(3)
sth 6,1(3)
+#endif
b 7f
.align 4
5:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,8
+#endif
stb 6,0(3)
7:
cmpldi cr1,10,16
@@ -328,7 +341,11 @@ EALIGN (memcpy, 5, 0)
ld 7,8(5)
subfic 9,10,64
beq 2f
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+#else
sld 0,6,10
+#endif
cmpldi 11,1
mr 6,7
addi 4,4,-8
@@ -336,15 +353,25 @@ EALIGN (memcpy, 5, 0)
b 1f
2: addi 5,5,8
.align 4
+#ifdef __LITTLE_ENDIAN__
+0: srd 0,6,10
+ sld 8,7,9
+#else
0: sld 0,6,10
srd 8,7,9
+#endif
cmpldi 11,2
ld 6,8(5)
or 0,0,8
addi 11,11,-2
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srd 0,7,10
+1: sld 8,6,9
+#else
sld 0,7,10
1: srd 8,6,9
+#endif
or 0,0,8
beq 8f
ld 7,16(5)
diff --git a/libc/sysdeps/powerpc/powerpc64/memset.S b/libc/sysdeps/powerpc/powerpc64/memset.S
index 6acf149c8..1027a592c 100644
--- a/libc/sysdeps/powerpc/powerpc64/memset.S
+++ b/libc/sysdeps/powerpc/powerpc64/memset.S
@@ -55,14 +55,14 @@ L(_memset):
/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
@@ -84,14 +84,14 @@ L(g0):
/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -212,7 +212,7 @@ L(le4):
/* Memset of 0-31 bytes. */
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
diff --git a/libc/sysdeps/powerpc/powerpc64/power4/memcmp.S b/libc/sysdeps/powerpc/powerpc64/power4/memcmp.S
index 69caedc9f..80d67c9aa 100644
--- a/libc/sysdeps/powerpc/powerpc64/power4/memcmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/power4/memcmp.S
@@ -1,4 +1,4 @@
-/* Optimized strcmp implementation for PowerPC64.
+/* Optimized memcmp implementation for PowerPC64.
Copyright (C) 2003-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -18,13 +18,14 @@
#include <sysdep.h>
-/* int [r3] memcmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */
+/* int [r3] memcmp (const char *s1 [r3],
+ const char *s2 [r4],
+ size_t size [r5]) */
.machine power4
EALIGN (memcmp, 4, 0)
CALL_MCOUNT 3
-#define rTMP r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -35,107 +36,127 @@ EALIGN (memcmp, 4, 0)
#define rWORD4 r9 /* next word in s2 */
#define rWORD5 r10 /* next word in s1 */
#define rWORD6 r11 /* next word in s2 */
-#define rBITDIF r12 /* bits that differ in s1 & s2 words */
#define rWORD7 r30 /* next word in s1 */
#define rWORD8 r31 /* next word in s2 */
- xor rTMP, rSTR2, rSTR1
+ xor r0, rSTR2, rSTR1
cmpldi cr6, rN, 0
cmpldi cr1, rN, 12
- clrldi. rTMP, rTMP, 61
- clrldi rBITDIF, rSTR1, 61
- cmpldi cr5, rBITDIF, 0
+ clrldi. r0, r0, 61
+ clrldi r12, rSTR1, 61
+ cmpldi cr5, r12, 0
beq- cr6, L(zeroLength)
- dcbt 0,rSTR1
- dcbt 0,rSTR2
+ dcbt 0, rSTR1
+ dcbt 0, rSTR2
/* If less than 8 bytes or not aligned, use the unaligned
byte loop. */
blt cr1, L(bytealigned)
- std rWORD8,-8(r1)
- cfi_offset(rWORD8,-8)
- std rWORD7,-16(r1)
- cfi_offset(rWORD7,-16)
+ std rWORD8, -8(r1)
+ cfi_offset(rWORD8, -8)
+ std rWORD7, -16(r1)
+ cfi_offset(rWORD7, -16)
bne L(unaligned)
/* At this point we know both strings have the same alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
3 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then we are already double word
- aligned and can perform the DWaligned loop.
+ of r12 to 0. If r12 == 0 then we are already double word
+ aligned and can perform the DW aligned loop.
Otherwise we know the two strings have the same alignment (but not
- yet DW). So we can force the string addresses to the next lower DW
- boundary and special case this first DW word using shift left to
+ yet DW). So we force the string addresses to the next lower DW
+ boundary and special case this first DW using shift left to
eliminate bits preceding the first byte. Since we want to join the
- normal (DWaligned) compare loop, starting at the second double word,
+ normal (DW aligned) compare loop, starting at the second double word,
we need to adjust the length (rN) and special case the loop
- versioning for the first DW. This insures that the loop count is
- correct and the first DW (shifted) is in the expected resister pair. */
- .align 4
+ versioning for the first DW. This ensures that the loop count is
+ correct and the first DW (shifted) is in the expected register pair. */
+ .align 4
L(samealignment):
clrrdi rSTR1, rSTR1, 3
clrrdi rSTR2, rSTR2, 3
beq cr5, L(DWaligned)
- add rN, rN, rBITDIF
- sldi r11, rBITDIF, 3
- srdi rTMP, rN, 5 /* Divide by 32 */
- andi. rBITDIF, rN, 24 /* Get the DW remainder */
+ add rN, rN, r12
+ sldi rWORD6, r12, 3
+ srdi r0, rN, 5 /* Divide by 32 */
+ andi. r12, rN, 24 /* Get the DW remainder */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 0(rSTR1)
ld rWORD2, 0(rSTR2)
- cmpldi cr1, rBITDIF, 16
+#endif
+ cmpldi cr1, r12, 16
cmpldi cr7, rN, 32
clrldi rN, rN, 61
beq L(dPs4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
bgt cr1, L(dPs3)
beq cr1, L(dPs2)
/* Remainder is 8 */
- .align 3
+ .align 3
L(dsP1):
- sld rWORD5, rWORD1, r11
- sld rWORD6, rWORD2, r11
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD2, rWORD6
cmpld cr5, rWORD5, rWORD6
blt cr7, L(dP1x)
/* Do something useful in this cycle since we have to branch anyway. */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
b L(dP1e)
/* Remainder is 16 */
- .align 4
+ .align 4
L(dPs2):
- sld rWORD5, rWORD1, r11
- sld rWORD6, rWORD2, r11
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD2, rWORD6
cmpld cr6, rWORD5, rWORD6
blt cr7, L(dP2x)
/* Do something useful in this cycle since we have to branch anyway. */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD7, 8(rSTR1)
ld rWORD8, 8(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
b L(dP2e)
/* Remainder is 24 */
- .align 4
+ .align 4
L(dPs3):
- sld rWORD3, rWORD1, r11
- sld rWORD4, rWORD2, r11
+ sld rWORD3, rWORD1, rWORD6
+ sld rWORD4, rWORD2, rWORD6
cmpld cr1, rWORD3, rWORD4
b L(dP3e)
/* Count is a multiple of 32, remainder is 0 */
- .align 4
+ .align 4
L(dPs4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- sld rWORD1, rWORD1, r11
- sld rWORD2, rWORD2, r11
- cmpld cr0, rWORD1, rWORD2
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ sld rWORD1, rWORD1, rWORD6
+ sld rWORD2, rWORD2, rWORD6
+ cmpld cr7, rWORD1, rWORD2
b L(dP4e)
/* At this point we know both strings are double word aligned and the
compare length is at least 8 bytes. */
- .align 4
+ .align 4
L(DWaligned):
- andi. rBITDIF, rN, 24 /* Get the DW remainder */
- srdi rTMP, rN, 5 /* Divide by 32 */
- cmpldi cr1, rBITDIF, 16
+ andi. r12, rN, 24 /* Get the DW remainder */
+ srdi r0, rN, 5 /* Divide by 32 */
+ cmpldi cr1, r12, 16
cmpldi cr7, rN, 32
clrldi rN, rN, 61
beq L(dP4)
@@ -143,174 +164,343 @@ L(DWaligned):
beq cr1, L(dP2)
/* Remainder is 8 */
- .align 4
+ .align 4
L(dP1):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
/* Normally we'd use rWORD7/rWORD8 here, but since we might exit early
(8-15 byte compare), we want to use only volatile registers. This
means we can avoid restoring non-volatile registers since we did not
change any on the early exit path. The key here is the non-early
exit path only cares about the condition code (cr5), not about which
register pair was used. */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 0(rSTR1)
ld rWORD6, 0(rSTR2)
+#endif
cmpld cr5, rWORD5, rWORD6
blt cr7, L(dP1x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
L(dP1e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 16(rSTR1)
ld rWORD4, 16(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 24(rSTR1)
ld rWORD6, 24(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
- bne cr5, L(dLcr5)
- bne cr0, L(dLcr0)
+ bne cr5, L(dLcr5x)
+ bne cr7, L(dLcr7x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ldu rWORD7, 32(rSTR1)
ldu rWORD8, 32(rSTR2)
+#endif
bne cr1, L(dLcr1)
cmpld cr5, rWORD7, rWORD8
bdnz L(dLoop)
bne cr6, L(dLcr6)
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- .align 3
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ .align 3
L(dP1x):
sldi. r12, rN, 3
- bne cr5, L(dLcr5)
+ bne cr5, L(dLcr5x)
subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
bne L(d00)
li rRTN, 0
blr
/* Remainder is 16 */
- .align 4
+ .align 4
L(dP2):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 0(rSTR1)
ld rWORD6, 0(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
blt cr7, L(dP2x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD7, 8(rSTR1)
ld rWORD8, 8(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
L(dP2e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 16(rSTR1)
ld rWORD2, 16(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 24(rSTR1)
ld rWORD4, 24(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
+#endif
bne cr6, L(dLcr6)
bne cr5, L(dLcr5)
b L(dLoop2)
/* Again we are on a early exit path (16-23 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
- .align 4
+ .align 4
L(dP2x):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 8(rSTR1)
ld rWORD4, 8(rSTR2)
- cmpld cr5, rWORD3, rWORD4
+#endif
+ cmpld cr1, rWORD3, rWORD4
sldi. r12, rN, 3
- bne cr6, L(dLcr6)
+ bne cr6, L(dLcr6x)
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
- bne cr5, L(dLcr5)
+#endif
+ bne cr1, L(dLcr1x)
subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
bne L(d00)
li rRTN, 0
blr
/* Remainder is 24 */
- .align 4
+ .align 4
L(dP3):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 0(rSTR1)
ld rWORD4, 0(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
L(dP3e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 8(rSTR1)
ld rWORD6, 8(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
blt cr7, L(dP3x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD7, 16(rSTR1)
ld rWORD8, 16(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 24(rSTR1)
ld rWORD2, 24(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 16
addi rSTR2, rSTR2, 16
+#endif
bne cr1, L(dLcr1)
bne cr6, L(dLcr6)
b L(dLoop1)
/* Again we are on a early exit path (24-31 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
- .align 4
+ .align 4
L(dP3x):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 16(rSTR1)
ld rWORD2, 16(rSTR2)
- cmpld cr5, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
sldi. r12, rN, 3
- bne cr1, L(dLcr1)
+ bne cr1, L(dLcr1x)
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 16
addi rSTR2, rSTR2, 16
- bne cr6, L(dLcr6)
+#endif
+ bne cr6, L(dLcr6x)
subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
- bne cr5, L(dLcr5)
+ bne cr7, L(dLcr7x)
bne L(d00)
li rRTN, 0
blr
/* Count is a multiple of 32, remainder is 0 */
- .align 4
+ .align 4
L(dP4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 0(rSTR1)
ld rWORD2, 0(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
L(dP4e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 8(rSTR1)
ld rWORD4, 8(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 16(rSTR1)
ld rWORD6, 16(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ldu rWORD7, 24(rSTR1)
ldu rWORD8, 24(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
bne cr1, L(dLcr1)
bdz- L(d24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
- .align 4
+ .align 4
L(dLoop):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
bne cr6, L(dLcr6)
L(dLoop1):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 16(rSTR1)
ld rWORD4, 16(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
bne cr5, L(dLcr5)
L(dLoop2):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 24(rSTR1)
ld rWORD6, 24(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
L(dLoop3):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ldu rWORD7, 32(rSTR1)
ldu rWORD8, 32(rSTR2)
+#endif
bne- cr1, L(dLcr1)
- cmpld cr0, rWORD1, rWORD2
+ cmpld cr7, rWORD1, rWORD2
bdnz+ L(dLoop)
L(dL4):
@@ -320,7 +510,7 @@ L(dL4):
bne cr5, L(dLcr5)
cmpld cr5, rWORD7, rWORD8
L(d44):
- bne cr0, L(dLcr0)
+ bne cr7, L(dLcr7)
L(d34):
bne cr1, L(dLcr1)
L(d24):
@@ -329,60 +519,74 @@ L(d14):
sldi. r12, rN, 3
bne cr5, L(dLcr5)
L(d04):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
beq L(zeroLength)
/* At this point we have a remainder of 1 to 7 bytes to compare. Since
we are aligned it is safe to load the whole double word, and use
shift right double to eliminate bits beyond the compare length. */
L(d00):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
+#endif
srd rWORD1, rWORD1, rN
srd rWORD2, rWORD2, rN
- cmpld cr5, rWORD1, rWORD2
- bne cr5, L(dLcr5x)
+ cmpld cr7, rWORD1, rWORD2
+ bne cr7, L(dLcr7x)
li rRTN, 0
blr
- .align 4
-L(dLcr0):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+
+ .align 4
+L(dLcr7):
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr7x):
li rRTN, 1
- bgtlr cr0
+ bgtlr cr7
li rRTN, -1
blr
- .align 4
+ .align 4
L(dLcr1):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr1x):
li rRTN, 1
bgtlr cr1
li rRTN, -1
blr
- .align 4
+ .align 4
L(dLcr6):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr6x):
li rRTN, 1
bgtlr cr6
li rRTN, -1
blr
- .align 4
+ .align 4
L(dLcr5):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
L(dLcr5x):
li rRTN, 1
bgtlr cr5
li rRTN, -1
blr
- .align 4
+ .align 4
L(bytealigned):
- mtctr rN /* Power4 wants mtctr 1st in dispatch group */
+ mtctr rN /* Power4 wants mtctr 1st in dispatch group */
+#if 0
+/* Huh? We've already branched on cr6! */
beq- cr6, L(zeroLength)
+#endif
/* We need to prime this loop. This loop is swing modulo scheduled
to avoid pipe delays. The dependent instruction latencies (load to
@@ -397,7 +601,7 @@ L(bytealigned):
lbz rWORD1, 0(rSTR1)
lbz rWORD2, 0(rSTR2)
bdz- L(b11)
- cmpld cr0, rWORD1, rWORD2
+ cmpld cr7, rWORD1, rWORD2
lbz rWORD3, 1(rSTR1)
lbz rWORD4, 1(rSTR2)
bdz- L(b12)
@@ -405,11 +609,11 @@ L(bytealigned):
lbzu rWORD5, 2(rSTR1)
lbzu rWORD6, 2(rSTR2)
bdz- L(b13)
- .align 4
+ .align 4
L(bLoop):
lbzu rWORD1, 1(rSTR1)
lbzu rWORD2, 1(rSTR2)
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
cmpld cr6, rWORD5, rWORD6
bdz- L(b3i)
@@ -418,7 +622,7 @@ L(bLoop):
lbzu rWORD4, 1(rSTR2)
bne- cr1, L(bLcr1)
- cmpld cr0, rWORD1, rWORD2
+ cmpld cr7, rWORD1, rWORD2
bdz- L(b2i)
lbzu rWORD5, 1(rSTR1)
@@ -435,23 +639,23 @@ L(bLoop):
tested. In this case we must complete the pending operations
before returning. */
L(b1i):
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
bne- cr1, L(bLcr1)
b L(bx56)
- .align 4
+ .align 4
L(b2i):
bne- cr6, L(bLcr6)
- bne- cr0, L(bLcr0)
+ bne- cr7, L(bLcr7)
b L(bx34)
- .align 4
+ .align 4
L(b3i):
bne- cr1, L(bLcr1)
bne- cr6, L(bLcr6)
b L(bx12)
- .align 4
-L(bLcr0):
+ .align 4
+L(bLcr7):
li rRTN, 1
- bgtlr cr0
+ bgtlr cr7
li rRTN, -1
blr
L(bLcr1):
@@ -466,14 +670,14 @@ L(bLcr6):
blr
L(b13):
- bne- cr0, L(bx12)
+ bne- cr7, L(bx12)
bne- cr1, L(bx34)
L(bx56):
sub rRTN, rWORD5, rWORD6
blr
nop
L(b12):
- bne- cr0, L(bx12)
+ bne- cr7, L(bx12)
L(bx34):
sub rRTN, rWORD3, rWORD4
blr
@@ -481,101 +685,106 @@ L(b11):
L(bx12):
sub rRTN, rWORD1, rWORD2
blr
- .align 4
-L(zeroLengthReturn):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ .align 4
L(zeroLength):
li rRTN, 0
blr
- .align 4
+ .align 4
/* At this point we know the strings have different alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
3 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then rStr1 is double word
+ of r12 to 0. If r12 == 0 then rStr1 is double word
aligned and can perform the DWunaligned loop.
Otherwise we know that rSTR1 is not already DW aligned yet.
So we can force the string addresses to the next lower DW
- boundary and special case this first DW word using shift left to
+ boundary and special case this first DW using shift left to
eliminate bits preceding the first byte. Since we want to join the
normal (DWaligned) compare loop, starting at the second double word,
we need to adjust the length (rN) and special case the loop
- versioning for the first DW. This insures that the loop count is
+ versioning for the first DW. This ensures that the loop count is
correct and the first DW (shifted) is in the expected resister pair. */
-#define rSHL r29 /* Unaligned shift left count. */
-#define rSHR r28 /* Unaligned shift right count. */
-#define rB r27 /* Left rotation temp for rWORD2. */
-#define rD r26 /* Left rotation temp for rWORD4. */
-#define rF r25 /* Left rotation temp for rWORD6. */
-#define rH r24 /* Left rotation temp for rWORD8. */
-#define rA r0 /* Right rotation temp for rWORD2. */
-#define rC r12 /* Right rotation temp for rWORD4. */
-#define rE r0 /* Right rotation temp for rWORD6. */
-#define rG r12 /* Right rotation temp for rWORD8. */
+#define rSHL r29 /* Unaligned shift left count. */
+#define rSHR r28 /* Unaligned shift right count. */
+#define rWORD8_SHIFT r27 /* Left rotation temp for rWORD2. */
+#define rWORD2_SHIFT r26 /* Left rotation temp for rWORD4. */
+#define rWORD4_SHIFT r25 /* Left rotation temp for rWORD6. */
+#define rWORD6_SHIFT r24 /* Left rotation temp for rWORD8. */
L(unaligned):
- std r29,-24(r1)
- cfi_offset(r29,-24)
+ std rSHL, -24(r1)
+ cfi_offset(rSHL, -24)
clrldi rSHL, rSTR2, 61
beq- cr6, L(duzeroLength)
- std r28,-32(r1)
- cfi_offset(r28,-32)
+ std rSHR, -32(r1)
+ cfi_offset(rSHR, -32)
beq cr5, L(DWunaligned)
- std r27,-40(r1)
- cfi_offset(r27,-40)
-/* Adjust the logical start of rSTR2 ro compensate for the extra bits
+ std rWORD8_SHIFT, -40(r1)
+ cfi_offset(rWORD8_SHIFT, -40)
+/* Adjust the logical start of rSTR2 to compensate for the extra bits
in the 1st rSTR1 DW. */
- sub r27, rSTR2, rBITDIF
+ sub rWORD8_SHIFT, rSTR2, r12
/* But do not attempt to address the DW before that DW that contains
the actual start of rSTR2. */
clrrdi rSTR2, rSTR2, 3
- std r26,-48(r1)
- cfi_offset(r26,-48)
-/* Compute the left/right shift counts for the unalign rSTR2,
+ std rWORD2_SHIFT, -48(r1)
+ cfi_offset(rWORD2_SHIFT, -48)
+/* Compute the left/right shift counts for the unaligned rSTR2,
compensating for the logical (DW aligned) start of rSTR1. */
- clrldi rSHL, r27, 61
+ clrldi rSHL, rWORD8_SHIFT, 61
clrrdi rSTR1, rSTR1, 3
- std r25,-56(r1)
- cfi_offset(r25,-56)
+ std rWORD4_SHIFT, -56(r1)
+ cfi_offset(rWORD4_SHIFT, -56)
sldi rSHL, rSHL, 3
- cmpld cr5, r27, rSTR2
- add rN, rN, rBITDIF
- sldi r11, rBITDIF, 3
- std r24,-64(r1)
- cfi_offset(r24,-64)
+ cmpld cr5, rWORD8_SHIFT, rSTR2
+ add rN, rN, r12
+ sldi rWORD6, r12, 3
+ std rWORD6_SHIFT, -64(r1)
+ cfi_offset(rWORD6_SHIFT, -64)
subfic rSHR, rSHL, 64
- srdi rTMP, rN, 5 /* Divide by 32 */
- andi. rBITDIF, rN, 24 /* Get the DW remainder */
+ srdi r0, rN, 5 /* Divide by 32 */
+ andi. r12, rN, 24 /* Get the DW remainder */
/* We normally need to load 2 DWs to start the unaligned rSTR2, but in
this special case those bits may be discarded anyway. Also we
must avoid loading a DW where none of the bits are part of rSTR2 as
this may cross a page boundary and cause a page fault. */
li rWORD8, 0
blt cr5, L(dus0)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD8, 0(rSTR2)
- la rSTR2, 8(rSTR2)
+ addi rSTR2, rSTR2, 8
+#endif
sld rWORD8, rWORD8, rSHL
L(dus0):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 0(rSTR1)
ld rWORD2, 0(rSTR2)
- cmpldi cr1, rBITDIF, 16
+#endif
+ cmpldi cr1, r12, 16
cmpldi cr7, rN, 32
- srd rG, rWORD2, rSHR
+ srd r12, rWORD2, rSHR
clrldi rN, rN, 61
beq L(duPs4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- or rWORD8, rG, rWORD8
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ or rWORD8, r12, rWORD8
bgt cr1, L(duPs3)
beq cr1, L(duPs2)
/* Remainder is 8 */
- .align 4
+ .align 4
L(dusP1):
- sld rB, rWORD2, rSHL
- sld rWORD7, rWORD1, r11
- sld rWORD8, rWORD8, r11
+ sld rWORD8_SHIFT, rWORD2, rSHL
+ sld rWORD7, rWORD1, rWORD6
+ sld rWORD8, rWORD8, rWORD6
bge cr7, L(duP1e)
/* At this point we exit early with the first double word compare
complete and remainder of 0 to 7 bytes. See L(du14) for details on
@@ -585,95 +794,133 @@ L(dusP1):
bne cr5, L(duLcr5)
cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD2, 8(rSTR2)
- srd rA, rWORD2, rSHR
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 16 */
- .align 4
+ .align 4
L(duPs2):
- sld rH, rWORD2, rSHL
- sld rWORD5, rWORD1, r11
- sld rWORD6, rWORD8, r11
+ sld rWORD6_SHIFT, rWORD2, rSHL
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD8, rWORD6
b L(duP2e)
/* Remainder is 24 */
- .align 4
+ .align 4
L(duPs3):
- sld rF, rWORD2, rSHL
- sld rWORD3, rWORD1, r11
- sld rWORD4, rWORD8, r11
+ sld rWORD4_SHIFT, rWORD2, rSHL
+ sld rWORD3, rWORD1, rWORD6
+ sld rWORD4, rWORD8, rWORD6
b L(duP3e)
/* Count is a multiple of 32, remainder is 0 */
- .align 4
+ .align 4
L(duPs4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- or rWORD8, rG, rWORD8
- sld rD, rWORD2, rSHL
- sld rWORD1, rWORD1, r11
- sld rWORD2, rWORD8, r11
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ or rWORD8, r12, rWORD8
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ sld rWORD1, rWORD1, rWORD6
+ sld rWORD2, rWORD8, rWORD6
b L(duP4e)
/* At this point we know rSTR1 is double word aligned and the
compare length is at least 8 bytes. */
- .align 4
+ .align 4
L(DWunaligned):
- std r27,-40(r1)
- cfi_offset(r27,-40)
+ std rWORD8_SHIFT, -40(r1)
+ cfi_offset(rWORD8_SHIFT, -40)
clrrdi rSTR2, rSTR2, 3
- std r26,-48(r1)
- cfi_offset(r26,-48)
- srdi rTMP, rN, 5 /* Divide by 32 */
- std r25,-56(r1)
- cfi_offset(r25,-56)
- andi. rBITDIF, rN, 24 /* Get the DW remainder */
- std r24,-64(r1)
- cfi_offset(r24,-64)
+ std rWORD2_SHIFT, -48(r1)
+ cfi_offset(rWORD2_SHIFT, -48)
+ srdi r0, rN, 5 /* Divide by 32 */
+ std rWORD4_SHIFT, -56(r1)
+ cfi_offset(rWORD4_SHIFT, -56)
+ andi. r12, rN, 24 /* Get the DW remainder */
+ std rWORD6_SHIFT, -64(r1)
+ cfi_offset(rWORD6_SHIFT, -64)
sldi rSHL, rSHL, 3
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD6, 0(rSTR2)
ldu rWORD8, 8(rSTR2)
- cmpldi cr1, rBITDIF, 16
+#endif
+ cmpldi cr1, r12, 16
cmpldi cr7, rN, 32
clrldi rN, rN, 61
subfic rSHR, rSHL, 64
- sld rH, rWORD6, rSHL
+ sld rWORD6_SHIFT, rWORD6, rSHL
beq L(duP4)
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
bgt cr1, L(duP3)
beq cr1, L(duP2)
/* Remainder is 8 */
- .align 4
+ .align 4
L(duP1):
- srd rG, rWORD8, rSHR
+ srd r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
ld rWORD7, 0(rSTR1)
- sld rB, rWORD8, rSHL
- or rWORD8, rG, rH
+#endif
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP1x)
L(duP1e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
- srd rA, rWORD2, rSHR
- sld rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 16(rSTR1)
ld rWORD4, 16(rSTR2)
- cmpld cr0, rWORD1, rWORD2
- srd rC, rWORD4, rSHR
- sld rF, rWORD4, rSHL
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
bne cr5, L(duLcr5)
- or rWORD4, rC, rD
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 24(rSTR1)
ld rWORD6, 24(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
- srd rE, rWORD6, rSHR
- sld rH, rWORD6, rSHL
- bne cr0, L(duLcr0)
- or rWORD6, rE, rF
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ bne cr7, L(duLcr7)
+ or rWORD6, r0, rWORD4_SHIFT
cmpld cr6, rWORD5, rWORD6
b L(duLoop3)
- .align 4
+ .align 4
/* At this point we exit early with the first double word compare
complete and remainder of 0 to 7 bytes. See L(du14) for details on
how we handle the remaining bytes. */
@@ -683,186 +930,321 @@ L(duP1x):
bne cr5, L(duLcr5)
cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD2, 8(rSTR2)
- srd rA, rWORD2, rSHR
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 16 */
- .align 4
+ .align 4
L(duP2):
- srd rE, rWORD8, rSHR
+ srd r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
ld rWORD5, 0(rSTR1)
- or rWORD6, rE, rH
- sld rH, rWORD8, rSHL
+#endif
+ or rWORD6, r0, rWORD6_SHIFT
+ sld rWORD6_SHIFT, rWORD8, rSHL
L(duP2e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD7, 8(rSTR1)
ld rWORD8, 8(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
- srd rG, rWORD8, rSHR
- sld rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP2x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 16(rSTR1)
ld rWORD2, 16(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
- srd rA, rWORD2, rSHR
- sld rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 24(rSTR1)
ld rWORD4, 24(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
bne cr5, L(duLcr5)
- srd rC, rWORD4, rSHR
- sld rF, rWORD4, rSHL
- or rWORD4, rC, rD
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
+#endif
cmpld cr1, rWORD3, rWORD4
b L(duLoop2)
- .align 4
+ .align 4
L(duP2x):
cmpld cr5, rWORD7, rWORD8
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 8
addi rSTR2, rSTR2, 8
+#endif
bne cr6, L(duLcr6)
sldi. rN, rN, 3
bne cr5, L(duLcr5)
cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD2, 8(rSTR2)
- srd rA, rWORD2, rSHR
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 24 */
- .align 4
+ .align 4
L(duP3):
- srd rC, rWORD8, rSHR
+ srd r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
ld rWORD3, 0(rSTR1)
- sld rF, rWORD8, rSHL
- or rWORD4, rC, rH
+#endif
+ sld rWORD4_SHIFT, rWORD8, rSHL
+ or rWORD4, r12, rWORD6_SHIFT
L(duP3e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 8(rSTR1)
ld rWORD6, 8(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
- srd rE, rWORD6, rSHR
- sld rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD7, 16(rSTR1)
ld rWORD8, 16(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
bne cr1, L(duLcr1)
- srd rG, rWORD8, rSHR
- sld rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
blt cr7, L(duP3x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 24(rSTR1)
ld rWORD2, 24(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
- srd rA, rWORD2, rSHR
- sld rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 16
addi rSTR2, rSTR2, 16
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
b L(duLoop1)
- .align 4
+ .align 4
L(duP3x):
+#ifndef __LITTLE_ENDIAN__
addi rSTR1, rSTR1, 16
addi rSTR2, rSTR2, 16
+#endif
+#if 0
+/* Huh? We've already branched on cr1! */
bne cr1, L(duLcr1)
+#endif
cmpld cr5, rWORD7, rWORD8
bne cr6, L(duLcr6)
sldi. rN, rN, 3
bne cr5, L(duLcr5)
cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD2, 8(rSTR2)
- srd rA, rWORD2, rSHR
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Count is a multiple of 32, remainder is 0 */
- .align 4
+ .align 4
L(duP4):
- mtctr rTMP /* Power4 wants mtctr 1st in dispatch group */
- srd rA, rWORD8, rSHR
+ mtctr r0 /* Power4 wants mtctr 1st in dispatch group */
+ srd r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
ld rWORD1, 0(rSTR1)
- sld rD, rWORD8, rSHL
- or rWORD2, rA, rH
+#endif
+ sld rWORD2_SHIFT, rWORD8, rSHL
+ or rWORD2, r0, rWORD6_SHIFT
L(duP4e):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 8(rSTR1)
ld rWORD4, 8(rSTR2)
- cmpld cr0, rWORD1, rWORD2
- srd rC, rWORD4, rSHR
- sld rF, rWORD4, rSHL
- or rWORD4, rC, rD
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 16(rSTR1)
ld rWORD6, 16(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
- bne cr0, L(duLcr0)
- srd rE, rWORD6, rSHR
- sld rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ bne cr7, L(duLcr7)
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ldu rWORD7, 24(rSTR1)
ldu rWORD8, 24(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
bne cr1, L(duLcr1)
- srd rG, rWORD8, rSHR
- sld rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
cmpld cr5, rWORD7, rWORD8
bdz- L(du24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
- .align 4
+ .align 4
L(duLoop):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD1, 8(rSTR1)
ld rWORD2, 8(rSTR2)
+#endif
cmpld cr1, rWORD3, rWORD4
bne cr6, L(duLcr6)
- srd rA, rWORD2, rSHR
- sld rD, rWORD2, rSHL
- or rWORD2, rA, rB
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
L(duLoop1):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD3, 16(rSTR1)
ld rWORD4, 16(rSTR2)
+#endif
cmpld cr6, rWORD5, rWORD6
bne cr5, L(duLcr5)
- srd rC, rWORD4, rSHR
- sld rF, rWORD4, rSHL
- or rWORD4, rC, rD
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
L(duLoop2):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD5, 24(rSTR1)
ld rWORD6, 24(rSTR2)
+#endif
cmpld cr5, rWORD7, rWORD8
- bne cr0, L(duLcr0)
- srd rE, rWORD6, rSHR
- sld rH, rWORD6, rSHL
- or rWORD6, rE, rF
+ bne cr7, L(duLcr7)
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
L(duLoop3):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
ldu rWORD7, 32(rSTR1)
ldu rWORD8, 32(rSTR2)
- cmpld cr0, rWORD1, rWORD2
+#endif
+ cmpld cr7, rWORD1, rWORD2
bne- cr1, L(duLcr1)
- srd rG, rWORD8, rSHR
- sld rB, rWORD8, rSHL
- or rWORD8, rG, rH
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
bdnz+ L(duLoop)
L(duL4):
+#if 0
+/* Huh? We've already branched on cr1! */
bne cr1, L(duLcr1)
+#endif
cmpld cr1, rWORD3, rWORD4
bne cr6, L(duLcr6)
cmpld cr6, rWORD5, rWORD6
bne cr5, L(duLcr5)
cmpld cr5, rWORD7, rWORD8
L(du44):
- bne cr0, L(duLcr0)
+ bne cr7, L(duLcr7)
L(du34):
bne cr1, L(duLcr1)
L(du24):
@@ -872,103 +1254,110 @@ L(du14):
bne cr5, L(duLcr5)
/* At this point we have a remainder of 1 to 7 bytes to compare. We use
shift right double to eliminate bits beyond the compare length.
- This allows the use of double word subtract to compute the final
- result.
However it may not be safe to load rWORD2 which may be beyond the
string length. So we compare the bit length of the remainder to
the right shift count (rSHR). If the bit count is less than or equal
we do not need to load rWORD2 (all significant bits are already in
- rB). */
+ rWORD8_SHIFT). */
cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA, 0
+ li r0, 0
ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
ld rWORD2, 8(rSTR2)
- srd rA, rWORD2, rSHR
- .align 4
+#endif
+ srd r0, rWORD2, rSHR
+ .align 4
L(dutrim):
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+#else
ld rWORD1, 8(rSTR1)
- ld rWORD8,-8(r1)
+#endif
+ ld rWORD8, -8(r1)
subfic rN, rN, 64 /* Shift count is 64 - (rN * 8). */
- or rWORD2, rA, rB
- ld rWORD7,-16(r1)
- ld r29,-24(r1)
+ or rWORD2, r0, rWORD8_SHIFT
+ ld rWORD7, -16(r1)
+ ld rSHL, -24(r1)
srd rWORD1, rWORD1, rN
srd rWORD2, rWORD2, rN
- ld r28,-32(r1)
- ld r27,-40(r1)
+ ld rSHR, -32(r1)
+ ld rWORD8_SHIFT, -40(r1)
li rRTN, 0
- cmpld cr0, rWORD1, rWORD2
- ld r26,-48(r1)
- ld r25,-56(r1)
- beq cr0, L(dureturn24)
+ cmpld cr7, rWORD1, rWORD2
+ ld rWORD2_SHIFT, -48(r1)
+ ld rWORD4_SHIFT, -56(r1)
+ beq cr7, L(dureturn24)
li rRTN, 1
- ld r24,-64(r1)
- bgtlr cr0
+ ld rWORD6_SHIFT, -64(r1)
+ bgtlr cr7
li rRTN, -1
blr
- .align 4
-L(duLcr0):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ .align 4
+L(duLcr7):
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
li rRTN, 1
- bgt cr0, L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
+ bgt cr7, L(dureturn29)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr1):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
li rRTN, 1
bgt cr1, L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr6):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
li rRTN, 1
bgt cr6, L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
li rRTN, -1
b L(dureturn27)
- .align 4
+ .align 4
L(duLcr5):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
li rRTN, 1
bgt cr5, L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
li rRTN, -1
b L(dureturn27)
.align 3
L(duZeroReturn):
- li rRTN,0
+ li rRTN, 0
.align 4
L(dureturn):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
L(dureturn29):
- ld r29,-24(r1)
- ld r28,-32(r1)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
L(dureturn27):
- ld r27,-40(r1)
+ ld rWORD8_SHIFT, -40(r1)
L(dureturn26):
- ld r26,-48(r1)
+ ld rWORD2_SHIFT, -48(r1)
L(dureturn25):
- ld r25,-56(r1)
+ ld rWORD4_SHIFT, -56(r1)
L(dureturn24):
- ld r24,-64(r1)
+ ld rWORD6_SHIFT, -64(r1)
blr
L(duzeroLength):
- li rRTN,0
+ li rRTN, 0
blr
END (memcmp)
diff --git a/libc/sysdeps/powerpc/powerpc64/power4/memcpy.S b/libc/sysdeps/powerpc/powerpc64/power4/memcpy.S
index 4317c7e78..f9a7260dc 100644
--- a/libc/sysdeps/powerpc/powerpc64/power4/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/power4/memcpy.S
@@ -214,15 +214,28 @@ EALIGN (memcpy, 5, 0)
blt cr6,5f
srdi 7,6,16
bgt cr6,3f
+#ifdef __LITTLE_ENDIAN__
+ sth 7,0(3)
+#else
sth 6,0(3)
+#endif
b 7f
.align 4
3:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,24
+ stb 6,0(3)
+ sth 7,1(3)
+#else
stb 7,0(3)
sth 6,1(3)
+#endif
b 7f
.align 4
5:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,8
+#endif
stb 6,0(3)
7:
cmpldi cr1,10,16
@@ -334,13 +347,23 @@ EALIGN (memcpy, 5, 0)
bf 30,1f
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
sld 0,6,10
srd 8,7,9
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srd 0,7,10
+ sld 8,6,9
+#else
sld 0,7,10
srd 8,6,9
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -349,8 +372,13 @@ EALIGN (memcpy, 5, 0)
blt cr6,8f /* if total DWs = 3, then bypass loop */
bf 31,4f
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
sld 0,6,10
srd 8,7,9
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -361,8 +389,13 @@ EALIGN (memcpy, 5, 0)
b 4f
.align 4
1:
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
sld 0,6,10
srd 8,7,9
+#endif
addi 5,5,16
or 0,0,8
bf 31,4f
@@ -373,23 +406,44 @@ EALIGN (memcpy, 5, 0)
addi 4,4,8
.align 4
/* copy 32 bytes at a time */
-4: sld 0,6,10
+4:
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
+ sld 0,6,10
srd 8,7,9
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srd 0,7,10
+ sld 8,6,9
+#else
sld 0,7,10
srd 8,6,9
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
sld 0,6,10
srd 8,7,9
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srd 0,7,10
+ sld 8,6,9
+#else
sld 0,7,10
srd 8,6,9
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -399,8 +453,13 @@ EALIGN (memcpy, 5, 0)
.align 4
8:
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srd 0,6,10
+ sld 8,7,9
+#else
sld 0,6,10
srd 8,7,9
+#endif
or 0,0,8
std 0,0(4)
3:
diff --git a/libc/sysdeps/powerpc/powerpc64/power4/memset.S b/libc/sysdeps/powerpc/powerpc64/power4/memset.S
index dbecee8b9..ad0d38128 100644
--- a/libc/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/libc/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -50,14 +50,14 @@ L(_memset):
/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
@@ -79,14 +79,14 @@ L(g0):
/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -146,24 +146,24 @@ L(zloopstart):
L(getCacheAligned):
cmpldi cr1,rLEN,32
andi. rTMP,rMEMP,127
- blt cr1,L(handletail32)
- beq L(cacheAligned)
+ blt cr1,L(handletail32)
+ beq L(cacheAligned)
addi rMEMP,rMEMP,32
addi rLEN,rLEN,-32
- std rCHR,-32(rMEMP)
- std rCHR,-24(rMEMP)
- std rCHR,-16(rMEMP)
- std rCHR,-8(rMEMP)
- b L(getCacheAligned)
+ std rCHR,-32(rMEMP)
+ std rCHR,-24(rMEMP)
+ std rCHR,-16(rMEMP)
+ std rCHR,-8(rMEMP)
+ b L(getCacheAligned)
/* Now we are aligned to the cache line and can use dcbz. */
L(cacheAligned):
cmpld cr1,rLEN,rCLS
- blt cr1,L(handletail32)
+ blt cr1,L(handletail32)
dcbz 0,rMEMP
subf rLEN,rCLS,rLEN
- add rMEMP,rMEMP,rCLS
- b L(cacheAligned)
+ add rMEMP,rMEMP,rCLS
+ b L(cacheAligned)
/* We are here because the cache line size was set and was not 32-bytes
and the remainder (rLEN) is less than the actual cache line size.
@@ -200,7 +200,7 @@ L(le4):
/* Memset of 0-31 bytes. */
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
diff --git a/libc/sysdeps/powerpc/powerpc64/power4/strncmp.S b/libc/sysdeps/powerpc/powerpc64/power4/strncmp.S
index 1276e16a5..5d136cfa2 100644
--- a/libc/sysdeps/powerpc/powerpc64/power4/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/power4/strncmp.S
@@ -25,7 +25,7 @@
EALIGN (strncmp, 4, 0)
CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -38,6 +38,7 @@ EALIGN (strncmp, 4, 0)
#define r7F7F r9 /* constant 0x7f7f7f7f7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -79,12 +80,59 @@ L(g1): add rTMP, rFEFE, rWORD1
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
+ beq cr1, L(equal)
+ andc rTMP2, rTMP2, rTMP
+ rldimi rTMP2, rTMP2, 1, 0
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ cmpd cr1, rWORD1, rWORD2
+ beq cr1, L(equal)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63 /* must return an int. */
+ ori rRTN, rRTN, 1
+ blr
+L(equal):
+ li rRTN, 0
+ blr
+
+L(different):
+ ld rWORD1, -8(rSTR1)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63
+ ori rRTN, rRTN, 1
+ blr
+L(highbit):
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
+ blr
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -93,7 +141,7 @@ L(endstring):
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
L(equal):
@@ -101,7 +149,7 @@ L(equal):
blr
L(different):
- ldu rWORD1, -8(rSTR1)
+ ld rWORD1, -8(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
@@ -109,11 +157,10 @@ L(different):
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/power6/memcpy.S b/libc/sysdeps/powerpc/powerpc64/power6/memcpy.S
index d6d242d29..e3f3d8a30 100644
--- a/libc/sysdeps/powerpc/powerpc64/power6/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/power6/memcpy.S
@@ -400,15 +400,28 @@ L(das_tail2):
blt cr6,5f
srdi 7,6,16
bgt cr6,3f
+#ifdef __LITTLE_ENDIAN__
+ sth 7,0(3)
+#else
sth 6,0(3)
+#endif
b 7f
.align 4
3:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,24
+ stb 6,0(3)
+ sth 7,1(3)
+#else
stb 7,0(3)
sth 6,1(3)
+#endif
b 7f
.align 4
5:
+#ifdef __LITTLE_ENDIAN__
+ rotlwi 6,6,8
+#endif
stb 6,0(3)
7:
cmpldi cr1,10,16
@@ -595,13 +608,24 @@ L(du1_do):
bf 30,L(du1_1dw)
/* there are at least two DWs to copy */
+ /* FIXME: can combine last shift and "or" into "rldimi" */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 8
+ sldi 8,6, 64-8
+#else
sldi 0,7, 8
srdi 8,6, 64-8
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -610,8 +634,13 @@ L(du1_do):
blt cr6,L(du1_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du1_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -622,8 +651,13 @@ L(du1_do):
b L(du1_loop)
.align 4
L(du1_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du1_loop)
@@ -635,23 +669,43 @@ L(du1_1dw):
.align 4
/* copy 32 bytes at a time */
L(du1_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 8
+ sldi 8,6, 64-8
+#else
sldi 0,7, 8
srdi 8,6, 64-8
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 8
+ sldi 8,6, 64-8
+#else
sldi 0,7, 8
srdi 8,6, 64-8
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -661,8 +715,13 @@ L(du1_loop):
.align 4
L(du1_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 8
+ sldi 8,7, 64-8
+#else
sldi 0,6, 8
srdi 8,7, 64-8
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -672,13 +731,23 @@ L(du2_do):
bf 30,L(du2_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 16
+ sldi 8,6, 64-16
+#else
sldi 0,7, 16
srdi 8,6, 64-16
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -687,8 +756,13 @@ L(du2_do):
blt cr6,L(du2_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du2_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -699,8 +773,13 @@ L(du2_do):
b L(du2_loop)
.align 4
L(du2_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du2_loop)
@@ -712,23 +791,43 @@ L(du2_1dw):
.align 4
/* copy 32 bytes at a time */
L(du2_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 16
+ sldi 8,6, 64-16
+#else
sldi 0,7, 16
srdi 8,6, 64-16
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 16
+ sldi 8,6, 64-16
+#else
sldi 0,7, 16
srdi 8,6, 64-16
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -738,8 +837,13 @@ L(du2_loop):
.align 4
L(du2_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 16
+ sldi 8,7, 64-16
+#else
sldi 0,6, 16
srdi 8,7, 64-16
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -749,13 +853,23 @@ L(du3_do):
bf 30,L(du3_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 24
+ sldi 8,6, 64-24
+#else
sldi 0,7, 24
srdi 8,6, 64-24
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -764,8 +878,13 @@ L(du3_do):
blt cr6,L(du3_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du3_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -776,8 +895,13 @@ L(du3_do):
b L(du3_loop)
.align 4
L(du3_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du3_loop)
@@ -789,23 +913,43 @@ L(du3_1dw):
.align 4
/* copy 32 bytes at a time */
L(du3_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 24
+ sldi 8,6, 64-24
+#else
sldi 0,7, 24
srdi 8,6, 64-24
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 24
+ sldi 8,6, 64-24
+#else
sldi 0,7, 24
srdi 8,6, 64-24
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -815,8 +959,13 @@ L(du3_loop):
.align 4
L(du3_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 24
+ sldi 8,7, 64-24
+#else
sldi 0,6, 24
srdi 8,7, 64-24
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -832,13 +981,23 @@ L(du4_dox):
bf 30,L(du4_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 32
+ sldi 8,6, 64-32
+#else
sldi 0,7, 32
srdi 8,6, 64-32
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -847,8 +1006,13 @@ L(du4_dox):
blt cr6,L(du4_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du4_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -859,8 +1023,13 @@ L(du4_dox):
b L(du4_loop)
.align 4
L(du4_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du4_loop)
@@ -872,23 +1041,43 @@ L(du4_1dw):
.align 4
/* copy 32 bytes at a time */
L(du4_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 32
+ sldi 8,6, 64-32
+#else
sldi 0,7, 32
srdi 8,6, 64-32
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 32
+ sldi 8,6, 64-32
+#else
sldi 0,7, 32
srdi 8,6, 64-32
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -898,8 +1087,13 @@ L(du4_loop):
.align 4
L(du4_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 32
+ sldi 8,7, 64-32
+#else
sldi 0,6, 32
srdi 8,7, 64-32
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -909,13 +1103,23 @@ L(du5_do):
bf 30,L(du5_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 40
+ sldi 8,6, 64-40
+#else
sldi 0,7, 40
srdi 8,6, 64-40
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -924,8 +1128,13 @@ L(du5_do):
blt cr6,L(du5_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du5_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -936,8 +1145,13 @@ L(du5_do):
b L(du5_loop)
.align 4
L(du5_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du5_loop)
@@ -949,23 +1163,43 @@ L(du5_1dw):
.align 4
/* copy 32 bytes at a time */
L(du5_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 40
+ sldi 8,6, 64-40
+#else
sldi 0,7, 40
srdi 8,6, 64-40
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 40
+ sldi 8,6, 64-40
+#else
sldi 0,7, 40
srdi 8,6, 64-40
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -975,8 +1209,13 @@ L(du5_loop):
.align 4
L(du5_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 40
+ sldi 8,7, 64-40
+#else
sldi 0,6, 40
srdi 8,7, 64-40
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -986,13 +1225,23 @@ L(du6_do):
bf 30,L(du6_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 48
+ sldi 8,6, 64-48
+#else
sldi 0,7, 48
srdi 8,6, 64-48
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -1001,8 +1250,13 @@ L(du6_do):
blt cr6,L(du6_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du6_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -1013,8 +1267,13 @@ L(du6_do):
b L(du6_loop)
.align 4
L(du6_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du6_loop)
@@ -1026,23 +1285,43 @@ L(du6_1dw):
.align 4
/* copy 32 bytes at a time */
L(du6_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 48
+ sldi 8,6, 64-48
+#else
sldi 0,7, 48
srdi 8,6, 64-48
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 48
+ sldi 8,6, 64-48
+#else
sldi 0,7, 48
srdi 8,6, 64-48
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -1052,8 +1331,13 @@ L(du6_loop):
.align 4
L(du6_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 48
+ sldi 8,7, 64-48
+#else
sldi 0,6, 48
srdi 8,7, 64-48
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
@@ -1063,13 +1347,23 @@ L(du7_do):
bf 30,L(du7_1dw)
/* there are at least two DWs to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
or 0,0,8
ld 6,16(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 56
+ sldi 8,6, 64-56
+#else
sldi 0,7, 56
srdi 8,6, 64-56
+#endif
or 0,0,8
ld 7,24(5)
std 0,8(4)
@@ -1078,8 +1372,13 @@ L(du7_do):
blt cr6,L(du7_fini) /* if total DWs = 3, then bypass loop */
bf 31,L(du7_loop)
/* there is a third DW to copy */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
or 0,0,8
std 0,0(4)
mr 6,7
@@ -1090,8 +1389,13 @@ L(du7_do):
b L(du7_loop)
.align 4
L(du7_1dw):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
addi 5,5,16
or 0,0,8
bf 31,L(du7_loop)
@@ -1103,23 +1407,43 @@ L(du7_1dw):
.align 4
/* copy 32 bytes at a time */
L(du7_loop):
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
or 0,0,8
ld 6,0(5)
std 0,0(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 56
+ sldi 8,6, 64-56
+#else
sldi 0,7, 56
srdi 8,6, 64-56
+#endif
or 0,0,8
ld 7,8(5)
std 0,8(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
or 0,0,8
ld 6,16(5)
std 0,16(4)
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,7, 56
+ sldi 8,6, 64-56
+#else
sldi 0,7, 56
srdi 8,6, 64-56
+#endif
or 0,0,8
ld 7,24(5)
std 0,24(4)
@@ -1129,8 +1453,13 @@ L(du7_loop):
.align 4
L(du7_fini):
/* calculate and store the final DW */
+#ifdef __LITTLE_ENDIAN__
+ srdi 0,6, 56
+ sldi 8,7, 64-56
+#else
sldi 0,6, 56
srdi 8,7, 64-56
+#endif
or 0,0,8
std 0,0(4)
b L(du_done)
diff --git a/libc/sysdeps/powerpc/powerpc64/power6/memset.S b/libc/sysdeps/powerpc/powerpc64/power6/memset.S
index 3e8ae2d25..d61988a19 100644
--- a/libc/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/libc/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -47,14 +47,14 @@ L(_memset):
/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
@@ -76,14 +76,14 @@ L(g0):
/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -344,7 +344,7 @@ L(le4):
/* Memset of 0-31 bytes. */
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S b/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
index d0071c765..ebec0e0ba 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
@@ -39,10 +39,8 @@ EALIGN (__finite, 4, 0)
stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
-
- lhz r4,-16(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
clrlwi r4,r4,17 /* r4 = abs(r4). */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
bltlr cr7 /* LT means finite, other non-finite. */
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S b/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
index 1aea12383..8d088db5a 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
@@ -38,9 +38,8 @@ EALIGN (__isinf, 4, 0)
stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r4,-16(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
beqlr cr7 /* EQ means INF, otherwise -INF. */
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memchr.S b/libc/sysdeps/powerpc/powerpc64/power7/memchr.S
index 3416897f5..5076dd0c1 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memchr.S
@@ -25,109 +25,112 @@ ENTRY (__memchr)
CALL_MCOUNT 2
dcbt 0,r3
clrrdi r8,r3,3
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
add r7,r3,r5 /* Calculate the last acceptable address. */
+ insrdi r4,r4,16,32
cmpldi r5,32
+ li r9, -1
+ rlwinm r6,r3,3,26,28 /* Calculate padding. */
insrdi r4,r4,32,0
+ addi r7,r7,-1
+#ifdef __LITTLE_ENDIAN__
+ sld r9,r9,r6
+#else
+ srd r9,r9,r6
+#endif
ble L(small_range)
- cmpld cr7,r3,r7 /* Compare the starting address (r3) with the
- ending address (r7). If (r3 >= r7),
- the size passed in was zero or negative. */
- ble cr7,L(proceed)
-
- li r7,-1 /* Artificially set our ending address (r7)
- such that we will exit early. */
-
-L(proceed):
- rlwinm r6,r3,3,26,28 /* Calculate padding. */
- cmpldi cr6,r6,0 /* cr6 == Do we have padding? */
ld r12,0(r8) /* Load doubleword from memory. */
- cmpb r10,r12,r4 /* Check for BYTEs in DWORD1. */
- beq cr6,L(proceed_no_padding)
- sld r10,r10,r6
- srd r10,r10,r6
-L(proceed_no_padding):
- cmpldi cr7,r10,0 /* Does r10 indicate we got a hit? */
+ cmpb r3,r12,r4 /* Check for BYTEs in DWORD1. */
+ and r3,r3,r9
+ clrldi r5,r7,61 /* Byte count - 1 in last dword. */
+ clrrdi r7,r7,3 /* Address of last doubleword. */
+ cmpldi cr7,r3,0 /* Does r3 indicate we got a hit? */
bne cr7,L(done)
- /* See if we are at the last acceptable address yet. */
- addi r9,r8,8
- cmpld cr6,r9,r7
- bge cr6,L(null)
-
mtcrf 0x01,r8
/* Are we now aligned to a quadword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
-
bt 28,L(loop_setup)
/* Handle DWORD2 of pair. */
ldu r12,8(r8)
- cmpb r10,r12,r4
- cmpldi cr7,r10,0
+ cmpb r3,r12,r4
+ cmpldi cr7,r3,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,8
- cmpld cr6,r9,r7
- bge cr6,L(null)
-
L(loop_setup):
- sub r5,r7,r9
- srdi r6,r5,4 /* Number of loop iterations. */
+ /* The last dword we want to read in the loop below is the one
+ containing the last byte of the string, ie. the dword at
+ (s + size - 1) & ~7, or r7. The first dword read is at
+ r8 + 8, we read 2 * cnt dwords, so the last dword read will
+ be at r8 + 8 + 16 * cnt - 8. Solving for cnt gives
+ cnt = (r7 - r8) / 16 */
+ sub r6,r7,r8
+ srdi r6,r6,4 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for BYTE backwards in the string. Since
- it's a small loop (< 8 instructions), align it to 32-bytes. */
- .p2align 5
+
+ /* Main loop to look for BYTE in the string. Since
+ it's a small loop (8 instructions), align it to 32-bytes. */
+ .align 5
L(loop):
/* Load two doublewords, compare and merge in a
single register for speed. This is an attempt
to speed up the byte-checking process for bigger strings. */
ld r12,8(r8)
ldu r11,16(r8)
- cmpb r10,r12,r4
+ cmpb r3,r12,r4
cmpb r9,r11,r4
- or r5,r9,r10 /* Merge everything in one doubleword. */
- cmpldi cr7,r5,0
+ or r6,r9,r3 /* Merge everything in one doubleword. */
+ cmpldi cr7,r6,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for BYTE in the whole range. */
- subi r11,r7,8
- cmpld cr6,r8,r11
- blt cr6,L(loop_small)
- b L(null)
+ /* We may have one more dword to read. */
+ cmpld r8,r7
+ beqlr
+ ldu r12,8(r8)
+ cmpb r3,r12,r4
+ cmpldi cr6,r3,0
+ bne cr6,L(done)
+ blr
+
+ .align 4
+L(found):
/* OK, one (or both) of the doublewords contains BYTE. Check
the first doubleword and decrement the address in case the first
doubleword really contains BYTE. */
- .align 4
-L(found):
- cmpldi cr6,r10,0
+ cmpldi cr6,r3,0
addi r8,r8,-8
bne cr6,L(done)
/* BYTE must be in the second doubleword. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
+ again and move the result of cmpb to r3 so we can calculate the
pointer. */
- mr r10,r9
+ mr r3,r9
addi r8,r8,8
- /* r10 has the output of the cmpb instruction, that is, it contains
+ /* r3 has the output of the cmpb instruction, that is, it contains
0xff in the same position as BYTE in the original
doubleword from the string. Use that to calculate the pointer.
We need to make sure BYTE is *before* the end of the range. */
L(done):
- cntlzd r0,r10 /* Count leading zeroes before the match. */
- srdi r0,r0,3 /* Convert leading zeroes to bytes. */
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r3,-1
+ andc r0,r0,r3
+ popcntd r0,r0 /* Count trailing zeros. */
+#else
+ cntlzd r0,r3 /* Count leading zeros before the match. */
+#endif
+ cmpld r8,r7 /* Are we on the last dword? */
+ srdi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
add r3,r8,r0
- cmpld r3,r7
- bge L(null)
+ cmpld cr7,r0,r5 /* If on the last dword, check byte offset. */
+ bnelr
+ blelr cr7
+ li r3,0
blr
.align 4
@@ -139,67 +142,44 @@ L(null):
.align 4
L(small_range):
cmpldi r5,0
- rlwinm r6,r3,3,26,28 /* Calculate padding. */
- beq L(null) /* This branch is for the cmpldi r5,0 above. */
+ beq L(null)
ld r12,0(r8) /* Load word from memory. */
- cmpldi cr6,r6,0 /* cr6 == Do we have padding? */
- cmpb r10,r12,r4 /* Check for BYTE in DWORD1. */
- /* If no padding, skip the shifts. */
- beq cr6,L(small_no_padding)
- sld r10,r10,r6
- srd r10,r10,r6
-L(small_no_padding):
- cmpldi cr7,r10,0
+ cmpb r3,r12,r4 /* Check for BYTE in DWORD1. */
+ and r3,r3,r9
+ cmpldi cr7,r3,0
+ clrldi r5,r7,61 /* Byte count - 1 in last dword. */
+ clrrdi r7,r7,3 /* Address of last doubleword. */
+ cmpld r8,r7 /* Are we done already? */
bne cr7,L(done)
+ beqlr
- /* Are we done already? */
- addi r9,r8,8
- cmpld r9,r7
- bge L(null)
- /* If we're not done, drop through into loop_small. */
-
-L(loop_small): /* loop_small has been unrolled. */
ldu r12,8(r8)
- cmpb r10,r12,r4
- addi r9,r8,8
- cmpldi cr6,r10,0
- cmpld r9,r7
+ cmpb r3,r12,r4
+ cmpldi cr6,r3,0
+ cmpld r8,r7
bne cr6,L(done) /* Found something. */
- bge L(null) /* Hit end of string (length). */
+ beqlr /* Hit end of string (length). */
ldu r12,8(r8)
- cmpb r10,r12,r4
- addi r9,r8,8
- cmpldi cr6,r10,0
- cmpld r9,r7
- bne cr6,L(done) /* Found something. */
- bge L(null)
+ cmpb r3,r12,r4
+ cmpldi cr6,r3,0
+ cmpld r8,r7
+ bne cr6,L(done)
+ beqlr
ldu r12,8(r8)
- subi r11,r7,8
- cmpb r10,r12,r4
- cmpldi cr6,r10,0
- ori r2,r2,0 /* Force a dispatch group. */
+ cmpb r3,r12,r4
+ cmpldi cr6,r3,0
+ cmpld r8,r7
bne cr6,L(done)
+ beqlr
- cmpld r8,r11 /* At end of range? */
- bge L(null)
-
- /* For most cases we will never get here. Under some combinations of
- padding + length there is a leftover double that still needs to be
- checked. */
ldu r12,8(r8)
- cmpb r10,r12,r4
- addi r9,r8,8
- cmpldi cr6,r10,0
- cmpld r9,r7
- bne cr6,L(done) /* Found something. */
-
- /* Save a branch and exit directly. */
- li r3,0
+ cmpb r3,r12,r4
+ cmpldi cr6,r3,0
+ bne cr6,L(done)
blr
-
END (__memchr)
weak_alias (__memchr, memchr)
libc_hidden_builtin_def (memchr)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memcmp.S b/libc/sysdeps/powerpc/powerpc64/power7/memcmp.S
index f190c6461..6851cdc75 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memcmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memcmp.S
@@ -23,10 +23,9 @@
size_t size [r5]) */
.machine power7
-EALIGN (memcmp,4,0)
+EALIGN (memcmp, 4, 0)
CALL_MCOUNT 3
-#define rTMP r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -37,354 +36,557 @@ EALIGN (memcmp,4,0)
#define rWORD4 r9 /* next word in s2 */
#define rWORD5 r10 /* next word in s1 */
#define rWORD6 r11 /* next word in s2 */
-#define rBITDIF r12 /* bits that differ in s1 & s2 words */
#define rWORD7 r30 /* next word in s1 */
#define rWORD8 r31 /* next word in s2 */
- xor rTMP,rSTR2,rSTR1
- cmpldi cr6,rN,0
- cmpldi cr1,rN,12
- clrldi. rTMP,rTMP,61
- clrldi rBITDIF,rSTR1,61
- cmpldi cr5,rBITDIF,0
- beq- cr6,L(zeroLength)
- dcbt 0,rSTR1
- dcbt 0,rSTR2
+ xor r0, rSTR2, rSTR1
+ cmpldi cr6, rN, 0
+ cmpldi cr1, rN, 12
+ clrldi. r0, r0, 61
+ clrldi r12, rSTR1, 61
+ cmpldi cr5, r12, 0
+ beq- cr6, L(zeroLength)
+ dcbt 0, rSTR1
+ dcbt 0, rSTR2
/* If less than 8 bytes or not aligned, use the unaligned
byte loop. */
- blt cr1,L(bytealigned)
- std rWORD8,-8(r1)
- cfi_offset(rWORD8,-8)
- std rWORD7,-16(r1)
- cfi_offset(rWORD7,-16)
+ blt cr1, L(bytealigned)
+ std rWORD8, -8(r1)
+ cfi_offset(rWORD8, -8)
+ std rWORD7, -16(r1)
+ cfi_offset(rWORD7, -16)
bne L(unaligned)
/* At this point we know both strings have the same alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
3 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then we are already double word
- aligned and can perform the DWaligned loop.
+ of r12 to 0. If r12 == 0 then we are already double word
+ aligned and can perform the DW aligned loop.
Otherwise we know the two strings have the same alignment (but not
- yet DW). So we can force the string addresses to the next lower DW
- boundary and special case this first DW word using shift left to
+ yet DW). So we force the string addresses to the next lower DW
+ boundary and special case this first DW using shift left to
eliminate bits preceding the first byte. Since we want to join the
- normal (DWaligned) compare loop, starting at the second double word,
+ normal (DW aligned) compare loop, starting at the second double word,
we need to adjust the length (rN) and special case the loop
- versioning for the first DW. This insures that the loop count is
- correct and the first DW (shifted) is in the expected resister pair. */
+ versioning for the first DW. This ensures that the loop count is
+ correct and the first DW (shifted) is in the expected register pair. */
.align 4
L(samealignment):
- clrrdi rSTR1,rSTR1,3
- clrrdi rSTR2,rSTR2,3
- beq cr5,L(DWaligned)
- add rN,rN,rBITDIF
- sldi r11,rBITDIF,3
- srdi rTMP,rN,5 /* Divide by 32 */
- andi. rBITDIF,rN,24 /* Get the DW remainder */
- ld rWORD1,0(rSTR1)
- ld rWORD2,0(rSTR2)
- cmpldi cr1,rBITDIF,16
- cmpldi cr7,rN,32
- clrldi rN,rN,61
+ clrrdi rSTR1, rSTR1, 3
+ clrrdi rSTR2, rSTR2, 3
+ beq cr5, L(DWaligned)
+ add rN, rN, r12
+ sldi rWORD6, r12, 3
+ srdi r0, rN, 5 /* Divide by 32 */
+ andi. r12, rN, 24 /* Get the DW remainder */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 0(rSTR1)
+ ld rWORD2, 0(rSTR2)
+#endif
+ cmpldi cr1, r12, 16
+ cmpldi cr7, rN, 32
+ clrldi rN, rN, 61
beq L(dPs4)
- mtctr rTMP
- bgt cr1,L(dPs3)
- beq cr1,L(dPs2)
+ mtctr r0
+ bgt cr1, L(dPs3)
+ beq cr1, L(dPs2)
/* Remainder is 8 */
.align 3
L(dsP1):
- sld rWORD5,rWORD1,r11
- sld rWORD6,rWORD2,r11
- cmpld cr5,rWORD5,rWORD6
- blt cr7,L(dP1x)
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD2, rWORD6
+ cmpld cr5, rWORD5, rWORD6
+ blt cr7, L(dP1x)
/* Do something useful in this cycle since we have to branch anyway. */
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- cmpld cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
b L(dP1e)
/* Remainder is 16 */
.align 4
L(dPs2):
- sld rWORD5,rWORD1,r11
- sld rWORD6,rWORD2,r11
- cmpld cr6,rWORD5,rWORD6
- blt cr7,L(dP2x)
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD2, rWORD6
+ cmpld cr6, rWORD5, rWORD6
+ blt cr7, L(dP2x)
/* Do something useful in this cycle since we have to branch anyway. */
- ld rWORD7,8(rSTR1)
- ld rWORD8,8(rSTR2)
- cmpld cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD7, 8(rSTR1)
+ ld rWORD8, 8(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
b L(dP2e)
/* Remainder is 24 */
.align 4
L(dPs3):
- sld rWORD3,rWORD1,r11
- sld rWORD4,rWORD2,r11
- cmpld cr1,rWORD3,rWORD4
+ sld rWORD3, rWORD1, rWORD6
+ sld rWORD4, rWORD2, rWORD6
+ cmpld cr1, rWORD3, rWORD4
b L(dP3e)
/* Count is a multiple of 32, remainder is 0 */
.align 4
L(dPs4):
- mtctr rTMP
- sld rWORD1,rWORD1,r11
- sld rWORD2,rWORD2,r11
- cmpld cr0,rWORD1,rWORD2
+ mtctr r0
+ sld rWORD1, rWORD1, rWORD6
+ sld rWORD2, rWORD2, rWORD6
+ cmpld cr7, rWORD1, rWORD2
b L(dP4e)
/* At this point we know both strings are double word aligned and the
compare length is at least 8 bytes. */
.align 4
L(DWaligned):
- andi. rBITDIF,rN,24 /* Get the DW remainder */
- srdi rTMP,rN,5 /* Divide by 32 */
- cmpldi cr1,rBITDIF,16
- cmpldi cr7,rN,32
- clrldi rN,rN,61
+ andi. r12, rN, 24 /* Get the DW remainder */
+ srdi r0, rN, 5 /* Divide by 32 */
+ cmpldi cr1, r12, 16
+ cmpldi cr7, rN, 32
+ clrldi rN, rN, 61
beq L(dP4)
- bgt cr1,L(dP3)
- beq cr1,L(dP2)
+ bgt cr1, L(dP3)
+ beq cr1, L(dP2)
/* Remainder is 8 */
.align 4
L(dP1):
- mtctr rTMP
+ mtctr r0
/* Normally we'd use rWORD7/rWORD8 here, but since we might exit early
(8-15 byte compare), we want to use only volatile registers. This
means we can avoid restoring non-volatile registers since we did not
change any on the early exit path. The key here is the non-early
exit path only cares about the condition code (cr5), not about which
register pair was used. */
- ld rWORD5,0(rSTR1)
- ld rWORD6,0(rSTR2)
- cmpld cr5,rWORD5,rWORD6
- blt cr7,L(dP1x)
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- cmpld cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 0(rSTR1)
+ ld rWORD6, 0(rSTR2)
+#endif
+ cmpld cr5, rWORD5, rWORD6
+ blt cr7, L(dP1x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
L(dP1e):
- ld rWORD3,16(rSTR1)
- ld rWORD4,16(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- ld rWORD5,24(rSTR1)
- ld rWORD6,24(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
- bne cr0,L(dLcr0)
-
- ldu rWORD7,32(rSTR1)
- ldu rWORD8,32(rSTR2)
- bne cr1,L(dLcr1)
- cmpld cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 16(rSTR1)
+ ld rWORD4, 16(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 24(rSTR1)
+ ld rWORD6, 24(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5x)
+ bne cr7, L(dLcr7x)
+
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ldu rWORD7, 32(rSTR1)
+ ldu rWORD8, 32(rSTR2)
+#endif
+ bne cr1, L(dLcr1)
+ cmpld cr5, rWORD7, rWORD8
bdnz L(dLoop)
- bne cr6,L(dLcr6)
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ bne cr6, L(dLcr6)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
.align 3
L(dP1x):
- sldi. r12,rN,3
- bne cr5,L(dLcr5)
- subfic rN,r12,64 /* Shift count is 64 - (rN * 8). */
+ sldi. r12, rN, 3
+ bne cr5, L(dLcr5x)
+ subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Remainder is 16 */
.align 4
L(dP2):
- mtctr rTMP
- ld rWORD5,0(rSTR1)
- ld rWORD6,0(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- blt cr7,L(dP2x)
- ld rWORD7,8(rSTR1)
- ld rWORD8,8(rSTR2)
- cmpld cr5,rWORD7,rWORD8
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 0(rSTR1)
+ ld rWORD6, 0(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ blt cr7, L(dP2x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD7, 8(rSTR1)
+ ld rWORD8, 8(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
L(dP2e):
- ld rWORD1,16(rSTR1)
- ld rWORD2,16(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- ld rWORD3,24(rSTR1)
- ld rWORD4,24(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr6,L(dLcr6)
- bne cr5,L(dLcr5)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 16(rSTR1)
+ ld rWORD2, 16(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 24(rSTR1)
+ ld rWORD4, 24(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ bne cr6, L(dLcr6)
+ bne cr5, L(dLcr5)
b L(dLoop2)
/* Again we are on a early exit path (16-23 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
.align 4
L(dP2x):
- ld rWORD3,8(rSTR1)
- ld rWORD4,8(rSTR2)
- cmpld cr5,rWORD3,rWORD4
- sldi. r12,rN,3
- bne cr6,L(dLcr6)
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr5,L(dLcr5)
- subfic rN,r12,64 /* Shift count is 64 - (rN * 8). */
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 8(rSTR1)
+ ld rWORD4, 8(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ sldi. r12, rN, 3
+ bne cr6, L(dLcr6x)
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ bne cr1, L(dLcr1x)
+ subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Remainder is 24 */
.align 4
L(dP3):
- mtctr rTMP
- ld rWORD3,0(rSTR1)
- ld rWORD4,0(rSTR2)
- cmpld cr1,rWORD3,rWORD4
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 0(rSTR1)
+ ld rWORD4, 0(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
L(dP3e):
- ld rWORD5,8(rSTR1)
- ld rWORD6,8(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- blt cr7,L(dP3x)
- ld rWORD7,16(rSTR1)
- ld rWORD8,16(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- ld rWORD1,24(rSTR1)
- ld rWORD2,24(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- addi rSTR1,rSTR1,16
- addi rSTR2,rSTR2,16
- bne cr1,L(dLcr1)
- bne cr6,L(dLcr6)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 8(rSTR1)
+ ld rWORD6, 8(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ blt cr7, L(dP3x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD7, 16(rSTR1)
+ ld rWORD8, 16(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 24(rSTR1)
+ ld rWORD2, 24(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 16
+ addi rSTR2, rSTR2, 16
+#endif
+ bne cr1, L(dLcr1)
+ bne cr6, L(dLcr6)
b L(dLoop1)
/* Again we are on a early exit path (24-31 byte compare), we want to
only use volatile registers and avoid restoring non-volatile
registers. */
.align 4
L(dP3x):
- ld rWORD1,16(rSTR1)
- ld rWORD2,16(rSTR2)
- cmpld cr5,rWORD1,rWORD2
- sldi. r12,rN,3
- bne cr1,L(dLcr1)
- addi rSTR1,rSTR1,16
- addi rSTR2,rSTR2,16
- bne cr6,L(dLcr6)
- subfic rN,r12,64 /* Shift count is 64 - (rN * 8). */
- bne cr5,L(dLcr5)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 16(rSTR1)
+ ld rWORD2, 16(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ sldi. r12, rN, 3
+ bne cr1, L(dLcr1x)
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 16
+ addi rSTR2, rSTR2, 16
+#endif
+ bne cr6, L(dLcr6x)
+ subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
+ bne cr7, L(dLcr7x)
bne L(d00)
- li rRTN,0
+ li rRTN, 0
blr
/* Count is a multiple of 32, remainder is 0 */
.align 4
L(dP4):
- mtctr rTMP
- ld rWORD1,0(rSTR1)
- ld rWORD2,0(rSTR2)
- cmpld cr0,rWORD1,rWORD2
+ mtctr r0
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 0(rSTR1)
+ ld rWORD2, 0(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
L(dP4e):
- ld rWORD3,8(rSTR1)
- ld rWORD4,8(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- ld rWORD5,16(rSTR1)
- ld rWORD6,16(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- ldu rWORD7,24(rSTR1)
- ldu rWORD8,24(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- bne cr0,L(dLcr0)
- bne cr1,L(dLcr1)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 8(rSTR1)
+ ld rWORD4, 8(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 16(rSTR1)
+ ld rWORD6, 16(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ldu rWORD7, 24(rSTR1)
+ ldu rWORD8, 24(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr7, L(dLcr7)
+ bne cr1, L(dLcr1)
bdz- L(d24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
.align 4
L(dLoop):
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- bne cr6,L(dLcr6)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ bne cr6, L(dLcr6)
L(dLoop1):
- ld rWORD3,16(rSTR1)
- ld rWORD4,16(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 16(rSTR1)
+ ld rWORD4, 16(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5)
L(dLoop2):
- ld rWORD5,24(rSTR1)
- ld rWORD6,24(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- bne cr0,L(dLcr0)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 24(rSTR1)
+ ld rWORD6, 24(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr7, L(dLcr7)
L(dLoop3):
- ldu rWORD7,32(rSTR1)
- ldu rWORD8,32(rSTR2)
- bne cr1,L(dLcr1)
- cmpld cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ldu rWORD7, 32(rSTR1)
+ ldu rWORD8, 32(rSTR2)
+#endif
+ bne cr1, L(dLcr1)
+ cmpld cr7, rWORD1, rWORD2
bdnz L(dLoop)
L(dL4):
- cmpld cr1,rWORD3,rWORD4
- bne cr6,L(dLcr6)
- cmpld cr6,rWORD5,rWORD6
- bne cr5,L(dLcr5)
- cmpld cr5,rWORD7,rWORD8
+ cmpld cr1, rWORD3, rWORD4
+ bne cr6, L(dLcr6)
+ cmpld cr6, rWORD5, rWORD6
+ bne cr5, L(dLcr5)
+ cmpld cr5, rWORD7, rWORD8
L(d44):
- bne cr0,L(dLcr0)
+ bne cr7, L(dLcr7)
L(d34):
- bne cr1,L(dLcr1)
+ bne cr1, L(dLcr1)
L(d24):
- bne cr6,L(dLcr6)
+ bne cr6, L(dLcr6)
L(d14):
- sldi. r12,rN,3
- bne cr5,L(dLcr5)
+ sldi. r12, rN, 3
+ bne cr5, L(dLcr5)
L(d04):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- subfic rN,r12,64 /* Shift count is 64 - (rN * 8). */
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ subfic rN, r12, 64 /* Shift count is 64 - (rN * 8). */
beq L(zeroLength)
/* At this point we have a remainder of 1 to 7 bytes to compare. Since
we are aligned it is safe to load the whole double word, and use
shift right double to eliminate bits beyond the compare length. */
L(d00):
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- srd rWORD1,rWORD1,rN
- srd rWORD2,rWORD2,rN
- cmpld cr5,rWORD1,rWORD2
- bne cr5,L(dLcr5x)
- li rRTN,0
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd rWORD1, rWORD1, rN
+ srd rWORD2, rWORD2, rN
+ cmpld cr7, rWORD1, rWORD2
+ bne cr7, L(dLcr7x)
+ li rRTN, 0
blr
+
.align 4
-L(dLcr0):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
- bgtlr cr0
- li rRTN,-1
+L(dLcr7):
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr7x):
+ li rRTN, 1
+ bgtlr cr7
+ li rRTN, -1
blr
.align 4
L(dLcr1):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr1x):
+ li rRTN, 1
bgtlr cr1
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
L(dLcr6):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+L(dLcr6x):
+ li rRTN, 1
bgtlr cr6
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
L(dLcr5):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
L(dLcr5x):
- li rRTN,1
+ li rRTN, 1
bgtlr cr5
- li rRTN,-1
+ li rRTN, -1
blr
.align 4
L(bytealigned):
mtctr rN
- beq cr6,L(zeroLength)
+#if 0
+/* Huh? We've already branched on cr6! */
+ beq cr6, L(zeroLength)
+#endif
/* We need to prime this loop. This loop is swing modulo scheduled
to avoid pipe delays. The dependent instruction latencies (load to
@@ -396,38 +598,38 @@ L(bytealigned):
So we must precondition some registers and condition codes so that
we don't exit the loop early on the first iteration. */
- lbz rWORD1,0(rSTR1)
- lbz rWORD2,0(rSTR2)
+ lbz rWORD1, 0(rSTR1)
+ lbz rWORD2, 0(rSTR2)
bdz L(b11)
- cmpld cr0,rWORD1,rWORD2
- lbz rWORD3,1(rSTR1)
- lbz rWORD4,1(rSTR2)
+ cmpld cr7, rWORD1, rWORD2
+ lbz rWORD3, 1(rSTR1)
+ lbz rWORD4, 1(rSTR2)
bdz L(b12)
- cmpld cr1,rWORD3,rWORD4
- lbzu rWORD5,2(rSTR1)
- lbzu rWORD6,2(rSTR2)
+ cmpld cr1, rWORD3, rWORD4
+ lbzu rWORD5, 2(rSTR1)
+ lbzu rWORD6, 2(rSTR2)
bdz L(b13)
.align 4
L(bLoop):
- lbzu rWORD1,1(rSTR1)
- lbzu rWORD2,1(rSTR2)
- bne cr0,L(bLcr0)
+ lbzu rWORD1, 1(rSTR1)
+ lbzu rWORD2, 1(rSTR2)
+ bne cr7, L(bLcr7)
- cmpld cr6,rWORD5,rWORD6
+ cmpld cr6, rWORD5, rWORD6
bdz L(b3i)
- lbzu rWORD3,1(rSTR1)
- lbzu rWORD4,1(rSTR2)
- bne cr1,L(bLcr1)
+ lbzu rWORD3, 1(rSTR1)
+ lbzu rWORD4, 1(rSTR2)
+ bne cr1, L(bLcr1)
- cmpld cr0,rWORD1,rWORD2
+ cmpld cr7, rWORD1, rWORD2
bdz L(b2i)
- lbzu rWORD5,1(rSTR1)
- lbzu rWORD6,1(rSTR2)
- bne cr6,L(bLcr6)
+ lbzu rWORD5, 1(rSTR1)
+ lbzu rWORD6, 1(rSTR2)
+ bne cr6, L(bLcr6)
- cmpld cr1,rWORD3,rWORD4
+ cmpld cr1, rWORD3, rWORD4
bdnz L(bLoop)
/* We speculatively loading bytes before we have tested the previous
@@ -437,542 +639,727 @@ L(bLoop):
tested. In this case we must complete the pending operations
before returning. */
L(b1i):
- bne cr0,L(bLcr0)
- bne cr1,L(bLcr1)
+ bne cr7, L(bLcr7)
+ bne cr1, L(bLcr1)
b L(bx56)
.align 4
L(b2i):
- bne cr6,L(bLcr6)
- bne cr0,L(bLcr0)
+ bne cr6, L(bLcr6)
+ bne cr7, L(bLcr7)
b L(bx34)
.align 4
L(b3i):
- bne cr1,L(bLcr1)
- bne cr6,L(bLcr6)
+ bne cr1, L(bLcr1)
+ bne cr6, L(bLcr6)
b L(bx12)
.align 4
-L(bLcr0):
- li rRTN,1
- bgtlr cr0
- li rRTN,-1
+L(bLcr7):
+ li rRTN, 1
+ bgtlr cr7
+ li rRTN, -1
blr
L(bLcr1):
- li rRTN,1
+ li rRTN, 1
bgtlr cr1
- li rRTN,-1
+ li rRTN, -1
blr
L(bLcr6):
- li rRTN,1
+ li rRTN, 1
bgtlr cr6
- li rRTN,-1
+ li rRTN, -1
blr
L(b13):
- bne cr0,L(bx12)
- bne cr1,L(bx34)
+ bne cr7, L(bx12)
+ bne cr1, L(bx34)
L(bx56):
- sub rRTN,rWORD5,rWORD6
+ sub rRTN, rWORD5, rWORD6
blr
nop
L(b12):
- bne cr0,L(bx12)
+ bne cr7, L(bx12)
L(bx34):
- sub rRTN,rWORD3,rWORD4
+ sub rRTN, rWORD3, rWORD4
blr
L(b11):
L(bx12):
- sub rRTN,rWORD1,rWORD2
+ sub rRTN, rWORD1, rWORD2
blr
.align 4
-L(zeroLengthReturn):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
L(zeroLength):
- li rRTN,0
+ li rRTN, 0
blr
.align 4
/* At this point we know the strings have different alignment and the
- compare length is at least 8 bytes. rBITDIF contains the low order
+ compare length is at least 8 bytes. r12 contains the low order
3 bits of rSTR1 and cr5 contains the result of the logical compare
- of rBITDIF to 0. If rBITDIF == 0 then rStr1 is double word
+ of r12 to 0. If r12 == 0 then rStr1 is double word
aligned and can perform the DWunaligned loop.
Otherwise we know that rSTR1 is not already DW aligned yet.
So we can force the string addresses to the next lower DW
- boundary and special case this first DW word using shift left to
+ boundary and special case this first DW using shift left to
eliminate bits preceding the first byte. Since we want to join the
normal (DWaligned) compare loop, starting at the second double word,
we need to adjust the length (rN) and special case the loop
- versioning for the first DW. This insures that the loop count is
+ versioning for the first DW. This ensures that the loop count is
correct and the first DW (shifted) is in the expected resister pair. */
-#define rSHL r29 /* Unaligned shift left count. */
-#define rSHR r28 /* Unaligned shift right count. */
-#define rB r27 /* Left rotation temp for rWORD2. */
-#define rD r26 /* Left rotation temp for rWORD4. */
-#define rF r25 /* Left rotation temp for rWORD6. */
-#define rH r24 /* Left rotation temp for rWORD8. */
-#define rA r0 /* Right rotation temp for rWORD2. */
-#define rC r12 /* Right rotation temp for rWORD4. */
-#define rE r0 /* Right rotation temp for rWORD6. */
-#define rG r12 /* Right rotation temp for rWORD8. */
+#define rSHL r29 /* Unaligned shift left count. */
+#define rSHR r28 /* Unaligned shift right count. */
+#define rWORD8_SHIFT r27 /* Left rotation temp for rWORD2. */
+#define rWORD2_SHIFT r26 /* Left rotation temp for rWORD4. */
+#define rWORD4_SHIFT r25 /* Left rotation temp for rWORD6. */
+#define rWORD6_SHIFT r24 /* Left rotation temp for rWORD8. */
L(unaligned):
- std r29,-24(r1)
- cfi_offset(r29,-24)
- clrldi rSHL,rSTR2,61
- beq cr6,L(duzeroLength)
- std r28,-32(r1)
- cfi_offset(r28,-32)
- beq cr5,L(DWunaligned)
- std r27,-40(r1)
- cfi_offset(r27,-40)
-/* Adjust the logical start of rSTR2 ro compensate for the extra bits
+ std rSHL, -24(r1)
+ cfi_offset(rSHL, -24)
+ clrldi rSHL, rSTR2, 61
+ beq cr6, L(duzeroLength)
+ std rSHR, -32(r1)
+ cfi_offset(rSHR, -32)
+ beq cr5, L(DWunaligned)
+ std rWORD8_SHIFT, -40(r1)
+ cfi_offset(rWORD8_SHIFT, -40)
+/* Adjust the logical start of rSTR2 to compensate for the extra bits
in the 1st rSTR1 DW. */
- sub r27,rSTR2,rBITDIF
+ sub rWORD8_SHIFT, rSTR2, r12
/* But do not attempt to address the DW before that DW that contains
the actual start of rSTR2. */
- clrrdi rSTR2,rSTR2,3
- std r26,-48(r1)
- cfi_offset(r26,-48)
+ clrrdi rSTR2, rSTR2, 3
+ std rWORD2_SHIFT, -48(r1)
+ cfi_offset(rWORD2_SHIFT, -48)
/* Compute the left/right shift counts for the unaligned rSTR2,
compensating for the logical (DW aligned) start of rSTR1. */
- clrldi rSHL,r27,61
- clrrdi rSTR1,rSTR1,3
- std r25,-56(r1)
- cfi_offset(r25,-56)
- sldi rSHL,rSHL,3
- cmpld cr5,r27,rSTR2
- add rN,rN,rBITDIF
- sldi r11,rBITDIF,3
- std r24,-64(r1)
- cfi_offset(r24,-64)
- subfic rSHR,rSHL,64
- srdi rTMP,rN,5 /* Divide by 32 */
- andi. rBITDIF,rN,24 /* Get the DW remainder */
+ clrldi rSHL, rWORD8_SHIFT, 61
+ clrrdi rSTR1, rSTR1, 3
+ std rWORD4_SHIFT, -56(r1)
+ cfi_offset(rWORD4_SHIFT, -56)
+ sldi rSHL, rSHL, 3
+ cmpld cr5, rWORD8_SHIFT, rSTR2
+ add rN, rN, r12
+ sldi rWORD6, r12, 3
+ std rWORD6_SHIFT, -64(r1)
+ cfi_offset(rWORD6_SHIFT, -64)
+ subfic rSHR, rSHL, 64
+ srdi r0, rN, 5 /* Divide by 32 */
+ andi. r12, rN, 24 /* Get the DW remainder */
/* We normally need to load 2 DWs to start the unaligned rSTR2, but in
this special case those bits may be discarded anyway. Also we
must avoid loading a DW where none of the bits are part of rSTR2 as
this may cross a page boundary and cause a page fault. */
- li rWORD8,0
- blt cr5,L(dus0)
- ld rWORD8,0(rSTR2)
- la rSTR2,8(rSTR2)
- sld rWORD8,rWORD8,rSHL
+ li rWORD8, 0
+ blt cr5, L(dus0)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD8, 0(rSTR2)
+ addi rSTR2, rSTR2, 8
+#endif
+ sld rWORD8, rWORD8, rSHL
L(dus0):
- ld rWORD1,0(rSTR1)
- ld rWORD2,0(rSTR2)
- cmpldi cr1,rBITDIF,16
- cmpldi cr7,rN,32
- srd rG,rWORD2,rSHR
- clrldi rN,rN,61
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 0(rSTR1)
+ ld rWORD2, 0(rSTR2)
+#endif
+ cmpldi cr1, r12, 16
+ cmpldi cr7, rN, 32
+ srd r12, rWORD2, rSHR
+ clrldi rN, rN, 61
beq L(duPs4)
- mtctr rTMP
- or rWORD8,rG,rWORD8
- bgt cr1,L(duPs3)
- beq cr1,L(duPs2)
+ mtctr r0
+ or rWORD8, r12, rWORD8
+ bgt cr1, L(duPs3)
+ beq cr1, L(duPs2)
/* Remainder is 8 */
.align 4
L(dusP1):
- sld rB,rWORD2,rSHL
- sld rWORD7,rWORD1,r11
- sld rWORD8,rWORD8,r11
- bge cr7,L(duP1e)
+ sld rWORD8_SHIFT, rWORD2, rSHL
+ sld rWORD7, rWORD1, rWORD6
+ sld rWORD8, rWORD8, rWORD6
+ bge cr7, L(duP1e)
/* At this point we exit early with the first double word compare
complete and remainder of 0 to 7 bytes. See L(du14) for details on
how we handle the remaining bytes. */
- cmpld cr5,rWORD7,rWORD8
- sldi. rN,rN,3
- bne cr5,L(duLcr5)
- cmpld cr7,rN,rSHR
+ cmpld cr5, rWORD7, rWORD8
+ sldi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srd rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 16 */
.align 4
L(duPs2):
- sld rH,rWORD2,rSHL
- sld rWORD5,rWORD1,r11
- sld rWORD6,rWORD8,r11
+ sld rWORD6_SHIFT, rWORD2, rSHL
+ sld rWORD5, rWORD1, rWORD6
+ sld rWORD6, rWORD8, rWORD6
b L(duP2e)
/* Remainder is 24 */
.align 4
L(duPs3):
- sld rF,rWORD2,rSHL
- sld rWORD3,rWORD1,r11
- sld rWORD4,rWORD8,r11
+ sld rWORD4_SHIFT, rWORD2, rSHL
+ sld rWORD3, rWORD1, rWORD6
+ sld rWORD4, rWORD8, rWORD6
b L(duP3e)
/* Count is a multiple of 32, remainder is 0 */
.align 4
L(duPs4):
- mtctr rTMP
- or rWORD8,rG,rWORD8
- sld rD,rWORD2,rSHL
- sld rWORD1,rWORD1,r11
- sld rWORD2,rWORD8,r11
+ mtctr r0
+ or rWORD8, r12, rWORD8
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ sld rWORD1, rWORD1, rWORD6
+ sld rWORD2, rWORD8, rWORD6
b L(duP4e)
/* At this point we know rSTR1 is double word aligned and the
compare length is at least 8 bytes. */
.align 4
L(DWunaligned):
- std r27,-40(r1)
- cfi_offset(r27,-40)
- clrrdi rSTR2,rSTR2,3
- std r26,-48(r1)
- cfi_offset(r26,-48)
- srdi rTMP,rN,5 /* Divide by 32 */
- std r25,-56(r1)
- cfi_offset(r25,-56)
- andi. rBITDIF,rN,24 /* Get the DW remainder */
- std r24,-64(r1)
- cfi_offset(r24,-64)
- sldi rSHL,rSHL,3
- ld rWORD6,0(rSTR2)
- ldu rWORD8,8(rSTR2)
- cmpldi cr1,rBITDIF,16
- cmpldi cr7,rN,32
- clrldi rN,rN,61
- subfic rSHR,rSHL,64
- sld rH,rWORD6,rSHL
+ std rWORD8_SHIFT, -40(r1)
+ cfi_offset(rWORD8_SHIFT, -40)
+ clrrdi rSTR2, rSTR2, 3
+ std rWORD2_SHIFT, -48(r1)
+ cfi_offset(rWORD2_SHIFT, -48)
+ srdi r0, rN, 5 /* Divide by 32 */
+ std rWORD4_SHIFT, -56(r1)
+ cfi_offset(rWORD4_SHIFT, -56)
+ andi. r12, rN, 24 /* Get the DW remainder */
+ std rWORD6_SHIFT, -64(r1)
+ cfi_offset(rWORD6_SHIFT, -64)
+ sldi rSHL, rSHL, 3
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD6, 0(rSTR2)
+ ldu rWORD8, 8(rSTR2)
+#endif
+ cmpldi cr1, r12, 16
+ cmpldi cr7, rN, 32
+ clrldi rN, rN, 61
+ subfic rSHR, rSHL, 64
+ sld rWORD6_SHIFT, rWORD6, rSHL
beq L(duP4)
- mtctr rTMP
- bgt cr1,L(duP3)
- beq cr1,L(duP2)
+ mtctr r0
+ bgt cr1, L(duP3)
+ beq cr1, L(duP2)
/* Remainder is 8 */
.align 4
L(duP1):
- srd rG,rWORD8,rSHR
- ld rWORD7,0(rSTR1)
- sld rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP1x)
+ srd r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
+ ld rWORD7, 0(rSTR1)
+#endif
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP1x)
L(duP1e):
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- srd rA,rWORD2,rSHR
- sld rD,rWORD2,rSHL
- or rWORD2,rA,rB
- ld rWORD3,16(rSTR1)
- ld rWORD4,16(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- srd rC,rWORD4,rSHR
- sld rF,rWORD4,rSHL
- bne cr5,L(duLcr5)
- or rWORD4,rC,rD
- ld rWORD5,24(rSTR1)
- ld rWORD6,24(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- srd rE,rWORD6,rSHR
- sld rH,rWORD6,rSHL
- bne cr0,L(duLcr0)
- or rWORD6,rE,rF
- cmpld cr6,rWORD5,rWORD6
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 16(rSTR1)
+ ld rWORD4, 16(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ bne cr5, L(duLcr5)
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 24(rSTR1)
+ ld rWORD6, 24(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ bne cr7, L(duLcr7)
+ or rWORD6, r0, rWORD4_SHIFT
+ cmpld cr6, rWORD5, rWORD6
b L(duLoop3)
.align 4
/* At this point we exit early with the first double word compare
complete and remainder of 0 to 7 bytes. See L(du14) for details on
how we handle the remaining bytes. */
L(duP1x):
- cmpld cr5,rWORD7,rWORD8
- sldi. rN,rN,3
- bne cr5,L(duLcr5)
- cmpld cr7,rN,rSHR
+ cmpld cr5, rWORD7, rWORD8
+ sldi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srd rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 16 */
.align 4
L(duP2):
- srd rE,rWORD8,rSHR
- ld rWORD5,0(rSTR1)
- or rWORD6,rE,rH
- sld rH,rWORD8,rSHL
+ srd r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
+ ld rWORD5, 0(rSTR1)
+#endif
+ or rWORD6, r0, rWORD6_SHIFT
+ sld rWORD6_SHIFT, rWORD8, rSHL
L(duP2e):
- ld rWORD7,8(rSTR1)
- ld rWORD8,8(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- srd rG,rWORD8,rSHR
- sld rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP2x)
- ld rWORD1,16(rSTR1)
- ld rWORD2,16(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- srd rA,rWORD2,rSHR
- sld rD,rWORD2,rSHL
- or rWORD2,rA,rB
- ld rWORD3,24(rSTR1)
- ld rWORD4,24(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- bne cr5,L(duLcr5)
- srd rC,rWORD4,rSHR
- sld rF,rWORD4,rSHL
- or rWORD4,rC,rD
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- cmpld cr1,rWORD3,rWORD4
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD7, 8(rSTR1)
+ ld rWORD8, 8(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP2x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 16(rSTR1)
+ ld rWORD2, 16(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 24(rSTR1)
+ ld rWORD4, 24(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ bne cr5, L(duLcr5)
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ cmpld cr1, rWORD3, rWORD4
b L(duLoop2)
.align 4
L(duP2x):
- cmpld cr5,rWORD7,rWORD8
- addi rSTR1,rSTR1,8
- addi rSTR2,rSTR2,8
- bne cr6,L(duLcr6)
- sldi. rN,rN,3
- bne cr5,L(duLcr5)
- cmpld cr7,rN,rSHR
+ cmpld cr5, rWORD7, rWORD8
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#endif
+ bne cr6, L(duLcr6)
+ sldi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srd rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Remainder is 24 */
.align 4
L(duP3):
- srd rC,rWORD8,rSHR
- ld rWORD3,0(rSTR1)
- sld rF,rWORD8,rSHL
- or rWORD4,rC,rH
+ srd r12, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
+ ld rWORD3, 0(rSTR1)
+#endif
+ sld rWORD4_SHIFT, rWORD8, rSHL
+ or rWORD4, r12, rWORD6_SHIFT
L(duP3e):
- ld rWORD5,8(rSTR1)
- ld rWORD6,8(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- srd rE,rWORD6,rSHR
- sld rH,rWORD6,rSHL
- or rWORD6,rE,rF
- ld rWORD7,16(rSTR1)
- ld rWORD8,16(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- bne cr1,L(duLcr1)
- srd rG,rWORD8,rSHR
- sld rB,rWORD8,rSHL
- or rWORD8,rG,rH
- blt cr7,L(duP3x)
- ld rWORD1,24(rSTR1)
- ld rWORD2,24(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- srd rA,rWORD2,rSHR
- sld rD,rWORD2,rSHL
- or rWORD2,rA,rB
- addi rSTR1,rSTR1,16
- addi rSTR2,rSTR2,16
- cmpld cr0,rWORD1,rWORD2
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 8(rSTR1)
+ ld rWORD6, 8(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD7, 16(rSTR1)
+ ld rWORD8, 16(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ bne cr1, L(duLcr1)
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ blt cr7, L(duP3x)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 24(rSTR1)
+ ld rWORD2, 24(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 16
+ addi rSTR2, rSTR2, 16
+#endif
+ cmpld cr7, rWORD1, rWORD2
b L(duLoop1)
.align 4
L(duP3x):
- addi rSTR1,rSTR1,16
- addi rSTR2,rSTR2,16
- bne cr1,L(duLcr1)
- cmpld cr5,rWORD7,rWORD8
- bne cr6,L(duLcr6)
- sldi. rN,rN,3
- bne cr5,L(duLcr5)
- cmpld cr7,rN,rSHR
+#ifndef __LITTLE_ENDIAN__
+ addi rSTR1, rSTR1, 16
+ addi rSTR2, rSTR2, 16
+#endif
+#if 0
+/* Huh? We've already branched on cr1! */
+ bne cr1, L(duLcr1)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr6, L(duLcr6)
+ sldi. rN, rN, 3
+ bne cr5, L(duLcr5)
+ cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srd rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd r0, rWORD2, rSHR
b L(dutrim)
/* Count is a multiple of 32, remainder is 0 */
.align 4
L(duP4):
- mtctr rTMP
- srd rA,rWORD8,rSHR
- ld rWORD1,0(rSTR1)
- sld rD,rWORD8,rSHL
- or rWORD2,rA,rH
+ mtctr r0
+ srd r0, rWORD8, rSHR
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ addi rSTR1, rSTR1, 8
+#else
+ ld rWORD1, 0(rSTR1)
+#endif
+ sld rWORD2_SHIFT, rWORD8, rSHL
+ or rWORD2, r0, rWORD6_SHIFT
L(duP4e):
- ld rWORD3,8(rSTR1)
- ld rWORD4,8(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- srd rC,rWORD4,rSHR
- sld rF,rWORD4,rSHL
- or rWORD4,rC,rD
- ld rWORD5,16(rSTR1)
- ld rWORD6,16(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- bne cr0,L(duLcr0)
- srd rE,rWORD6,rSHR
- sld rH,rWORD6,rSHL
- or rWORD6,rE,rF
- ldu rWORD7,24(rSTR1)
- ldu rWORD8,24(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- bne cr1,L(duLcr1)
- srd rG,rWORD8,rSHR
- sld rB,rWORD8,rSHL
- or rWORD8,rG,rH
- cmpld cr5,rWORD7,rWORD8
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 8(rSTR1)
+ ld rWORD4, 8(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 16(rSTR1)
+ ld rWORD6, 16(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ bne cr7, L(duLcr7)
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ldu rWORD7, 24(rSTR1)
+ ldu rWORD8, 24(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ bne cr1, L(duLcr1)
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
+ cmpld cr5, rWORD7, rWORD8
bdz L(du24) /* Adjust CTR as we start with +4 */
/* This is the primary loop */
.align 4
L(duLoop):
- ld rWORD1,8(rSTR1)
- ld rWORD2,8(rSTR2)
- cmpld cr1,rWORD3,rWORD4
- bne cr6,L(duLcr6)
- srd rA,rWORD2,rSHR
- sld rD,rWORD2,rSHL
- or rWORD2,rA,rB
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD1, 8(rSTR1)
+ ld rWORD2, 8(rSTR2)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ bne cr6, L(duLcr6)
+ srd r0, rWORD2, rSHR
+ sld rWORD2_SHIFT, rWORD2, rSHL
+ or rWORD2, r0, rWORD8_SHIFT
L(duLoop1):
- ld rWORD3,16(rSTR1)
- ld rWORD4,16(rSTR2)
- cmpld cr6,rWORD5,rWORD6
- bne cr5,L(duLcr5)
- srd rC,rWORD4,rSHR
- sld rF,rWORD4,rSHL
- or rWORD4,rC,rD
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD3, 0, rSTR1
+ ldbrx rWORD4, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD3, 16(rSTR1)
+ ld rWORD4, 16(rSTR2)
+#endif
+ cmpld cr6, rWORD5, rWORD6
+ bne cr5, L(duLcr5)
+ srd r12, rWORD4, rSHR
+ sld rWORD4_SHIFT, rWORD4, rSHL
+ or rWORD4, r12, rWORD2_SHIFT
L(duLoop2):
- ld rWORD5,24(rSTR1)
- ld rWORD6,24(rSTR2)
- cmpld cr5,rWORD7,rWORD8
- bne cr0,L(duLcr0)
- srd rE,rWORD6,rSHR
- sld rH,rWORD6,rSHL
- or rWORD6,rE,rF
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD5, 0, rSTR1
+ ldbrx rWORD6, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD5, 24(rSTR1)
+ ld rWORD6, 24(rSTR2)
+#endif
+ cmpld cr5, rWORD7, rWORD8
+ bne cr7, L(duLcr7)
+ srd r0, rWORD6, rSHR
+ sld rWORD6_SHIFT, rWORD6, rSHL
+ or rWORD6, r0, rWORD4_SHIFT
L(duLoop3):
- ldu rWORD7,32(rSTR1)
- ldu rWORD8,32(rSTR2)
- cmpld cr0,rWORD1,rWORD2
- bne- cr1,L(duLcr1)
- srd rG,rWORD8,rSHR
- sld rB,rWORD8,rSHL
- or rWORD8,rG,rH
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD7, 0, rSTR1
+ ldbrx rWORD8, 0, rSTR2
+ addi rSTR1, rSTR1, 8
+ addi rSTR2, rSTR2, 8
+#else
+ ldu rWORD7, 32(rSTR1)
+ ldu rWORD8, 32(rSTR2)
+#endif
+ cmpld cr7, rWORD1, rWORD2
+ bne cr1, L(duLcr1)
+ srd r12, rWORD8, rSHR
+ sld rWORD8_SHIFT, rWORD8, rSHL
+ or rWORD8, r12, rWORD6_SHIFT
bdnz L(duLoop)
L(duL4):
- bne cr1,L(duLcr1)
- cmpld cr1,rWORD3,rWORD4
- bne cr6,L(duLcr6)
- cmpld cr6,rWORD5,rWORD6
- bne cr5,L(duLcr5)
- cmpld cr5,rWORD7,rWORD8
+#if 0
+/* Huh? We've already branched on cr1! */
+ bne cr1, L(duLcr1)
+#endif
+ cmpld cr1, rWORD3, rWORD4
+ bne cr6, L(duLcr6)
+ cmpld cr6, rWORD5, rWORD6
+ bne cr5, L(duLcr5)
+ cmpld cr5, rWORD7, rWORD8
L(du44):
- bne cr0,L(duLcr0)
+ bne cr7, L(duLcr7)
L(du34):
- bne cr1,L(duLcr1)
+ bne cr1, L(duLcr1)
L(du24):
- bne cr6,L(duLcr6)
+ bne cr6, L(duLcr6)
L(du14):
- sldi. rN,rN,3
- bne cr5,L(duLcr5)
+ sldi. rN, rN, 3
+ bne cr5, L(duLcr5)
/* At this point we have a remainder of 1 to 7 bytes to compare. We use
shift right double to eliminate bits beyond the compare length.
- This allows the use of double word subtract to compute the final
- result.
However it may not be safe to load rWORD2 which may be beyond the
string length. So we compare the bit length of the remainder to
the right shift count (rSHR). If the bit count is less than or equal
we do not need to load rWORD2 (all significant bits are already in
- rB). */
- cmpld cr7,rN,rSHR
+ rWORD8_SHIFT). */
+ cmpld cr7, rN, rSHR
beq L(duZeroReturn)
- li rA,0
- ble cr7,L(dutrim)
- ld rWORD2,8(rSTR2)
- srd rA,rWORD2,rSHR
+ li r0, 0
+ ble cr7, L(dutrim)
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD2, 0, rSTR2
+ addi rSTR2, rSTR2, 8
+#else
+ ld rWORD2, 8(rSTR2)
+#endif
+ srd r0, rWORD2, rSHR
.align 4
L(dutrim):
- ld rWORD1,8(rSTR1)
- ld rWORD8,-8(r1)
- subfic rN,rN,64 /* Shift count is 64 - (rN * 8). */
- or rWORD2,rA,rB
- ld rWORD7,-16(r1)
- ld r29,-24(r1)
- srd rWORD1,rWORD1,rN
- srd rWORD2,rWORD2,rN
- ld r28,-32(r1)
- ld r27,-40(r1)
- li rRTN,0
- cmpld cr0,rWORD1,rWORD2
- ld r26,-48(r1)
- ld r25,-56(r1)
- beq cr0,L(dureturn24)
- li rRTN,1
- ld r24,-64(r1)
- bgtlr cr0
- li rRTN,-1
+#ifdef __LITTLE_ENDIAN__
+ ldbrx rWORD1, 0, rSTR1
+#else
+ ld rWORD1, 8(rSTR1)
+#endif
+ ld rWORD8, -8(r1)
+ subfic rN, rN, 64 /* Shift count is 64 - (rN * 8). */
+ or rWORD2, r0, rWORD8_SHIFT
+ ld rWORD7, -16(r1)
+ ld rSHL, -24(r1)
+ srd rWORD1, rWORD1, rN
+ srd rWORD2, rWORD2, rN
+ ld rSHR, -32(r1)
+ ld rWORD8_SHIFT, -40(r1)
+ li rRTN, 0
+ cmpld cr7, rWORD1, rWORD2
+ ld rWORD2_SHIFT, -48(r1)
+ ld rWORD4_SHIFT, -56(r1)
+ beq cr7, L(dureturn24)
+ li rRTN, 1
+ ld rWORD6_SHIFT, -64(r1)
+ bgtlr cr7
+ li rRTN, -1
blr
.align 4
-L(duLcr0):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
- bgt cr0,L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
- li rRTN,-1
+L(duLcr7):
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ li rRTN, 1
+ bgt cr7, L(dureturn29)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr1):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
- bgt cr1,L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
- li rRTN,-1
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ li rRTN, 1
+ bgt cr1, L(dureturn29)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr6):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
- bgt cr6,L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
- li rRTN,-1
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ li rRTN, 1
+ bgt cr6, L(dureturn29)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
+ li rRTN, -1
b L(dureturn27)
.align 4
L(duLcr5):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
- li rRTN,1
- bgt cr5,L(dureturn29)
- ld r29,-24(r1)
- ld r28,-32(r1)
- li rRTN,-1
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
+ li rRTN, 1
+ bgt cr5, L(dureturn29)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
+ li rRTN, -1
b L(dureturn27)
.align 3
L(duZeroReturn):
- li rRTN,0
+ li rRTN, 0
.align 4
L(dureturn):
- ld rWORD8,-8(r1)
- ld rWORD7,-16(r1)
+ ld rWORD8, -8(r1)
+ ld rWORD7, -16(r1)
L(dureturn29):
- ld r29,-24(r1)
- ld r28,-32(r1)
+ ld rSHL, -24(r1)
+ ld rSHR, -32(r1)
L(dureturn27):
- ld r27,-40(r1)
+ ld rWORD8_SHIFT, -40(r1)
L(dureturn26):
- ld r26,-48(r1)
+ ld rWORD2_SHIFT, -48(r1)
L(dureturn25):
- ld r25,-56(r1)
+ ld rWORD4_SHIFT, -56(r1)
L(dureturn24):
- ld r24,-64(r1)
+ ld rWORD6_SHIFT, -64(r1)
blr
L(duzeroLength):
- li rRTN,0
+ li rRTN, 0
blr
END (memcmp)
libc_hidden_builtin_def (memcmp)
-weak_alias (memcmp,bcmp)
+weak_alias (memcmp, bcmp)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memcpy.S b/libc/sysdeps/powerpc/powerpc64/power7/memcpy.S
index 800a9f1bb..e8df75f59 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memcpy.S
@@ -23,418 +23,361 @@
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
Returns 'dst'. */
+#define dst 11 /* Use r11 so r3 kept unchanged. */
+#define src 4
+#define cnt 5
+
.machine power7
EALIGN (memcpy, 5, 0)
CALL_MCOUNT 3
- cmpldi cr1,5,31
+ cmpldi cr1,cnt,31
neg 0,3
- std 3,-16(1)
- std 31,-8(1)
- cfi_offset(31,-8)
ble cr1, L(copy_LT_32) /* If move < 32 bytes use short move
code. */
- andi. 11,3,7 /* Check alignment of DST. */
-
-
- clrldi 10,4,61 /* Check alignment of SRC. */
- cmpld cr6,10,11 /* SRC and DST alignments match? */
- mr 12,4
- mr 31,5
+#ifdef __LITTLE_ENDIAN__
+/* In little-endian mode, power7 takes an alignment trap on any lxvd2x
+ or stxvd2x crossing a 32-byte boundary, so ensure the aligned_copy
+ loop is only used for quadword aligned copies. */
+ andi. 10,3,15
+ clrldi 11,4,60
+#else
+ andi. 10,3,7 /* Check alignment of DST. */
+ clrldi 11,4,61 /* Check alignment of SRC. */
+#endif
+ cmpld cr6,10,11 /* SRC and DST alignments match? */
+
+ mr dst,3
bne cr6,L(copy_GE_32_unaligned)
+ beq L(aligned_copy)
- srdi 9,5,3 /* Number of full quadwords remaining. */
-
- beq L(copy_GE_32_aligned_cont)
-
- clrldi 0,0,61
- mtcrf 0x01,0
- subf 31,0,5
-
- /* Get the SRC aligned to 8 bytes. */
-
-1: bf 31,2f
- lbz 6,0(12)
- addi 12,12,1
- stb 6,0(3)
- addi 3,3,1
-2: bf 30,4f
- lhz 6,0(12)
- addi 12,12,2
- sth 6,0(3)
- addi 3,3,2
-4: bf 29,0f
- lwz 6,0(12)
- addi 12,12,4
- stw 6,0(3)
- addi 3,3,4
-0:
- clrldi 10,12,61 /* Check alignment of SRC again. */
- srdi 9,31,3 /* Number of full doublewords remaining. */
-
-L(copy_GE_32_aligned_cont):
-
- clrldi 11,31,61
- mtcrf 0x01,9
-
- srdi 8,31,5
- cmpldi cr1,9,4
- cmpldi cr6,11,0
- mr 11,12
-
- /* Copy 1~3 doublewords so the main loop starts
- at a multiple of 32 bytes. */
+ mtocrf 0x01,0
+#ifdef __LITTLE_ENDIAN__
+ clrldi 0,0,60
+#else
+ clrldi 0,0,61
+#endif
- bf 30,1f
- ld 6,0(12)
- ld 7,8(12)
- addi 11,12,16
- mtctr 8
- std 6,0(3)
- std 7,8(3)
- addi 10,3,16
- bf 31,4f
- ld 0,16(12)
- std 0,16(3)
- blt cr1,3f
- addi 11,12,24
- addi 10,3,24
- b 4f
-
- .align 4
-1: /* Copy 1 doubleword and set the counter. */
- mr 10,3
- mtctr 8
- bf 31,4f
- ld 6,0(12)
- addi 11,12,8
- std 6,0(3)
- addi 10,3,8
-
-L(aligned_copy):
- /* Main aligned copy loop. Copies up to 128-bytes at a time. */
- .align 4
+/* Get the DST and SRC aligned to 8 bytes (16 for little-endian). */
+1:
+ bf 31,2f
+ lbz 6,0(src)
+ addi src,src,1
+ stb 6,0(dst)
+ addi dst,dst,1
+2:
+ bf 30,4f
+ lhz 6,0(src)
+ addi src,src,2
+ sth 6,0(dst)
+ addi dst,dst,2
4:
- /* check for any 32-byte or 64-byte lumps that are outside of a
- nice 128-byte range. R8 contains the number of 32-byte
- lumps, so drop this into the CR, and use the SO/EQ bits to help
- handle the 32- or 64- byte lumps. Then handle the rest with an
- unrolled 128-bytes-at-a-time copy loop. */
- mtocrf 1,8
- li 6,16 # 16() index
- li 7,32 # 32() index
- li 8,48 # 48() index
-
-L(aligned_32byte):
- /* if the SO bit (indicating a 32-byte lump) is not set, move along. */
- bns cr7,L(aligned_64byte)
- lxvd2x 6,0,11
- lxvd2x 7,11,6
- addi 11,11,32
- stxvd2x 6,0,10
- stxvd2x 7,10,6
- addi 10,10,32
-
-L(aligned_64byte):
- /* if the EQ bit (indicating a 64-byte lump) is not set, move along. */
- bne cr7,L(aligned_128setup)
- lxvd2x 6,0,11
- lxvd2x 7,11,6
- lxvd2x 8,11,7
- lxvd2x 9,11,8
- addi 11,11,64
- stxvd2x 6,0,10
- stxvd2x 7,10,6
- stxvd2x 8,10,7
- stxvd2x 9,10,8
- addi 10,10,64
-
-L(aligned_128setup):
- /* Set up for the 128-byte at a time copy loop. */
- srdi 8,31,7
- cmpdi 8,0 # Any 4x lumps left?
- beq 3f # if not, move along.
- lxvd2x 6,0,11
- lxvd2x 7,11,6
- mtctr 8 # otherwise, load the ctr and begin.
- li 8,48 # 48() index
+ bf 29,8f
+ lwz 6,0(src)
+ addi src,src,4
+ stw 6,0(dst)
+ addi dst,dst,4
+8:
+#ifdef __LITTLE_ENDIAN__
+ bf 28,16f
+ ld 6,0(src)
+ addi src,src,8
+ std 6,0(dst)
+ addi dst,dst,8
+16:
+#endif
+ subf cnt,0,cnt
+
+/* Main aligned copy loop. Copies 128 bytes at a time. */
+L(aligned_copy):
+ li 6,16
+ li 7,32
+ li 8,48
+ mtocrf 0x02,cnt
+ srdi 12,cnt,7
+ cmpdi 12,0
+ beq L(aligned_tail)
+ lxvd2x 6,0,src
+ lxvd2x 7,src,6
+ mtctr 12
b L(aligned_128loop)
+ .align 4
L(aligned_128head):
/* for the 2nd + iteration of this loop. */
- lxvd2x 6,0,11
- lxvd2x 7,11,6
+ lxvd2x 6,0,src
+ lxvd2x 7,src,6
L(aligned_128loop):
- lxvd2x 8,11,7
- lxvd2x 9,11,8
- stxvd2x 6,0,10
- addi 11,11,64
- stxvd2x 7,10,6
- stxvd2x 8,10,7
- stxvd2x 9,10,8
- lxvd2x 6,0,11
- lxvd2x 7,11,6
- addi 10,10,64
- lxvd2x 8,11,7
- lxvd2x 9,11,8
- addi 11,11,64
- stxvd2x 6,0,10
- stxvd2x 7,10,6
- stxvd2x 8,10,7
- stxvd2x 9,10,8
- addi 10,10,64
+ lxvd2x 8,src,7
+ lxvd2x 9,src,8
+ stxvd2x 6,0,dst
+ addi src,src,64
+ stxvd2x 7,dst,6
+ stxvd2x 8,dst,7
+ stxvd2x 9,dst,8
+ lxvd2x 6,0,src
+ lxvd2x 7,src,6
+ addi dst,dst,64
+ lxvd2x 8,src,7
+ lxvd2x 9,src,8
+ addi src,src,64
+ stxvd2x 6,0,dst
+ stxvd2x 7,dst,6
+ stxvd2x 8,dst,7
+ stxvd2x 9,dst,8
+ addi dst,dst,64
bdnz L(aligned_128head)
-3:
- /* Check for tail bytes. */
- rldicr 0,31,0,60
- mtcrf 0x01,31
- beq cr6,0f
-
-.L9:
- add 3,3,0
- add 12,12,0
-
- /* At this point we have a tail of 0-7 bytes and we know that the
- destination is doubleword-aligned. */
-4: /* Copy 4 bytes. */
- bf 29,2f
-
- lwz 6,0(12)
- addi 12,12,4
- stw 6,0(3)
- addi 3,3,4
-2: /* Copy 2 bytes. */
- bf 30,1f
-
- lhz 6,0(12)
- addi 12,12,2
- sth 6,0(3)
- addi 3,3,2
-1: /* Copy 1 byte. */
- bf 31,0f
-
- lbz 6,0(12)
- stb 6,0(3)
-0: /* Return original DST pointer. */
- ld 31,-8(1)
- ld 3,-16(1)
+L(aligned_tail):
+ mtocrf 0x01,cnt
+ bf 25,32f
+ lxvd2x 6,0,src
+ lxvd2x 7,src,6
+ lxvd2x 8,src,7
+ lxvd2x 9,src,8
+ addi src,src,64
+ stxvd2x 6,0,dst
+ stxvd2x 7,dst,6
+ stxvd2x 8,dst,7
+ stxvd2x 9,dst,8
+ addi dst,dst,64
+32:
+ bf 26,16f
+ lxvd2x 6,0,src
+ lxvd2x 7,src,6
+ addi src,src,32
+ stxvd2x 6,0,dst
+ stxvd2x 7,dst,6
+ addi dst,dst,32
+16:
+ bf 27,8f
+ lxvd2x 6,0,src
+ addi src,src,16
+ stxvd2x 6,0,dst
+ addi dst,dst,16
+8:
+ bf 28,4f
+ ld 6,0(src)
+ addi src,src,8
+ std 6,0(dst)
+ addi dst,dst,8
+4: /* Copies 4~7 bytes. */
+ bf 29,L(tail2)
+ lwz 6,0(src)
+ stw 6,0(dst)
+ bf 30,L(tail5)
+ lhz 7,4(src)
+ sth 7,4(dst)
+ bflr 31
+ lbz 8,6(src)
+ stb 8,6(dst)
+ /* Return original DST pointer. */
blr
- /* Handle copies of 0~31 bytes. */
- .align 4
+
+/* Handle copies of 0~31 bytes. */
+ .align 4
L(copy_LT_32):
- cmpldi cr6,5,8
- mr 12,4
- mtcrf 0x01,5
+ mr dst,3
+ cmpldi cr6,cnt,8
+ mtocrf 0x01,cnt
ble cr6,L(copy_LE_8)
/* At least 9 bytes to go. */
neg 8,4
- clrrdi 11,4,2
- andi. 0,8,3
- cmpldi cr1,5,16
- mr 10,5
+ andi. 0,8,3
+ cmpldi cr1,cnt,16
beq L(copy_LT_32_aligned)
- /* Force 4-bytes alignment for SRC. */
- mtocrf 0x01,0
- subf 10,0,5
-2: bf 30,1f
-
- lhz 6,0(12)
- addi 12,12,2
- sth 6,0(3)
- addi 3,3,2
-1: bf 31,L(end_4bytes_alignment)
-
- lbz 6,0(12)
- addi 12,12,1
- stb 6,0(3)
- addi 3,3,1
-
- .align 4
+ /* Force 4-byte alignment for SRC. */
+ mtocrf 0x01,0
+ subf cnt,0,cnt
+2:
+ bf 30,1f
+ lhz 6,0(src)
+ addi src,src,2
+ sth 6,0(dst)
+ addi dst,dst,2
+1:
+ bf 31,L(end_4bytes_alignment)
+ lbz 6,0(src)
+ addi src,src,1
+ stb 6,0(dst)
+ addi dst,dst,1
+
+ .align 4
L(end_4bytes_alignment):
- cmpldi cr1,10,16
- mtcrf 0x01,10
+ cmpldi cr1,cnt,16
+ mtocrf 0x01,cnt
L(copy_LT_32_aligned):
/* At least 6 bytes to go, and SRC is word-aligned. */
blt cr1,8f
/* Copy 16 bytes. */
- lwz 6,0(12)
- lwz 7,4(12)
- stw 6,0(3)
- lwz 8,8(12)
- stw 7,4(3)
- lwz 6,12(12)
- addi 12,12,16
- stw 8,8(3)
- stw 6,12(3)
- addi 3,3,16
+ lwz 6,0(src)
+ lwz 7,4(src)
+ stw 6,0(dst)
+ lwz 8,8(src)
+ stw 7,4(dst)
+ lwz 6,12(src)
+ addi src,src,16
+ stw 8,8(dst)
+ stw 6,12(dst)
+ addi dst,dst,16
8: /* Copy 8 bytes. */
- bf 28,4f
+ bf 28,L(tail4)
+ lwz 6,0(src)
+ lwz 7,4(src)
+ addi src,src,8
+ stw 6,0(dst)
+ stw 7,4(dst)
+ addi dst,dst,8
+
+ .align 4
+/* Copies 4~7 bytes. */
+L(tail4):
+ bf 29,L(tail2)
+ lwz 6,0(src)
+ stw 6,0(dst)
+ bf 30,L(tail5)
+ lhz 7,4(src)
+ sth 7,4(dst)
+ bflr 31
+ lbz 8,6(src)
+ stb 8,6(dst)
+ /* Return original DST pointer. */
+ blr
- lwz 6,0(12)
- lwz 7,4(12)
- addi 12,12,8
- stw 6,0(3)
- stw 7,4(3)
- addi 3,3,8
-4: /* Copy 4 bytes. */
- bf 29,2f
-
- lwz 6,0(12)
- addi 12,12,4
- stw 6,0(3)
- addi 3,3,4
-2: /* Copy 2-3 bytes. */
+ .align 4
+/* Copies 2~3 bytes. */
+L(tail2):
bf 30,1f
-
- lhz 6,0(12)
- sth 6,0(3)
- bf 31,0f
- lbz 7,2(12)
- stb 7,2(3)
- ld 3,-16(1)
+ lhz 6,0(src)
+ sth 6,0(dst)
+ bflr 31
+ lbz 7,2(src)
+ stb 7,2(dst)
blr
- .align 4
-1: /* Copy 1 byte. */
- bf 31,0f
+ .align 4
+L(tail5):
+ bflr 31
+ lbz 6,4(src)
+ stb 6,4(dst)
+ blr
- lbz 6,0(12)
- stb 6,0(3)
-0: /* Return original DST pointer. */
- ld 3,-16(1)
+ .align 4
+1:
+ bflr 31
+ lbz 6,0(src)
+ stb 6,0(dst)
+ /* Return original DST pointer. */
blr
- /* Handles copies of 0~8 bytes. */
- .align 4
+
+/* Handles copies of 0~8 bytes. */
+ .align 4
L(copy_LE_8):
- bne cr6,4f
+ bne cr6,L(tail4)
/* Though we could've used ld/std here, they are still
slow for unaligned cases. */
- lwz 6,0(4)
- lwz 7,4(4)
- stw 6,0(3)
- stw 7,4(3)
- ld 3,-16(1) /* Return original DST pointers. */
+ lwz 6,0(src)
+ lwz 7,4(src)
+ stw 6,0(dst)
+ stw 7,4(dst)
blr
- .align 4
-4: /* Copies 4~7 bytes. */
- bf 29,2b
-
- lwz 6,0(4)
- stw 6,0(3)
- bf 30,5f
- lhz 7,4(4)
- sth 7,4(3)
- bf 31,0f
- lbz 8,6(4)
- stb 8,6(3)
- ld 3,-16(1)
- blr
-
- .align 4
-5: /* Copy 1 byte. */
- bf 31,0f
-
- lbz 6,4(4)
- stb 6,4(3)
-
-0: /* Return original DST pointer. */
- ld 3,-16(1)
- blr
- /* Handle copies of 32+ bytes where DST is aligned (to quadword) but
- SRC is not. Use aligned quadword loads from SRC, shifted to realign
- the data, allowing for aligned DST stores. */
- .align 4
+/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
+ SRC is not. Use aligned quadword loads from SRC, shifted to realign
+ the data, allowing for aligned DST stores. */
+ .align 4
L(copy_GE_32_unaligned):
- clrldi 0,0,60 /* Number of bytes until the 1st
- quadword. */
- andi. 11,3,15 /* Check alignment of DST (against
- quadwords). */
- srdi 9,5,4 /* Number of full quadwords remaining. */
+ clrldi 0,0,60 /* Number of bytes until the 1st dst quadword. */
+#ifndef __LITTLE_ENDIAN__
+ andi. 10,3,15 /* Check alignment of DST (against quadwords). */
+#endif
+ srdi 9,cnt,4 /* Number of full quadwords remaining. */
beq L(copy_GE_32_unaligned_cont)
- /* SRC is not quadword aligned, get it aligned. */
+ /* DST is not quadword aligned, get it aligned. */
- mtcrf 0x01,0
- subf 31,0,5
+ mtocrf 0x01,0
+ subf cnt,0,cnt
/* Vector instructions work best when proper alignment (16-bytes)
is present. Move 0~15 bytes as needed to get DST quadword-aligned. */
-1: /* Copy 1 byte. */
+1:
bf 31,2f
-
- lbz 6,0(12)
- addi 12,12,1
- stb 6,0(3)
- addi 3,3,1
-2: /* Copy 2 bytes. */
+ lbz 6,0(src)
+ addi src,src,1
+ stb 6,0(dst)
+ addi dst,dst,1
+2:
bf 30,4f
-
- lhz 6,0(12)
- addi 12,12,2
- sth 6,0(3)
- addi 3,3,2
-4: /* Copy 4 bytes. */
+ lhz 6,0(src)
+ addi src,src,2
+ sth 6,0(dst)
+ addi dst,dst,2
+4:
bf 29,8f
-
- lwz 6,0(12)
- addi 12,12,4
- stw 6,0(3)
- addi 3,3,4
-8: /* Copy 8 bytes. */
+ lwz 6,0(src)
+ addi src,src,4
+ stw 6,0(dst)
+ addi dst,dst,4
+8:
bf 28,0f
-
- ld 6,0(12)
- addi 12,12,8
- std 6,0(3)
- addi 3,3,8
+ ld 6,0(src)
+ addi src,src,8
+ std 6,0(dst)
+ addi dst,dst,8
0:
- clrldi 10,12,60 /* Check alignment of SRC. */
- srdi 9,31,4 /* Number of full quadwords remaining. */
+ srdi 9,cnt,4 /* Number of full quadwords remaining. */
/* The proper alignment is present, it is OK to copy the bytes now. */
L(copy_GE_32_unaligned_cont):
/* Setup two indexes to speed up the indexed vector operations. */
- clrldi 11,31,60
- li 6,16 /* Index for 16-bytes offsets. */
+ clrldi 10,cnt,60
+ li 6,16 /* Index for 16-bytes offsets. */
li 7,32 /* Index for 32-bytes offsets. */
- cmpldi cr1,11,0
- srdi 8,31,5 /* Setup the loop counter. */
- mr 10,3
- mr 11,12
- mtcrf 0x01,9
- cmpldi cr6,9,1
- lvsl 5,0,12
- lvx 3,0,12
- bf 31,L(setup_unaligned_loop)
-
- /* Copy another 16 bytes to align to 32-bytes due to the loop . */
- lvx 4,12,6
- vperm 6,3,4,5
- addi 11,12,16
- addi 10,3,16
- stvx 6,0,3
+ cmpldi cr1,10,0
+ srdi 8,cnt,5 /* Setup the loop counter. */
+ mtocrf 0x01,9
+ cmpldi cr6,9,1
+#ifdef __LITTLE_ENDIAN__
+ lvsr 5,0,src
+#else
+ lvsl 5,0,src
+#endif
+ lvx 3,0,src
+ li 0,0
+ bf 31,L(setup_unaligned_loop)
+
+ /* Copy another 16 bytes to align to 32-bytes due to the loop. */
+ lvx 4,src,6
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
+ addi src,src,16
+ stvx 6,0,dst
+ addi dst,dst,16
vor 3,4,4
+ clrrdi 0,src,60
L(setup_unaligned_loop):
- mtctr 8
- ble cr6,L(end_unaligned_loop)
+ mtctr 8
+ ble cr6,L(end_unaligned_loop)
/* Copy 32 bytes at a time using vector instructions. */
- .align 4
+ .align 4
L(unaligned_loop):
/* Note: vr6/vr10 may contain data that was already copied,
@@ -442,62 +385,55 @@ L(unaligned_loop):
some portions again. This is faster than having unaligned
vector instructions though. */
- lvx 4,11,6 /* vr4 = r11+16. */
- vperm 6,3,4,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr6. */
- lvx 3,11,7 /* vr3 = r11+32. */
- vperm 10,4,3,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr10. */
- addi 11,11,32
- stvx 6,0,10
- stvx 10,10,6
- addi 10,10,32
-
+ lvx 4,src,6
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
+ lvx 3,src,7
+#ifdef __LITTLE_ENDIAN__
+ vperm 10,3,4,5
+#else
+ vperm 10,4,3,5
+#endif
+ addi src,src,32
+ stvx 6,0,dst
+ stvx 10,dst,6
+ addi dst,dst,32
bdnz L(unaligned_loop)
- .align 4
+ clrrdi 0,src,60
+
+ .align 4
L(end_unaligned_loop):
/* Check for tail bytes. */
- rldicr 0,31,0,59
- mtcrf 0x01,31
- beq cr1,0f
+ mtocrf 0x01,cnt
+ beqlr cr1
- add 3,3,0
- add 12,12,0
+ add src,src,0
/* We have 1~15 tail bytes to copy, and DST is quadword aligned. */
-8: /* Copy 8 bytes. */
+ /* Copy 8 bytes. */
bf 28,4f
-
- lwz 6,0(12)
- lwz 7,4(12)
- addi 12,12,8
- stw 6,0(3)
- stw 7,4(3)
- addi 3,3,8
-4: /* Copy 4 bytes. */
- bf 29,2f
-
- lwz 6,0(12)
- addi 12,12,4
- stw 6,0(3)
- addi 3,3,4
-2: /* Copy 2~3 bytes. */
- bf 30,1f
-
- lhz 6,0(12)
- addi 12,12,2
- sth 6,0(3)
- addi 3,3,2
-1: /* Copy 1 byte. */
- bf 31,0f
-
- lbz 6,0(12)
- stb 6,0(3)
-0: /* Return original DST pointer. */
- ld 31,-8(1)
- ld 3,-16(1)
+ lwz 6,0(src)
+ lwz 7,4(src)
+ addi src,src,8
+ stw 6,0(dst)
+ stw 7,4(dst)
+ addi dst,dst,8
+4: /* Copy 4~7 bytes. */
+ bf 29,L(tail2)
+ lwz 6,0(src)
+ stw 6,0(dst)
+ bf 30,L(tail5)
+ lhz 7,4(src)
+ sth 7,4(dst)
+ bflr 31
+ lbz 8,6(src)
+ stb 8,6(dst)
+ /* Return original DST pointer. */
blr
END_GEN_TB (memcpy,TB_TOCLESS)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S b/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S
index f20be938d..b93ab7da5 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S
@@ -365,13 +365,21 @@ L(copy_GE_32_unaligned_cont):
mr 11,12
mtcrf 0x01,9
cmpldi cr6,9,1
- lvsl 5,0,12
+#ifdef __LITTLE_ENDIAN__
+ lvsr 5,0,12
+#else
+ lvsl 5,0,12
+#endif
lvx 3,0,12
bf 31,L(setup_unaligned_loop)
/* Copy another 16 bytes to align to 32-bytes due to the loop . */
lvx 4,12,6
- vperm 6,3,4,5
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
addi 11,12,16
addi 10,3,16
stvx 6,0,3
@@ -391,11 +399,17 @@ L(unaligned_loop):
vector instructions though. */
lvx 4,11,6 /* vr4 = r11+16. */
- vperm 6,3,4,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr6. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 6,4,3,5
+#else
+ vperm 6,3,4,5
+#endif
lvx 3,11,7 /* vr3 = r11+32. */
- vperm 10,4,3,5 /* Merge the correctly-aligned portions
- of vr3/vr4 into vr10. */
+#ifdef __LITTLE_ENDIAN__
+ vperm 10,3,4,5
+#else
+ vperm 10,4,3,5
+#endif
addi 11,11,32
stvx 6,0,10
stvx 10,10,6
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S b/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
index c49995210..a9e86cb19 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -23,118 +23,132 @@
.machine power7
ENTRY (__memrchr)
CALL_MCOUNT
- dcbt 0,r3
- mr r7,r3
- add r3,r7,r5 /* Calculate the last acceptable address. */
- cmpld cr7,r3,r7 /* Is the address equal or less than r3? */
+ add r7,r3,r5 /* Calculate the last acceptable address. */
+ neg r0,r7
+ addi r7,r7,-1
+ mr r10,r3
+ clrrdi r6,r7,7
+ li r9,3<<5
+ dcbt r9,r6,16 /* Stream hint, decreasing addresses. */
/* Replicate BYTE to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0
- bge cr7,L(proceed)
-
- li r3,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
li r6,-8
- addi r9,r3,-1
- clrrdi r8,r9,3
- addi r8,r8,8
- neg r0,r3
+ li r9,-1
rlwinm r0,r0,3,26,28 /* Calculate padding. */
-
+ clrrdi r8,r7,3
+ srd r9,r9,r0
cmpldi r5,32
+ clrrdi r0,r10,3
ble L(small_range)
- ldbrx r12,r8,r6 /* Load reversed doubleword from memory. */
- cmpb r10,r12,r4 /* Check for BYTE in DWORD1. */
- sld r10,r10,r0
- srd r10,r10,r0
- cmpldi cr7,r10,0 /* If r10 == 0, no BYTEs have been found. */
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,0,r8
+#else
+ ldbrx r12,0,r8 /* Load reversed doubleword from memory. */
+#endif
+ cmpb r3,r12,r4 /* Check for BYTE in DWORD1. */
+ and r3,r3,r9
+ cmpldi cr7,r3,0 /* If r3 == 0, no BYTEs have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,-8
- cmpld cr6,r9,r7
- ble cr6,L(null)
-
mtcrf 0x01,r8
- /* Are we now aligned to a doubleword boundary? If so, skip to
+ /* Are we now aligned to a quadword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
- mr r8,r9
- bt 28,L(loop_setup)
+ bf 28,L(loop_setup)
/* Handle DWORD2 of pair. */
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,r8,r6
+#else
ldbrx r12,r8,r6
- cmpb r10,r12,r4
- cmpldi cr7,r10,0
- bne cr7,L(done)
-
- /* Are we done already. */
+#endif
addi r8,r8,-8
- cmpld cr6,r8,r7
- ble cr6,L(null)
+ cmpb r3,r12,r4
+ cmpldi cr7,r3,0
+ bne cr7,L(done)
L(loop_setup):
- li r0,-16
- sub r5,r8,r7
- srdi r9,r5,4 /* Number of loop iterations. */
+ /* The last dword we want to read in the loop below is the one
+ containing the first byte of the string, ie. the dword at
+ s & ~7, or r0. The first dword read is at r8 - 8, we
+ read 2 * cnt dwords, so the last dword read will be at
+ r8 - 8 - 16 * cnt + 8. Solving for cnt gives
+ cnt = (r8 - r0) / 16 */
+ sub r5,r8,r0
+ addi r8,r8,-8
+ srdi r9,r5,4 /* Number of loop iterations. */
mtctr r9 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for BYTE backwards in the string. Since it's a
- small loop (< 8 instructions), align it to 32-bytes. */
- .p2align 5
+
+ /* Main loop to look for BYTE backwards in the string.
+ FIXME: Investigate whether 32 byte align helps with this
+ 9 instruction loop. */
+ .align 5
L(loop):
/* Load two doublewords, compare and merge in a
single register for speed. This is an attempt
to speed up the byte-checking process for bigger strings. */
- ldbrx r12,r8,r6
- ldbrx r11,r8,r0
- addi r8,r8,-8
- cmpb r10,r12,r4
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,0,r8
+ ldx r11,r8,r6
+#else
+ ldbrx r12,0,r8
+ ldbrx r11,r8,r6
+#endif
+ cmpb r3,r12,r4
cmpb r9,r11,r4
- or r5,r9,r10 /* Merge everything in one doubleword. */
+ or r5,r9,r3 /* Merge everything in one doubleword. */
cmpldi cr7,r5,0
bne cr7,L(found)
- addi r8,r8,-8
+ addi r8,r8,-16
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for BYTE in the whole range. Just return
- the original range. */
- addi r8,r8,8
- cmpld cr6,r8,r7
- bgt cr6,L(loop_small)
- b L(null)
-
- /* OK, one (or both) of the words contains BYTE. Check
- the first word and decrement the address in case the first
- word really contains BYTE. */
+
+ /* We may have one more word to read. */
+ cmpld r8,r0
+ bnelr
+
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,0,r8
+#else
+ ldbrx r12,0,r8
+#endif
+ cmpb r3,r12,r4
+ cmpldi cr7,r3,0
+ bne cr7,L(done)
+ blr
+
.align 4
L(found):
- cmpldi cr6,r10,0
- addi r8,r8,8
+ /* OK, one (or both) of the dwords contains BYTE. Check
+ the first dword. */
+ cmpldi cr6,r3,0
bne cr6,L(done)
/* BYTE must be in the second word. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
+ again and move the result of cmpb to r3 so we can calculate the
pointer. */
- mr r10,r9
+ mr r3,r9
addi r8,r8,-8
- /* r10 has the output of the cmpb instruction, that is, it contains
- 0xff in the same position as the BYTE in the original
+ /* r3 has the output of the cmpb instruction, that is, it contains
+ 0xff in the same position as BYTE in the original
word from the string. Use that to calculate the pointer.
We need to make sure BYTE is *before* the end of the
range. */
L(done):
- cntlzd r0,r10 /* Count leading zeroes before the match. */
- srdi r6,r0,3 /* Convert leading zeroes to bytes. */
- addi r0,r6,1
+ cntlzd r9,r3 /* Count leading zeros before the match. */
+ cmpld r8,r0 /* Are we on the last word? */
+ srdi r6,r9,3 /* Convert leading zeros to bytes. */
+ addi r0,r6,-7
sub r3,r8,r0
- cmpld r3,r7
- blt L(null)
+ cmpld cr7,r3,r10
+ bnelr
+ bgelr cr7
+ li r3,0
blr
.align 4
@@ -148,29 +162,35 @@ L(small_range):
cmpldi r5,0
beq L(null)
- ldbrx r12,r8,r6 /* Load reversed doubleword from memory. */
- cmpb r10,r12,r4 /* Check for BYTE in DWORD1. */
- sld r10,r10,r0
- srd r10,r10,r0
- cmpldi cr7,r10,0
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,0,r8
+#else
+ ldbrx r12,0,r8 /* Load reversed doubleword from memory. */
+#endif
+ cmpb r3,r12,r4 /* Check for BYTE in DWORD1. */
+ and r3,r3,r9
+ cmpldi cr7,r3,0
bne cr7,L(done)
/* Are we done already? */
+ cmpld r8,r0
addi r8,r8,-8
- cmpld r8,r7
- ble L(null)
- b L(loop_small)
+ beqlr
- .p2align 5
+ .align 5
L(loop_small):
- ldbrx r12,r8,r6
- cmpb r10,r12,r4
- cmpldi cr6,r10,0
- bne cr6,L(done)
+#ifdef __LITTLE_ENDIAN__
+ ldx r12,0,r8
+#else
+ ldbrx r12,0,r8
+#endif
+ cmpb r3,r12,r4
+ cmpld r8,r0
+ cmpldi cr7,r3,0
+ bne cr7,L(done)
addi r8,r8,-8
- cmpld r8,r7
- ble L(null)
- b L(loop_small)
+ bne L(loop_small)
+ blr
END (__memrchr)
weak_alias (__memrchr, memrchr)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/memset.S b/libc/sysdeps/powerpc/powerpc64/power7/memset.S
index b24cfa163..8b081e87c 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -32,8 +32,8 @@ L(_memset):
mr 10,3
/* Replicate byte to word. */
- rlwimi 4,4,8,16,23
- rlwimi 4,4,16,0,15
+ insrdi 4,4,8,48
+ insrdi 4,4,16,32
ble cr6,L(small) /* If length <= 8, use short copy code. */
neg 0,3
@@ -321,7 +321,7 @@ L(medium):
clrldi 0,0,62
beq L(medium_aligned)
- /* Force 4-bytes alignment for SRC. */
+ /* Force 4-bytes alignment for DST. */
mtocrf 0x01,0
subf 5,0,5
1: /* Copy 1 byte. */
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/rawmemchr.S b/libc/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
index 50a33d8fa..547aed771 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
@@ -27,8 +27,8 @@ ENTRY (__rawmemchr)
clrrdi r8,r3,3 /* Align the address to doubleword boundary. */
/* Replicate byte to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0
/* Now r4 has a doubleword of c bytes. */
@@ -36,8 +36,13 @@ ENTRY (__rawmemchr)
rlwinm r6,r3,3,26,28 /* Calculate padding. */
ld r12,0(r8) /* Load doubleword from memory. */
cmpb r5,r12,r4 /* Compare each byte against c byte. */
+#ifdef __LITTLE_ENDIAN__
+ srd r5,r5,r6
+ sld r5,r5,r6
+#else
sld r5,r5,r6 /* Move left to discard ignored bits. */
srd r5,r5,r6 /* Bring the bits back as zeros. */
+#endif
cmpdi cr7,r5,0 /* If r5 == 0, no c bytes have been found. */
bne cr7,L(done)
@@ -91,8 +96,14 @@ L(loop):
doubleword from the string. Use that fact to find out what is
the position of the byte inside the string. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntd r0,r0 /* Count trailing zeros. */
+#else
cntlzd r0,r5 /* Count leading zeros before the match. */
- srdi r0,r0,3 /* Convert leading zeroes to bytes. */
+#endif
+ srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching char. */
blr
END (__rawmemchr)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strchr.S b/libc/sysdeps/powerpc/powerpc64/power7/strchr.S
index 3ffe7a188..4679a158f 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/strchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strchr.S
@@ -35,8 +35,8 @@ ENTRY (strchr)
beq cr7,L(null_match)
/* Replicate byte to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0
/* Now r4 has a doubleword of c bytes and r0 has
@@ -47,11 +47,17 @@ ENTRY (strchr)
/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ srd r11,r11,r6
+ sld r10,r10,r6
+ sld r11,r11,r6
+#else
sld r10,r10,r6
sld r11,r11,r6
srd r10,r10,r6
srd r11,r11,r6
+#endif
or r5,r10,r11 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -108,15 +114,24 @@ L(loop):
mr r11,r7
addi r8,r8,8
- /* r5 has the output of the cmpb instruction, that is, it contains
+ /* r10/r11 have the output of the cmpb instructions, that is,
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done):
- cntlzd r4,r10 /* Count leading zeroes before c matches. */
- cntlzd r0,r11 /* Count leading zeroes before null matches. */
- cmpld cr7,r4,r0
+#ifdef __LITTLE_ENDIAN__
+ addi r3,r10,-1
+ andc r3,r3,r10
+ popcntd r0,r3
+ addi r4,r11,-1
+ andc r4,r4,r11
+ cmpld cr7,r3,r4
bgt cr7,L(no_match)
- srdi r0,r4,3 /* Convert leading zeroes to bytes. */
+#else
+ cntlzd r0,r10 /* Count leading zeros before c matches. */
+ cmpld cr7,r11,r10
+ bgt cr7,L(no_match)
+#endif
+ srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
@@ -135,9 +150,13 @@ L(null_match):
/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srd r5,r5,r6
+ sld r5,r5,r6
+#else
sld r5,r5,r6
srd r5,r5,r6
+#endif
cmpdi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
@@ -192,7 +211,13 @@ L(loop_null):
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done_null):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntd r0,r0
+#else
cntlzd r0,r5 /* Count leading zeros before the match. */
+#endif
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strchrnul.S b/libc/sysdeps/powerpc/powerpc64/power7/strchrnul.S
index 9dbc51b0d..df457525e 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/strchrnul.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strchrnul.S
@@ -27,8 +27,8 @@ ENTRY (__strchrnul)
clrrdi r8,r3,3 /* Align the address to doubleword boundary. */
/* Replicate byte to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0
rlwinm r6,r3,3,26,28 /* Calculate padding. */
@@ -44,10 +44,17 @@ ENTRY (__strchrnul)
/* Move the doublewords left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ srd r9,r9,r6
+ sld r10,r10,r6
+ sld r9,r9,r6
+#else
sld r10,r10,r6
sld r9,r9,r6
srd r10,r10,r6
srd r9,r9,r6
+#endif
or r5,r9,r10 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -97,7 +104,7 @@ L(loop):
bne cr6,L(done)
/* The c/null byte must be in the second doubleword. Adjust the
- address again and move the result of cmpb to r10 so we can calculate
+ address again and move the result of cmpb to r5 so we can calculate
the pointer. */
mr r5,r10
addi r8,r8,8
@@ -106,7 +113,13 @@ L(loop):
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntd r0,r0
+#else
cntlzd r0,r5 /* Count leading zeros before the match. */
+#endif
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strlen.S b/libc/sysdeps/powerpc/powerpc64/power7/strlen.S
index 343216952..807ef1082 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/strlen.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strlen.S
@@ -30,7 +30,11 @@ ENTRY (strlen)
with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
ld r12,0(r4) /* Load doubleword from memory. */
+#ifdef __LITTLE_ENDIAN__
+ sld r5,r5,r6
+#else
srd r5,r5,r6 /* MASK = MASK >> padding. */
+#endif
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in DWORD1. */
cmpdi cr7,r10,0 /* If r10 == 0, no null's have been found. */
@@ -48,9 +52,6 @@ ENTRY (strlen)
cmpb r10,r12,r0
cmpdi cr7,r10,0
bne cr7,L(done)
- b L(loop) /* We branch here (rather than falling through)
- to skip the nops due to heavy alignment
- of the loop below. */
/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
@@ -87,9 +88,15 @@ L(loop):
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length. */
L(done):
- cntlzd r0,r10 /* Count leading zeroes before the match. */
+#ifdef __LITTLE_ENDIAN__
+ addi r9, r10, -1 /* Form a mask from trailing zeros. */
+ andc r9, r9, r10
+ popcntd r0, r9 /* Count the bits in the mask. */
+#else
+ cntlzd r0,r10 /* Count leading zeros before the match. */
+#endif
subf r5,r3,r4
- srdi r0,r0,3 /* Convert leading zeroes to bytes. */
+ srdi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
add r3,r5,r0 /* Compute final length. */
blr
END (strlen)
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strncmp.S b/libc/sysdeps/powerpc/powerpc64/power7/strncmp.S
index 77ecad5ab..e618b010b 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strncmp.S
@@ -27,7 +27,7 @@
EALIGN (strncmp,5,0)
CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -40,6 +40,7 @@ EALIGN (strncmp,5,0)
#define r7F7F r9 /* constant 0x7f7f7f7f7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
nop
@@ -83,12 +84,57 @@ L(g1): add rTMP,rFEFE,rWORD1
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
+ beq cr1, L(equal)
+ andc rTMP2, rTMP2, rTMP
+ rldimi rTMP2, rTMP2, 1, 0
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ cmpd cr1, rWORD1, rWORD2
+ beq cr1, L(equal)
+ cmpb rBITDIF, rWORD1, rWORD2 /* 0xff on equal bytes. */
+ addi rNEG, rBITDIF, 1
+ orc rNEG, rNEG, rBITDIF /* 0's below LS differing byte. */
+ sldi rNEG, rNEG, 8 /* 1's above LS differing byte. */
+ andc rWORD1, rWORD1, rNEG /* mask off MS bytes. */
+ andc rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt L(highbit)
+ sradi rRTN, rRTN, 63 /* must return an int. */
+ ori rRTN, rRTN, 1
+ blr
+L(equal):
+ li rRTN, 0
+ blr
+
+L(different):
+ ld rWORD1, -8(rSTR1)
+ cmpb rBITDIF, rWORD1, rWORD2 /* 0xff on equal bytes. */
+ addi rNEG, rBITDIF, 1
+ orc rNEG, rNEG, rBITDIF /* 0's below LS differing byte. */
+ sldi rNEG, rNEG, 8 /* 1's above LS differing byte. */
+ andc rWORD1, rWORD1, rNEG /* mask off MS bytes. */
+ andc rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt L(highbit)
+ sradi rRTN, rRTN, 63
+ ori rRTN, rRTN, 1
+ blr
+L(highbit):
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
+ blr
+
+#else
L(endstring):
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
-
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzd rBITDIF,rBITDIF
@@ -97,7 +143,7 @@ L(endstring):
cmpd cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
blt cr1,L(equal)
- sradi rRTN,rRTN,63
+ sradi rRTN,rRTN,63 /* must return an int. */
ori rRTN,rRTN,1
blr
L(equal):
@@ -105,7 +151,7 @@ L(equal):
blr
L(different):
- ldu rWORD1,-8(rSTR1)
+ ld rWORD1,-8(rSTR1)
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
blt L(highbit)
@@ -113,11 +159,10 @@ L(different):
ori rRTN,rRTN,1
blr
L(highbit):
- srdi rWORD2,rWORD2,56
- srdi rWORD1,rWORD1,56
- sub rRTN,rWORD1,rWORD2
+ sradi rRTN,rWORD2,63
+ ori rRTN,rRTN,1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/power7/strnlen.S b/libc/sysdeps/powerpc/powerpc64/power7/strnlen.S
index 37c7dbfe8..51591069d 100644
--- a/libc/sysdeps/powerpc/powerpc64/power7/strnlen.S
+++ b/libc/sysdeps/powerpc/powerpc64/power7/strnlen.S
@@ -24,33 +24,29 @@
ENTRY (__strnlen)
CALL_MCOUNT 2
dcbt 0,r3
- clrrdi r8,r3,3
+ clrrdi r8,r3,3
add r7,r3,r4 /* Calculate the last acceptable address. */
cmpldi r4,32
li r0,0 /* Doubleword with null chars. */
+ addi r7,r7,-1
+
/* If we have less than 33 bytes to search, skip to a faster code. */
ble L(small_range)
- cmpld cr7,r3,r7 /* Is the address equal or less than r3? If
- it's equal or less, it means size is either 0
- or a negative number. */
- ble cr7,L(proceed)
-
- li r7,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
rlwinm r6,r3,3,26,28 /* Calculate padding. */
ld r12,0(r8) /* Load doubleword from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ sld r10,r10,r6
+#else
sld r10,r10,r6
srd r10,r10,r6
+#endif
cmpldi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,8
- cmpld cr6,r9,r7
- bge cr6,L(end_max)
-
+ clrrdi r7,r7,3 /* Address of last doubleword. */
mtcrf 0x01,r8
/* Are we now aligned to a quadword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
@@ -63,17 +59,18 @@ L(proceed):
cmpldi cr7,r10,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,8
- cmpld cr6,r9,r7
- bge cr6,L(end_max)
-
L(loop_setup):
- sub r5,r7,r9
+ /* The last dword we want to read in the loop below is the one
+ containing the last byte of the string, ie. the dword at
+ (s + size - 1) & ~7, or r7. The first dword read is at
+ r8 + 8, we read 2 * cnt dwords, so the last dword read will
+ be at r8 + 8 + 16 * cnt - 8. Solving for cnt gives
+ cnt = (r7 - r8) / 16 */
+ sub r5,r7,r8
srdi r6,r5,4 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for the null byte backwards in the string. Since
+
+ /* Main loop to look for the null byte in the string. Since
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
L(loop):
@@ -89,15 +86,18 @@ L(loop):
cmpldi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for null in the whole range. Just return
- the original size. */
- addi r9,r8,8
- cmpld cr6,r9,r7
- blt cr6,L(loop_small)
+
+ /* We may have one more dword to read. */
+ cmpld cr6,r8,r7
+ beq cr6,L(end_max)
+
+ ldu r12,8(r8)
+ cmpb r10,r12,r0
+ cmpldi cr6,r10,0
+ bne cr6,L(done)
L(end_max):
- sub r3,r7,r3
+ mr r3,r4
blr
/* OK, one (or both) of the doublewords contains a null byte. Check
@@ -119,52 +119,59 @@ L(found):
/* r10 has the output of the cmpb instruction, that is, it contains
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length.
- We need to make sure the null char is *before* the start of the
- range (since we're going backwards). */
+ We need to make sure the null char is *before* the end of the
+ range. */
L(done):
- cntlzd r0,r10 /* Count leading zeroes before the match. */
- srdi r0,r0,3 /* Convert leading zeroes to bytes. */
- add r9,r8,r0
- sub r6,r9,r3 /* Length until the match. */
- cmpld r9,r7
- bgt L(end_max)
- mr r3,r6
- blr
-
- .align 4
-L(zero):
- li r3,0
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r10,-1
+ andc r0,r0,r10
+ popcntd r0,r0
+#else
+ cntlzd r0,r10 /* Count leading zeros before the match. */
+#endif
+ sub r3,r8,r3
+ srdi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
+ add r3,r3,r0 /* Length until the match. */
+ cmpld r3,r4
+ blelr
+ mr r3,r4
blr
/* Deals with size <= 32. */
.align 4
L(small_range):
cmpldi r4,0
- beq L(zero)
+ beq L(end_max)
+
+ clrrdi r7,r7,3 /* Address of last doubleword. */
rlwinm r6,r3,3,26,28 /* Calculate padding. */
- ld r12,0(r8) /* Load word from memory. */
+ ld r12,0(r8) /* Load doubleword from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ sld r10,r10,r6
+#else
sld r10,r10,r6
srd r10,r10,r6
+#endif
cmpldi cr7,r10,0
bne cr7,L(done)
- addi r9,r8,8
- cmpld r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmpld r8,r7
+ beq L(end_max)
.p2align 5
L(loop_small):
ldu r12,8(r8)
cmpb r10,r12,r0
- addi r9,r8,8
cmpldi cr6,r10,0
bne cr6,L(done)
- cmpld r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmpld r8,r7
+ bne L(loop_small)
+ mr r3,r4
+ blr
+
END (__strnlen)
weak_alias (__strnlen, strnlen)
libc_hidden_builtin_def (strnlen)
diff --git a/libc/sysdeps/powerpc/powerpc64/setjmp-common.S b/libc/sysdeps/powerpc/powerpc64/setjmp-common.S
index 58ec61062..1829b9ab6 100644
--- a/libc/sysdeps/powerpc/powerpc64/setjmp-common.S
+++ b/libc/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -95,7 +95,7 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
mfcr r0
std r16,((JB_GPRS+2)*8)(3)
stfd fp16,((JB_FPRS+2)*8)(3)
- std r0,(JB_CR*8)(3)
+ stw r0,((JB_CR*8)+4)(3) /* 32-bit CR. */
std r17,((JB_GPRS+3)*8)(3)
stfd fp17,((JB_FPRS+3)*8)(3)
std r18,((JB_GPRS+4)*8)(3)
@@ -139,50 +139,46 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
mfspr r0,VRSAVE
- stw r0,((JB_VRSAVE)*8)(3)
+ stw r0,((JB_VRSAVE)*8)(3) /* 32-bit VRSAVE. */
addi r6,r5,16
beq+ L(aligned_save_vmx)
- lvsr v0,0,r5
- vspltisb v1,-1 /* set v1 to all 1's */
- vspltisb v2,0 /* set v2 to all 0's */
- vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes
- on left = misalignment */
+ lvsr v0,0,r5
+ lvsl v1,0,r5
+ addi r6,r5,-16
- /* Special case for v20 we need to preserve what is in save area
- below v20 before obliterating it */
- lvx v5,0,r5
- vperm v20,v20,v20,v0
- vsel v5,v5,v20,v3
- vsel v20,v20,v2,v3
- stvx v5,0,r5
+# define save_misaligned_vmx(savevr,prevvr,shiftvr,tmpvr,savegpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ vperm tmpvr,prevvr,savevr,shiftvr; \
+ stvx tmpvr,0,savegpr
-# define save_2vmx_partial(savevr,prev_savevr,hivr,shiftvr,maskvr,savegpr,addgpr) \
- addi addgpr,addgpr,32; \
- vperm savevr,savevr,savevr,shiftvr; \
- vsel hivr,prev_savevr,savevr,maskvr; \
- stvx hivr,0,savegpr;
+ /*
+ * We have to be careful not to corrupt the data below v20 and
+ * above v31. To keep things simple we just rotate both ends in
+ * the opposite direction to our main permute so we can use
+ * the common macro.
+ */
- save_2vmx_partial(v21,v20,v5,v0,v3,r6,r5)
- save_2vmx_partial(v22,v21,v5,v0,v3,r5,r6)
- save_2vmx_partial(v23,v22,v5,v0,v3,r6,r5)
- save_2vmx_partial(v24,v23,v5,v0,v3,r5,r6)
- save_2vmx_partial(v25,v24,v5,v0,v3,r6,r5)
- save_2vmx_partial(v26,v25,v5,v0,v3,r5,r6)
- save_2vmx_partial(v27,v26,v5,v0,v3,r6,r5)
- save_2vmx_partial(v28,v27,v5,v0,v3,r5,r6)
- save_2vmx_partial(v29,v28,v5,v0,v3,r6,r5)
- save_2vmx_partial(v30,v29,v5,v0,v3,r5,r6)
+ /* load and rotate data below v20 */
+ lvx v2,0,r5
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v20,v2,v0,v3,r5,r6)
+ save_misaligned_vmx(v21,v20,v0,v3,r6,r5)
+ save_misaligned_vmx(v22,v21,v0,v3,r5,r6)
+ save_misaligned_vmx(v23,v22,v0,v3,r6,r5)
+ save_misaligned_vmx(v24,v23,v0,v3,r5,r6)
+ save_misaligned_vmx(v25,v24,v0,v3,r6,r5)
+ save_misaligned_vmx(v26,v25,v0,v3,r5,r6)
+ save_misaligned_vmx(v27,v26,v0,v3,r6,r5)
+ save_misaligned_vmx(v28,v27,v0,v3,r5,r6)
+ save_misaligned_vmx(v29,v28,v0,v3,r6,r5)
+ save_misaligned_vmx(v30,v29,v0,v3,r5,r6)
+ save_misaligned_vmx(v31,v30,v0,v3,r6,r5)
+ /* load and rotate data above v31 */
+ lvx v2,0,r6
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v2,v31,v0,v3,r5,r6)
- /* Special case for r31 we need to preserve what is in save area
- above v31 before obliterating it */
- addi r5,r5,32
- vperm v31,v31,v31,v0
- lvx v4,0,r5
- vsel v5,v30,v31,v3
- stvx v5,0,r6
- vsel v4,v31,v4,v3
- stvx v4,0,r5
b L(no_vmx)
L(aligned_save_vmx):
diff --git a/libc/sysdeps/powerpc/powerpc64/setjmp.S b/libc/sysdeps/powerpc/powerpc64/setjmp.S
index 667b9d12d..0a3b2fc02 100644
--- a/libc/sysdeps/powerpc/powerpc64/setjmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/setjmp.S
@@ -26,9 +26,9 @@
#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmxsetjmp, setjmp, GLIBC_2.3.4)
-default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmxsetjmp, setjmp, GLIBC_2_3_4)
+versioned_symbol (libc, __vmx_setjmp, _setjmp, GLIBC_2_3_4)
+versioned_symbol (libc, __vmx__sigsetjmp, __sigsetjmp, GLIBC_2_3_4)
# define setjmp __vmxsetjmp
# define _setjmp __vmx_setjmp
# define __sigsetjmp __vmx__sigsetjmp
@@ -44,9 +44,9 @@ strong_alias (__vmx__sigsetjmp, __setjmp)
# undef __sigjmp_save
# undef JB_SIZE
# define __NO_VMX__
-symbol_version (__novmxsetjmp, setjmp, GLIBC_2.3)
-symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.3);
-symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.3)
+compat_symbol (libc, __novmxsetjmp, setjmp, GLIBC_2_3)
+compat_symbol (libc, __novmx_setjmp,_setjmp, GLIBC_2_3);
+compat_symbol (libc, __novmx__sigsetjmp,__sigsetjmp, GLIBC_2_3)
# define setjmp __novmxsetjmp
# define _setjmp __novmx_setjmp
# define __sigsetjmp __novmx__sigsetjmp
diff --git a/libc/sysdeps/powerpc/powerpc64/stackguard-macros.h b/libc/sysdeps/powerpc/powerpc64/stackguard-macros.h
index 9da879c61..e80a683e6 100644
--- a/libc/sysdeps/powerpc/powerpc64/stackguard-macros.h
+++ b/libc/sysdeps/powerpc/powerpc64/stackguard-macros.h
@@ -2,3 +2,13 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ \
+ uintptr_t x; \
+ asm ("ld %0,%1(13)" \
+ : "=r" (x) \
+ : "i" (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) \
+ ); \
+ x; \
+ })
diff --git a/libc/sysdeps/powerpc/powerpc64/stpcpy.S b/libc/sysdeps/powerpc/powerpc64/stpcpy.S
index 070cd4662..c0b39729e 100644
--- a/libc/sysdeps/powerpc/powerpc64/stpcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/stpcpy.S
@@ -62,7 +62,22 @@ L(g2): add rTMP, rFEFE, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
+#ifdef __LITTLE_ENDIAN__
+ rlwinm. rTMP, rALT, 0, 24, 31
+ stbu rALT, 4(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 24, 24, 31
+ stbu rTMP, 1(rDEST)
+ beqlr-
+ rlwinm. rTMP, rALT, 16, 24, 31
+ stbu rTMP, 1(rDEST)
+ beqlr-
+ rlwinm rTMP, rALT, 8, 24, 31
+ stbu rTMP, 1(rDEST)
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -73,6 +88,7 @@ L(g1): rlwinm. rTMP, rALT, 8, 24, 31
beqlr-
stbu rALT, 1(rDEST)
blr
+#endif
/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/strchr.S b/libc/sysdeps/powerpc/powerpc64/strchr.S
index d2d8cd361..da707ae58 100644
--- a/libc/sysdeps/powerpc/powerpc64/strchr.S
+++ b/libc/sysdeps/powerpc/powerpc64/strchr.S
@@ -37,11 +37,13 @@ ENTRY (strchr)
#define rIGN r10 /* number of bits we should ignore in the first word */
#define rMASK r11 /* mask with the bits to ignore set to 0 */
#define rTMP3 r12
+#define rTMP4 rIGN
+#define rTMP5 rMASK
dcbt 0,rRTN
- rlwimi rCHR, rCHR, 8, 16, 23
+ insrdi rCHR, rCHR, 8, 48
li rMASK, -1
- rlwimi rCHR, rCHR, 16, 0, 15
+ insrdi rCHR, rCHR, 16, 32
rlwinm rIGN, rRTN, 3, 26, 28
insrdi rCHR, rCHR, 32, 0
lis rFEFE, -0x101
@@ -54,64 +56,93 @@ ENTRY (strchr)
add rFEFE, rFEFE, rTMP1
/* Test the first (partial?) word. */
ld rWORD, 0(rSTR)
+#ifdef __LITTLE_ENDIAN__
+ sld rMASK, rMASK, rIGN
+#else
srd rMASK, rMASK, rIGN
+#endif
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2
xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)
/* The loop. */
-L(loop):ldu rWORD, 8(rSTR)
- and. rTMP1, rTMP1, rTMP2
+L(loop):
+ ldu rWORD, 8(rSTR)
+ and. rTMP5, rTMP1, rTMP2
/* Test for 0. */
- add rTMP1, rFEFE, rWORD
- nor rTMP2, r7F7F, rWORD
+ add rTMP1, rFEFE, rWORD /* x - 0x01010101. */
+ nor rTMP2, r7F7F, rWORD /* ~(x | 0x7f7f7f7f) == ~x & 0x80808080. */
bne L(foundit)
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2 /* (x - 0x01010101) & ~x & 0x80808080. */
/* Start test for the bytes we're looking for. */
xor rTMP3, rCHR, rWORD
L(loopentry):
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
+
/* There is a zero byte in the word, but may also be a matching byte (either
before or after the zero byte). In fact, we may be looking for a
- zero byte, in which case we return a match. We guess that this hasn't
- happened, though. */
-L(missed):
- and. rTMP1, rTMP1, rTMP2
+ zero byte, in which case we return a match. */
+ and. rTMP5, rTMP1, rTMP2
li rRTN, 0
beqlr
-/* It did happen. Decide which one was first...
- I'm not sure if this is actually faster than a sequence of
- rotates, compares, and branches (we use it anyway because it's shorter). */
+/* At this point:
+ rTMP5 bytes are 0x80 for each match of c, 0 otherwise.
+ rTMP4 bytes are 0x80 for each match of 0, 0 otherwise.
+ But there may be false matches in the next most significant byte from
+ a true match due to carries. This means we need to recalculate the
+ matches using a longer method for big-endian. */
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
+ andc rTMP1, rTMP1, rTMP5
+ cntlzd rCLZB, rTMP1
+ addi rTMP2, rTMP4, -1
+ andc rTMP2, rTMP2, rTMP4
+ cmpld rTMP1, rTMP2
+ bgtlr
+ subfic rCLZB, rCLZB, 64-7
+#else
+/* I think we could reduce this by two instructions by keeping the "nor"
+ results from the loop for reuse here. See strlen.S tail. Similarly
+ one instruction could be pruned from L(foundit). */
and rFEFE, r7F7F, rWORD
- or rMASK, r7F7F, rWORD
+ or rTMP5, r7F7F, rWORD
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rWORD, rMASK, rFEFE
- nor rTMP2, rIGN, rTMP1
+ nor rWORD, rTMP5, rFEFE
+ nor rTMP2, rTMP4, rTMP1
+ cntlzd rCLZB, rTMP2
cmpld rWORD, rTMP2
bgtlr
- cntlzd rCLZB, rTMP2
+#endif
srdi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
blr
L(foundit):
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
+ andc rTMP1, rTMP1, rTMP5
+ cntlzd rCLZB, rTMP1
+ subfic rCLZB, rCLZB, 64-7-64
+ sradi rCLZB, rCLZB, 3
+#else
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rTMP1, rTMP1, r7F7F
- nor rTMP2, rIGN, rTMP1
+ nor rTMP2, rTMP4, rTMP1
cntlzd rCLZB, rTMP2
subi rSTR, rSTR, 8
srdi rCLZB, rCLZB, 3
+#endif
add rRTN, rSTR, rCLZB
blr
END (strchr)
diff --git a/libc/sysdeps/powerpc/powerpc64/strcmp.S b/libc/sysdeps/powerpc/powerpc64/strcmp.S
index c9d6dac12..70854689d 100644
--- a/libc/sysdeps/powerpc/powerpc64/strcmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/strcmp.S
@@ -25,7 +25,7 @@
EALIGN (strcmp, 4, 0)
CALL_MCOUNT 2
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -35,6 +35,7 @@ EALIGN (strcmp, 4, 0)
#define r7F7F r8 /* constant 0x7f7f7f7f7f7f7f7f */
#define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r10 /* bits that differ in s1 & s2 words */
+#define rTMP r11
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -58,19 +59,66 @@ L(g0): ldu rWORD1, 8(rSTR1)
ldu rWORD2, 8(rSTR2)
L(g1): add rTMP, rFEFE, rWORD1
nor rNEG, r7F7F, rWORD1
-
and. rTMP, rTMP, rNEG
cmpd cr1, rWORD1, rWORD2
beq+ L(g0)
-L(endstring):
+
/* OK. We've hit the end of the string. We need to be careful that
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
+ beq cr1, L(equal)
+ andc rTMP2, rTMP2, rTMP
+ rldimi rTMP2, rTMP2, 1, 0
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ cmpd cr1, rWORD1, rWORD2
+ beq cr1, L(equal)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63 /* must return an int. */
+ ori rRTN, rRTN, 1
+ blr
+L(equal):
+ li rRTN, 0
+ blr
+
+L(different):
+ ld rWORD1, -8(rSTR1)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63
+ ori rRTN, rRTN, 1
+ blr
+L(highbit):
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
+ blr
+
+#else
+L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -79,7 +127,7 @@ L(endstring):
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
L(equal):
@@ -95,11 +143,10 @@ L(different):
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/strcpy.S b/libc/sysdeps/powerpc/powerpc64/strcpy.S
index 4c6fd3f9d..a7fd85bad 100644
--- a/libc/sysdeps/powerpc/powerpc64/strcpy.S
+++ b/libc/sysdeps/powerpc/powerpc64/strcpy.S
@@ -68,6 +68,32 @@ L(g2): add rTMP, rFEFE, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
L(g1):
+#ifdef __LITTLE_ENDIAN__
+ extrdi. rTMP, rALT, 8, 56
+ stb rALT, 8(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 48
+ stb rTMP, 9(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 40
+ stb rTMP, 10(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 32
+ stb rTMP, 11(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 24
+ stb rTMP, 12(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 16
+ stb rTMP, 13(rDEST)
+ beqlr-
+ extrdi. rTMP, rALT, 8, 8
+ stb rTMP, 14(rDEST)
+ beqlr-
+ extrdi rTMP, rALT, 8, 0
+ stb rTMP, 15(rDEST)
+ blr
+#else
extrdi. rTMP, rALT, 8, 0
stb rTMP, 8(rDEST)
beqlr-
@@ -91,6 +117,7 @@ L(g1):
beqlr-
stb rALT, 15(rDEST)
blr
+#endif
/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
diff --git a/libc/sysdeps/powerpc/powerpc64/strlen.S b/libc/sysdeps/powerpc/powerpc64/strlen.S
index 0f9b5eea9..4ed1ba3ad 100644
--- a/libc/sysdeps/powerpc/powerpc64/strlen.S
+++ b/libc/sysdeps/powerpc/powerpc64/strlen.S
@@ -29,7 +29,12 @@
1 is subtracted you get a value in the range 0x00-0x7f, none of which
have their high bit set. The expression here is
(x + 0xfefefeff) & ~(x | 0x7f7f7f7f), which gives 0x00000000 when
- there were no 0x00 bytes in the word.
+ there were no 0x00 bytes in the word. You get 0x80 in bytes that
+ match, but possibly false 0x80 matches in the next more significant
+ byte to a true match due to carries. For little-endian this is
+ of no consequence since the least significant match is the one
+ we're interested in, but big-endian needs method 2 to find which
+ byte matches.
2) Given a word 'x', we can test to see _which_ byte was zero by
calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f).
@@ -62,7 +67,7 @@
Answer:
1) Added a Data Cache Block Touch early to prefetch the first 128
byte cache line. Adding dcbt instructions to the loop would not be
- effective since most strings will be shorter than the cache line.*/
+ effective since most strings will be shorter than the cache line. */
/* Some notes on register usage: Under the SVR4 ABI, we can use registers
0 and 3 through 12 (so long as we don't call any procedures) without
@@ -78,7 +83,7 @@
ENTRY (strlen)
CALL_MCOUNT 1
-#define rTMP1 r0
+#define rTMP4 r0
#define rRTN r3 /* incoming STR arg, outgoing result */
#define rSTR r4 /* current string position */
#define rPADN r5 /* number of padding bits we prepend to the
@@ -88,9 +93,9 @@ ENTRY (strlen)
#define rWORD1 r8 /* current string doubleword */
#define rWORD2 r9 /* next string doubleword */
#define rMASK r9 /* mask for first string doubleword */
-#define rTMP2 r10
-#define rTMP3 r11
-#define rTMP4 r12
+#define rTMP1 r10
+#define rTMP2 r11
+#define rTMP3 r12
dcbt 0,rRTN
clrrdi rSTR, rRTN, 3
@@ -100,30 +105,36 @@ ENTRY (strlen)
addi r7F7F, r7F7F, 0x7f7f
li rMASK, -1
insrdi r7F7F, r7F7F, 32, 0
-/* That's the setup done, now do the first pair of doublewords.
- We make an exception and use method (2) on the first two doublewords,
- to reduce overhead. */
+/* We use method (2) on the first two doublewords, because rFEFE isn't
+ required which reduces setup overhead. Also gives a faster return
+ for small strings on big-endian due to needing to recalculate with
+ method (2) anyway. */
+#ifdef __LITTLE_ENDIAN__
+ sld rMASK, rMASK, rPADN
+#else
srd rMASK, rMASK, rPADN
+#endif
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
lis rFEFE, -0x101
add rTMP1, rTMP1, r7F7F
addi rFEFE, rFEFE, -0x101
- nor rTMP1, rTMP2, rTMP1
- and. rWORD1, rTMP1, rMASK
+ nor rTMP3, rTMP2, rTMP1
+ and. rTMP3, rTMP3, rMASK
mtcrf 0x01, rRTN
bne L(done0)
- sldi rTMP1, rFEFE, 32
- add rFEFE, rFEFE, rTMP1
+ sldi rTMP1, rFEFE, 32
+ add rFEFE, rFEFE, rTMP1
/* Are we now aligned to a doubleword boundary? */
bt 28, L(loop)
/* Handle second doubleword of pair. */
+/* Perhaps use method (1) here for little-endian, saving one instruction? */
ldu rWORD1, 8(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor. rWORD1, rTMP2, rTMP1
+ nor. rTMP3, rTMP2, rTMP1
bne L(done0)
/* The loop. */
@@ -137,28 +148,52 @@ L(loop):
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
- and. rTMP1, rTMP3, rTMP4
+ and. rTMP3, rTMP3, rTMP4
beq L(loop)
+#ifndef __LITTLE_ENDIAN__
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP4, rTMP1
+ andc rTMP3, rTMP4, rTMP1
b L(done0)
L(done1):
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 8
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP2, rTMP1
+ andc rTMP3, rTMP2, rTMP1
/* When we get to here, rSTR points to the first doubleword in the string that
- contains a zero byte, and the most significant set bit in rWORD1 is in that
- byte. */
+ contains a zero byte, and rTMP3 has 0x80 for bytes that are zero, and 0x00
+ otherwise. */
L(done0):
- cntlzd rTMP3, rWORD1
+ cntlzd rTMP3, rTMP3
subf rTMP1, rRTN, rSTR
srdi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
blr
+#else
+
+L(done0):
+ addi rTMP1, rTMP3, -1 /* Form a mask from trailing zeros. */
+ andc rTMP1, rTMP1, rTMP3
+ cntlzd rTMP1, rTMP1 /* Count bits not in the mask. */
+ subf rTMP3, rRTN, rSTR
+ subfic rTMP1, rTMP1, 64-7
+ srdi rTMP1, rTMP1, 3
+ add rRTN, rTMP1, rTMP3
+ blr
+
+L(done1):
+ addi rTMP3, rTMP1, -1
+ andc rTMP3, rTMP3, rTMP1
+ cntlzd rTMP3, rTMP3
+ subf rTMP1, rRTN, rSTR
+ subfic rTMP3, rTMP3, 64-7-64
+ sradi rTMP3, rTMP3, 3
+ add rRTN, rTMP1, rTMP3
+ blr
+#endif
+
END (strlen)
libc_hidden_builtin_def (strlen)
diff --git a/libc/sysdeps/powerpc/powerpc64/strncmp.S b/libc/sysdeps/powerpc/powerpc64/strncmp.S
index 779d9f7f6..8f842c4b2 100644
--- a/libc/sysdeps/powerpc/powerpc64/strncmp.S
+++ b/libc/sysdeps/powerpc/powerpc64/strncmp.S
@@ -25,7 +25,7 @@
EALIGN (strncmp, 4, 0)
CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
#define rSTR1 r3 /* first string arg */
#define rSTR2 r4 /* second string arg */
@@ -36,6 +36,7 @@ EALIGN (strncmp, 4, 0)
#define r7F7F r9 /* constant 0x7f7f7f7f7f7f7f7f */
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -77,12 +78,59 @@ L(g1): add rTMP, rFEFE, rWORD1
we don't compare two strings as different because of gunk beyond
the end of the strings... */
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
+ beq cr1, L(equal)
+ andc rTMP2, rTMP2, rTMP
+ rldimi rTMP2, rTMP2, 1, 0
+ and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
+ and rWORD1, rWORD1, rTMP2
+ cmpd cr1, rWORD1, rWORD2
+ beq cr1, L(equal)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63 /* must return an int. */
+ ori rRTN, rRTN, 1
+ blr
+L(equal):
+ li rRTN, 0
+ blr
+
+L(different):
+ ld rWORD1, -8(rSTR1)
+ xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
+ neg rNEG, rBITDIF
+ and rNEG, rNEG, rBITDIF /* rNEG has LS bit that differs. */
+ cntlzd rNEG, rNEG /* bitcount of the bit. */
+ andi. rNEG, rNEG, 56 /* bitcount to LS byte that differs. */
+ sld rWORD1, rWORD1, rNEG /* shift left to clear MS bytes. */
+ sld rWORD2, rWORD2, rNEG
+ xor. rBITDIF, rWORD1, rWORD2
+ sub rRTN, rWORD1, rWORD2
+ blt- L(highbit)
+ sradi rRTN, rRTN, 63
+ ori rRTN, rRTN, 1
+ blr
+L(highbit):
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
+ blr
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -91,7 +139,7 @@ L(endstring):
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
L(equal):
@@ -99,7 +147,7 @@ L(equal):
blr
L(different):
- ldu rWORD1, -8(rSTR1)
+ ld rWORD1, -8(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
@@ -107,11 +155,10 @@ L(different):
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
blr
-
+#endif
/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
diff --git a/libc/sysdeps/powerpc/preconfigure b/libc/sysdeps/powerpc/preconfigure
new file mode 100644
index 000000000..1741c251f
--- /dev/null
+++ b/libc/sysdeps/powerpc/preconfigure
@@ -0,0 +1,11 @@
+# Check for e500.
+
+case "$machine" in
+powerpc)
+ $CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null > conftest.i
+ if grep -q __NO_FPRS__ conftest.i && ! grep -q _SOFT_FLOAT conftest.i; then
+ base_machine=powerpc machine=powerpc/powerpc32/e500
+ fi
+ rm -f conftest.i
+ ;;
+esac
diff --git a/libc/ports/sysdeps/powerpc/soft-fp/sfp-machine.h b/libc/sysdeps/powerpc/soft-fp/sfp-machine.h
index 508d8698d..041187807 100644
--- a/libc/ports/sysdeps/powerpc/soft-fp/sfp-machine.h
+++ b/libc/sysdeps/powerpc/soft-fp/sfp-machine.h
@@ -41,18 +41,64 @@
R##_c = FP_CLS_NAN; \
} while (0)
+#if defined __NO_FPRS__ && !defined _SOFT_FLOAT
+
+/* Exception flags. We use the bit positions of the appropriate bits
+ in the FPEFSCR. */
+
+# include <fenv_libc.h>
+# include <sysdep.h>
+# include <sys/prctl.h>
+
+int __feraiseexcept_soft (int);
+libc_hidden_proto (__feraiseexcept_soft)
+
+# define FP_EX_INEXACT SPEFSCR_FINXS
+# define FP_EX_INVALID SPEFSCR_FINVS
+# define FP_EX_DIVZERO SPEFSCR_FDBZS
+# define FP_EX_UNDERFLOW SPEFSCR_FUNFS
+# define FP_EX_OVERFLOW SPEFSCR_FOVFS
+
+# define _FP_DECL_EX \
+ int _spefscr __attribute__ ((unused)), _ftrapex __attribute__ ((unused)) = 0
+# define FP_INIT_ROUNDMODE \
+ do \
+ { \
+ int _r; \
+ INTERNAL_SYSCALL_DECL (_err); \
+ \
+ _spefscr = fegetenv_register (); \
+ _r = INTERNAL_SYSCALL (prctl, _err, 2, PR_GET_FPEXC, &_ftrapex); \
+ if (INTERNAL_SYSCALL_ERROR_P (_r, _err)) \
+ _ftrapex = 0; \
+ } \
+ while (0)
+# define FP_INIT_EXCEPTIONS /* Empty. */
+
+# define FP_HANDLE_EXCEPTIONS __feraiseexcept_soft (_fex)
+# define FP_ROUNDMODE (_spefscr & 0x3)
+
+/* Not correct in general, but sufficient for the uses in soft-fp. */
+# define FP_TRAPPING_EXCEPTIONS (_ftrapex & PR_FP_EXC_UND \
+ ? FP_EX_UNDERFLOW \
+ : 0)
+
+#else
+
/* Exception flags. We use the bit positions of the appropriate bits
in the FPSCR, which also correspond to the FE_* bits. This makes
everything easier ;-). */
-#define FP_EX_INVALID (1 << (31 - 2))
-#define FP_EX_OVERFLOW (1 << (31 - 3))
-#define FP_EX_UNDERFLOW (1 << (31 - 4))
-#define FP_EX_DIVZERO (1 << (31 - 5))
-#define FP_EX_INEXACT (1 << (31 - 6))
-
-#define FP_HANDLE_EXCEPTIONS __simulate_exceptions (_fex)
-#define FP_ROUNDMODE __sim_round_mode
-#define FP_TRAPPING_EXCEPTIONS (~__sim_disabled_exceptions & 0x3e000000)
+# define FP_EX_INVALID (1 << (31 - 2))
+# define FP_EX_OVERFLOW (1 << (31 - 3))
+# define FP_EX_UNDERFLOW (1 << (31 - 4))
+# define FP_EX_DIVZERO (1 << (31 - 5))
+# define FP_EX_INEXACT (1 << (31 - 6))
+
+# define FP_HANDLE_EXCEPTIONS __simulate_exceptions (_fex)
+# define FP_ROUNDMODE __sim_round_mode
+# define FP_TRAPPING_EXCEPTIONS (~__sim_disabled_exceptions & 0x3e000000)
+
+#endif
/* FIXME: these variables should be thread specific (see bugzilla bug
15483) and ideally preserved across signal handlers, like hardware
diff --git a/libc/sysdeps/powerpc/sysdep.h b/libc/sysdeps/powerpc/sysdep.h
index 1b5334ad3..bc2cb6681 100644
--- a/libc/sysdeps/powerpc/sysdep.h
+++ b/libc/sysdeps/powerpc/sysdep.h
@@ -144,6 +144,21 @@
#define VRSAVE 256
+/* The 32-bit words of a 64-bit dword are at these offsets in memory. */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define LOWORD 0
+# define HIWORD 4
+#else
+# define LOWORD 4
+# define HIWORD 0
+#endif
+
+/* The high 16-bit word of a 64-bit dword is at this offset in memory. */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define HISHORT 6
+#else
+# define HISHORT 0
+#endif
/* This seems to always be the case on PPC. */
#define ALIGNARG(log2) log2
diff --git a/libc/sysdeps/s390/ffs.c b/libc/sysdeps/s390/ffs.c
index 807441da6..2dbb7430e 100644
--- a/libc/sysdeps/s390/ffs.c
+++ b/libc/sysdeps/s390/ffs.c
@@ -63,6 +63,7 @@ __ffs (x)
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
#undef ffsl
diff --git a/libc/sysdeps/s390/s390-32/stackguard-macros.h b/libc/sysdeps/s390/s390-32/stackguard-macros.h
index b74c5799b..449e8d488 100644
--- a/libc/sysdeps/s390/s390-32/stackguard-macros.h
+++ b/libc/sysdeps/s390/s390-32/stackguard-macros.h
@@ -2,3 +2,14 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
+
+/* On s390/s390x there is no unique pointer guard, instead we use the
+ same value as the stack guard. */
+#define POINTER_CHK_GUARD \
+ ({ \
+ uintptr_t x; \
+ asm ("ear %0,%%a0; l %0,%1(%0)" \
+ : "=a" (x) \
+ : "i" (offsetof (tcbhead_t, stack_guard))); \
+ x; \
+ })
diff --git a/libc/sysdeps/s390/s390-64/stackguard-macros.h b/libc/sysdeps/s390/s390-64/stackguard-macros.h
index 0cebb5f02..c8270fbe7 100644
--- a/libc/sysdeps/s390/s390-64/stackguard-macros.h
+++ b/libc/sysdeps/s390/s390-64/stackguard-macros.h
@@ -2,3 +2,17 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
+
+/* On s390/s390x there is no unique pointer guard, instead we use the
+ same value as the stack guard. */
+#define POINTER_CHK_GUARD \
+ ({ \
+ uintptr_t x; \
+ asm ("ear %0,%%a0;" \
+ "sllg %0,%0,32;" \
+ "ear %0,%%a1;" \
+ "lg %0,%1(%0)" \
+ : "=a" (x) \
+ : "i" (offsetof (tcbhead_t, stack_guard))); \
+ x; \
+ })
diff --git a/libc/sysdeps/sh/stackguard-macros.h b/libc/sysdeps/sh/stackguard-macros.h
new file mode 100644
index 000000000..55a5771b6
--- /dev/null
+++ b/libc/sysdeps/sh/stackguard-macros.h
@@ -0,0 +1,6 @@
+#include <stdint.h>
+
+extern uintptr_t __stack_chk_guard;
+#define STACK_CHK_GUARD __stack_chk_guard
+
+#define POINTER_CHK_GUARD THREAD_GET_POINTER_GUARD()
diff --git a/libc/sysdeps/sparc/fpu/libm-test-ulps b/libc/sysdeps/sparc/fpu/libm-test-ulps
index cfc72a661..ecb871d6a 100644
--- a/libc/sysdeps/sparc/fpu/libm-test-ulps
+++ b/libc/sysdeps/sparc/fpu/libm-test-ulps
@@ -7505,6 +7505,34 @@ idouble: 1
Test "gamma (-0.5)":
ildouble: 1
ldouble: 1
+Test "gamma (-0x1p-10)":
+double: 1
+idouble: 1
+Test "gamma (-0x1p-15)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "gamma (-0x1p-20)":
+double: 1
+idouble: 1
+Test "gamma (-0x1p-25)":
+ildouble: 1
+ldouble: 1
+Test "gamma (-0x1p-30)":
+ildouble: 1
+ldouble: 1
+Test "gamma (-0x1p-40)":
+ildouble: 1
+ldouble: 1
+Test "gamma (-0x1p-5)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "gamma (-0x1p-64)":
+ildouble: 1
+ldouble: 1
Test "gamma (0.7)":
double: 1
float: 1
@@ -7512,6 +7540,25 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "gamma (0x1p-10)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "gamma (0x1p-30)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "gamma (0x1p-5)":
+ildouble: 1
+ldouble: 1
+Test "gamma (0x1p-60)":
+ildouble: 1
+ldouble: 1
+Test "gamma (0x1p-70)":
+ildouble: 1
+ldouble: 1
Test "gamma (1.2)":
double: 1
float: 2
@@ -7725,6 +7772,17 @@ double: 2
float: 2
idouble: 2
ifloat: 2
+Test "jn (2, 0x1p1023)":
+ildouble: 1
+ldouble: 1
+Test "jn (2, 0x1p127)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (2, 0x1p16383)":
+ildouble: 2
+ldouble: 2
Test "jn (2, 2.4048255576957729)":
double: 2
float: 1
@@ -7802,6 +7860,34 @@ ldouble: 3
Test "lgamma (-0.5)":
ildouble: 1
ldouble: 1
+Test "lgamma (-0x1p-10)":
+double: 1
+idouble: 1
+Test "lgamma (-0x1p-15)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (-0x1p-20)":
+double: 1
+idouble: 1
+Test "lgamma (-0x1p-25)":
+ildouble: 1
+ldouble: 1
+Test "lgamma (-0x1p-30)":
+ildouble: 1
+ldouble: 1
+Test "lgamma (-0x1p-40)":
+ildouble: 1
+ldouble: 1
+Test "lgamma (-0x1p-5)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (-0x1p-64)":
+ildouble: 1
+ldouble: 1
Test "lgamma (0.7)":
double: 1
float: 1
@@ -7809,6 +7895,25 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "lgamma (0x1p-10)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (0x1p-30)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (0x1p-5)":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0x1p-60)":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0x1p-70)":
+ildouble: 1
+ldouble: 1
Test "lgamma (1.2)":
double: 1
float: 2
@@ -9239,7 +9344,9 @@ ildouble: 5
ldouble: 5
Test "yn (10, 1.0)":
double: 1
+float: 2
idouble: 1
+ifloat: 2
ildouble: 1
ldouble: 1
Test "yn (10, 10.0)":
@@ -9251,7 +9358,25 @@ ildouble: 2
ldouble: 2
Test "yn (10, 2.0)":
double: 2
+float: 1
idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (2, 0x1.ffff62p+99)":
+double: 1
+idouble: 1
+Test "yn (2, 0x1p1023)":
+ildouble: 1
+ldouble: 1
+Test "yn (2, 0x1p127)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (2, 0x1p16383)":
ildouble: 2
ldouble: 2
Test "yn (3, 0.125)":
diff --git a/libc/sysdeps/sparc/sparc32/soft-fp/q_neg.c b/libc/sysdeps/sparc/sparc32/soft-fp/q_neg.c
index 551c40887..5e2449c91 100644
--- a/libc/sysdeps/sparc/sparc32/soft-fp/q_neg.c
+++ b/libc/sysdeps/sparc/sparc32/soft-fp/q_neg.c
@@ -24,7 +24,6 @@
long double _Q_neg(const long double a)
{
- FP_DECL_EX;
long double c = a;
#if (__BYTE_ORDER == __BIG_ENDIAN)
@@ -36,11 +35,9 @@ long double _Q_neg(const long double a)
#else
FP_DECL_Q(A); FP_DECL_Q(C);
- FP_UNPACK_Q(A, a);
+ FP_UNPACK_RAW_Q(A, a);
FP_NEG_Q(C, A);
- FP_PACK_Q(c, C);
+ FP_PACK_RAW_Q(c, C);
#endif
- FP_CLEAR_EXCEPTIONS;
- FP_HANDLE_EXCEPTIONS;
return c;
}
diff --git a/libc/sysdeps/sparc/sparc32/stackguard-macros.h b/libc/sysdeps/sparc/sparc32/stackguard-macros.h
index c0b02b0bb..1eef0f19f 100644
--- a/libc/sysdeps/sparc/sparc32/stackguard-macros.h
+++ b/libc/sysdeps/sparc/sparc32/stackguard-macros.h
@@ -2,3 +2,6 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("ld [%%g7+0x18], %0" : "=r" (x)); x; })
diff --git a/libc/sysdeps/sparc/sparc64/stackguard-macros.h b/libc/sysdeps/sparc/sparc64/stackguard-macros.h
index 80f063558..cc0c12c04 100644
--- a/libc/sysdeps/sparc/sparc64/stackguard-macros.h
+++ b/libc/sysdeps/sparc/sparc64/stackguard-macros.h
@@ -2,3 +2,6 @@
#define STACK_CHK_GUARD \
({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ uintptr_t x; asm ("ldx [%%g7+0x30], %0" : "=r" (x)); x; })
diff --git a/libc/sysdeps/unix/Makefile b/libc/sysdeps/unix/Makefile
index 375561f0d..2b607a007 100644
--- a/libc/sysdeps/unix/Makefile
+++ b/libc/sysdeps/unix/Makefile
@@ -51,12 +51,14 @@ $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
for call in $(unix-stub-syscalls); do \
case $$call in \
*@@*) \
- ver=$${call##*@}; call=$${call%%@*}; ver=$${ver//./_}; \
+ ver=$${call##*@}; call=$${call%%@*}; \
+ ver=`echo "$ver" | sed 's/\./_/g'`; \
echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
echo "versioned_symbol (libc, __$${call}_$${ver}, $$call, $$ver);"\
;; \
*@*) \
- ver=$${call##*@}; call=$${call%%@*}; ver=$${ver//./_}; \
+ ver=$${call##*@}; call=$${call%%@*}; \
+ ver=`echo "$ver" | sed 's/\./_/g'`; \
echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
echo "compat_symbol (libc, __$${call}_$${ver}, $$call, $$ver);" \
;; \
diff --git a/libc/sysdeps/unix/make-syscalls.sh b/libc/sysdeps/unix/make-syscalls.sh
index f04f2abb3..6eba62c94 100644
--- a/libc/sysdeps/unix/make-syscalls.sh
+++ b/libc/sysdeps/unix/make-syscalls.sh
@@ -275,7 +275,7 @@ while read file srcfile caller syscall args strong weak; do
# name in the vDSO and KERNEL_X.Y is its symbol version.
vdso_symbol="${vdso_syscall%@*}"
vdso_symver="${vdso_syscall#*@}"
- vdso_symver="${vdso_symver//./_}"
+ vdso_symver=`echo "$vdso_symver" | sed 's/\./_/g'`
echo "\
\$(foreach p,\$(sysd-rules-targets),\$(objpfx)\$(patsubst %,\$p,$file).os): \\
\$(..)sysdeps/unix/make-syscalls.sh\
diff --git a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
index b5929bd29..9b0421ee0 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -96,6 +96,9 @@
#ifndef __O_DSYNC
# define __O_DSYNC 010000
#endif
+#ifndef __O_TMPFILE
+# define __O_TMPFILE 020200000
+#endif
#ifndef F_GETLK
# ifndef __USE_FILE_OFFSET64
@@ -128,6 +131,7 @@
# define O_DIRECT __O_DIRECT /* Direct disk access. */
# define O_NOATIME __O_NOATIME /* Do not set atime. */
# define O_PATH __O_PATH /* Resolve pathname but do not open file. */
+# define O_TMPFILE __O_TMPFILE /* Atomically create nameless file. */
#endif
/* For now, Linux has no separate synchronicitiy options for read
diff --git a/libc/sysdeps/unix/sysv/linux/configure b/libc/sysdeps/unix/sysv/linux/configure
index 76cfea1dc..88fab5662 100644
--- a/libc/sysdeps/unix/sysv/linux/configure
+++ b/libc/sysdeps/unix/sysv/linux/configure
@@ -187,7 +187,7 @@ case "$machine" in
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.6.16
;;
- powerpc/powerpc32)
+ powerpc/powerpc32*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.6.16
;;
diff --git a/libc/sysdeps/unix/sysv/linux/configure.in b/libc/sysdeps/unix/sysv/linux/configure.in
index e55d9fdb0..5e5902d8e 100644
--- a/libc/sysdeps/unix/sysv/linux/configure.in
+++ b/libc/sysdeps/unix/sysv/linux/configure.in
@@ -43,7 +43,7 @@ case "$machine" in
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.6.16
;;
- powerpc/powerpc32)
+ powerpc/powerpc32*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.6.16
;;
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
new file mode 100644
index 000000000..33be9e8db
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
@@ -0,0 +1,54 @@
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#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 4096
+
+/* System default stack size. */
+#define SIGSTKSZ 16384
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+ } stack_t;
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies
index 70c0d2eda..70c0d2eda 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/405/Implies
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies
index c3e52c550..c3e52c550 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/440/Implies
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies
index 2829f9cca..2829f9cca 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/464/Implies
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies
index 80f917079..80f917079 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/476/Implies
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies
new file mode 100644
index 000000000..00365c1cf
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies
@@ -0,0 +1,3 @@
+powerpc/powerpc32/e500/nofpu
+powerpc/nofpu
+powerpc/soft-fp
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
index 926f34207..082d302e8 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -151,15 +151,15 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
# else
- lis r7,(_dl_hwcap+4)@ha
- lwz r7,(_dl_hwcap+4)@l(r7)
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
@@ -262,8 +262,8 @@ ENTRY(__CONTEXT_FUNC_NAME)
# endif
#endif
-#ifdef __GETCONTEXT_EXTRA
- __GETCONTEXT_EXTRA
+#ifdef __CONTEXT_ENABLE_E500
+ getcontext_e500
#endif
/* We need to set up parms and call sigprocmask which will clobber
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
index 95902b13f..70e3c9762 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
@@ -47,7 +47,9 @@ ENTRY(__makecontext)
#ifdef PIC
mflr r0
cfi_register(lr,r0)
- bl 1f
+ /* Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(exitcode)-1b
mtlr r0
@@ -136,7 +138,9 @@ ENTRY(__novec_makecontext)
#ifdef PIC
mflr r0
cfi_register(lr,r0)
- bl 1f
+ /* Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(novec_exitcode)-1b
mtlr r0
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies
index 40836b6fb..40836b6fb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext-extra.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h
index dcbc84c1d..9eb1a9561 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext-extra.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h
@@ -1,7 +1,6 @@
-/* Jump to a new context. Support for restoring high parts of registers.
+/* getcontext/setcontext/makecontext support for e500 high parts of registers.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Joseph Myers <joseph@codesourcery.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
@@ -17,7 +16,56 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-.macro setcontext_extra
+#ifndef _CONTEXT_E500_H
+#define _CONTEXT_E500_H 1
+
+#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
+
+# define __CONTEXT_ENABLE_E500 1
+
+/* We follow the kernel's layout, which saves the high parts of the
+ SPE registers in the vregs area, immediately followed by the ACC
+ value (call-clobbered, not handled here) and the SPEFSCR value. */
+
+.macro getcontext_e500
+ la r10,(_UC_VREGS)(r3)
+ evstwwe r0,(0*4)(r10)
+ evstwwe r1,(1*4)(r10)
+ evstwwe r2,(2*4)(r10)
+ evstwwe r3,(3*4)(r10)
+ evstwwe r4,(4*4)(r10)
+ evstwwe r5,(5*4)(r10)
+ evstwwe r6,(6*4)(r10)
+ evstwwe r7,(7*4)(r10)
+ evstwwe r8,(8*4)(r10)
+ evstwwe r9,(9*4)(r10)
+ evstwwe r10,(10*4)(r10)
+ evstwwe r11,(11*4)(r10)
+ evstwwe r12,(12*4)(r10)
+ evstwwe r13,(13*4)(r10)
+ evstwwe r14,(14*4)(r10)
+ evstwwe r15,(15*4)(r10)
+ evstwwe r16,(16*4)(r10)
+ evstwwe r17,(17*4)(r10)
+ evstwwe r18,(18*4)(r10)
+ evstwwe r19,(19*4)(r10)
+ evstwwe r20,(20*4)(r10)
+ evstwwe r21,(21*4)(r10)
+ evstwwe r22,(22*4)(r10)
+ evstwwe r23,(23*4)(r10)
+ evstwwe r24,(24*4)(r10)
+ evstwwe r25,(25*4)(r10)
+ evstwwe r26,(26*4)(r10)
+ evstwwe r27,(27*4)(r10)
+ evstwwe r28,(28*4)(r10)
+ evstwwe r29,(29*4)(r10)
+ evstwwe r30,(30*4)(r10)
+ evstwwe r31,(31*4)(r10)
+ mfspefscr r9
+ stw r9,(34*4)(r10)
+.endm
+
+.macro setcontext_e500
lwz r3,_UC_VREGS+(0*4)(r31)
evmergelo r0,r3,r0
lwz r3,_UC_VREGS+(1*4)(r31)
@@ -86,7 +134,11 @@
evmergelo r30,r3,r30
lwz r3,_UC_VREGS+(31*4)(r31)
evmergelo r31,r3,r31
- lwz r3,_UC_VREGS+(32*4)(r31)
+ lwz r3,_UC_VREGS+(34*4)(r31)
mtspefscr r3
.endm
-#define __SETCONTEXT_EXTRA setcontext_extra
+#else
+# undef __CONTEXT_ENABLE_E500
+#endif
+
+#endif /* context-e500.h */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
index 90d9dcd42..8bc3c7a43 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
@@ -24,6 +24,8 @@
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <context-e500.h>
+
#define __CONTEXT_FUNC_NAME __getcontext
#undef __CONTEXT_ENABLE_FPRS
#undef __CONTEXT_ENABLE_VRS
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/c++-types.data b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data
index fde53bf33..fde53bf33 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/c++-types.data
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/c++-types.data
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/ld.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist
index d71611f02..d71611f02 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/ld.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/ld.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libBrokenLocale.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist
index f4ca37f44..f4ca37f44 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libBrokenLocale.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libBrokenLocale.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libanl.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist
index c9755d8a3..c9755d8a3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libanl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libanl.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index 9b6d66374..9b6d66374 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libcrypt.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist
index 1df145f26..1df145f26 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libcrypt.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libcrypt.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libdl.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist
index 62e6b41ed..62e6b41ed 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libdl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libdl.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist
index 9bd593c0e..9bd593c0e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libm.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libnsl.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist
index 4241e2d88..4241e2d88 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libnsl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libnsl.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libpthread.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
index c8a2a0471..c8a2a0471 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libpthread.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libresolv.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist
index f68333d4a..f68333d4a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libresolv.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libresolv.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/librt.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist
index af7df27cb..af7df27cb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/librt.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/librt.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libthread_db.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist
index f33138067..f33138067 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libthread_db.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libthread_db.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libutil.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist
index 7422687e3..7422687e3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nptl/libutil.abilist
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libutil.abilist
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data
index 0743b08a3..b87936cb3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data
@@ -35,7 +35,7 @@ libc.so: realloc
libm.so: __signbit
libm.so: __signbitf
libm.so: __signbitl
-libm.so: copysignl
+libm.so: copysignl ?
libm.so: fabsl
libm.so: fegetround
libm.so: matherr
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
index 06061eab9..5f8653ffb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
@@ -24,6 +24,8 @@
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <context-e500.h>
+
#define __CONTEXT_FUNC_NAME __setcontext
#undef __CONTEXT_ENABLE_FPRS
#undef __CONTEXT_ENABLE_VRS
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
index 2150eec3c..de6d56f96 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
@@ -24,6 +24,8 @@
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <context-e500.h>
+
#define __CONTEXT_FUNC_NAME __swapcontext
#undef __CONTEXT_ENABLE_FPRS
#undef __CONTEXT_ENABLE_VRS
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
index fb7744839..6525cf742 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -79,15 +79,15 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
#else
- lis r7,(_dl_hwcap+4)@ha
- lwz r7,(_dl_hwcap+4)@l(r7)
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
#endif
#ifdef __CONTEXT_ENABLE_FPRS
@@ -243,8 +243,8 @@ ENTRY(__CONTEXT_FUNC_NAME)
lfd fp31,_UC_FREGS+(31*8)(r31)
#endif /* __CONTEXT_ENABLE_FPRS */
-#ifdef __SETCONTEXT_EXTRA
- __SETCONTEXT_EXTRA
+#ifdef __CONTEXT_ENABLE_E500
+ setcontext_e500
#endif
/* Restore LR and CCR, and set CTR to the NIP value */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index 7e0612595..caa5b8932 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -152,15 +152,15 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
# else
- lis r7,(_dl_hwcap+4)@ha
- lwz r7,(_dl_hwcap+4)@l(r7)
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif
# ifdef __CONTEXT_ENABLE_VRS
@@ -265,8 +265,8 @@ ENTRY(__CONTEXT_FUNC_NAME)
# endif /* __CONTEXT_ENABLE_VRS */
#endif /* __CONTEXT_ENABLE_FPRS */
-#ifdef __GETCONTEXT_EXTRA
- __GETCONTEXT_EXTRA
+#ifdef __CONTEXT_ENABLE_E500
+ getcontext_e500
#endif
/* Restore ucontext (parm1) from stack. */
@@ -312,14 +312,14 @@ ENTRY(__CONTEXT_FUNC_NAME)
mtlr r8
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
# else
- lis r7,(_dl_hwcap+4)@ha
- lwz r7,(_dl_hwcap+4)@l(r7)
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
la r10,(_UC_VREGS)(r31)
@@ -472,8 +472,8 @@ ENTRY(__CONTEXT_FUNC_NAME)
lfd fp31,_UC_FREGS+(31*8)(r31)
#endif /* __CONTEXT_ENABLE_FPRS */
-#ifdef __SETCONTEXT_EXTRA
- __SETCONTEXT_EXTRA
+#ifdef __CONTEXT_ENABLE_E500
+ setcontext_e500
#endif
/* Restore LR and CCR, and set CTR to the NIP value */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 4a1666938..32fc47c3f 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -124,8 +124,10 @@ L(noparms):
/* If the target function returns we need to do some cleanup. We use a
code trick to get the address of our cleanup function into the link
- register. Do not add any code between here and L(exitcode). */
- bl L(gotexitcodeaddr);
+ register. Do not add any code between here and L(exitcode).
+ Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,L(gotexitcodeaddr);
/* This is the helper code which gets called if a function which
is registered with 'makecontext' returns. In this case we
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 01084bb71..f384bc7fd 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -39,6 +39,7 @@
#define __O_DIRECT 0x100000 /* direct disk access hint */
#define __O_NOATIME 0x200000 /* Do not set atime. */
#define __O_PATH 0x1000000 /* Resolve pathname but do not open file. */
+#define __O_TMPFILE 0x2010000 /* Atomically create nameless file. */
#if __WORDSIZE == 64
# define __O_LARGEFILE 0
diff --git a/libc/sysdeps/unix/sysv/linux/tst-fanotify.c b/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
index b21e160ca..ad9836b58 100644
--- a/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
+++ b/libc/sysdeps/unix/sysv/linux/tst-fanotify.c
@@ -29,14 +29,15 @@ do_test (void)
fd = fanotify_init (0, 0);
if (fd < 0)
{
- switch (errno) {
- case ENOSYS:
- puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
- return 0;
- case EPERM:
- puts ("SKIP: missing proper permissions for runtime test");
- return 0;
- }
+ switch (errno)
+ {
+ case ENOSYS:
+ puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
+ return 0;
+ case EPERM:
+ puts ("SKIP: missing proper permissions for runtime test");
+ return 0;
+ }
perror ("fanotify_init (0, 0) failed");
return 1;
diff --git a/libc/sysdeps/x86_64/ffs.c b/libc/sysdeps/x86_64/ffs.c
index 27013d6ae..07ee7dd4a 100644
--- a/libc/sysdeps/x86_64/ffs.c
+++ b/libc/sysdeps/x86_64/ffs.c
@@ -35,4 +35,5 @@ __ffs (int x)
return cnt + 1;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
diff --git a/libc/sysdeps/x86_64/fpu/printf_fphex.c b/libc/sysdeps/x86_64/fpu/printf_fphex.c
index c85d1f79f..be55f9cf6 100644
--- a/libc/sysdeps/x86_64/fpu/printf_fphex.c
+++ b/libc/sysdeps/x86_64/fpu/printf_fphex.c
@@ -25,10 +25,11 @@ do { \
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
- \
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
zero_mantissa = num == 0; \
\
@@ -61,7 +62,7 @@ do { \
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
if (exponent == 0) \
{ \
diff --git a/libc/sysdeps/x86_64/memset.S b/libc/sysdeps/x86_64/memset.S
index 6c69f4b44..9b1de89d9 100644
--- a/libc/sysdeps/x86_64/memset.S
+++ b/libc/sysdeps/x86_64/memset.S
@@ -19,10 +19,6 @@
#include <sysdep.h>
-#ifndef ALIGN
-# define ALIGN(n) .p2align n
-#endif
-
.text
#if !defined NOT_IN_libc
ENTRY(__bzero)
@@ -71,12 +67,12 @@ L(entry_from_bzero):
L(return):
rep
ret
- ALIGN (4)
+ .p2align 4
L(between_32_64_bytes):
movdqu %xmm8, 16(%rdi)
movdqu %xmm8, -32(%rdi,%rdx)
ret
- ALIGN (4)
+ .p2align 4
L(loop_start):
leaq 64(%rdi), %rcx
movdqu %xmm8, (%rdi)
@@ -92,7 +88,7 @@ L(loop_start):
andq $-64, %rdx
cmpq %rdx, %rcx
je L(return)
- ALIGN (4)
+ .p2align 4
L(loop):
movdqa %xmm8, (%rcx)
movdqa %xmm8, 16(%rcx)
diff --git a/libc/sysdeps/x86_64/multiarch/Makefile b/libc/sysdeps/x86_64/multiarch/Makefile
index 5ab950a53..9fd0fd64c 100644
--- a/libc/sysdeps/x86_64/multiarch/Makefile
+++ b/libc/sysdeps/x86_64/multiarch/Makefile
@@ -8,7 +8,7 @@ ifeq ($(subdir),string)
sysdep_routines += strncat-c stpncpy-c strncpy-c strcmp-ssse3 \
strcmp-sse2-unaligned strncmp-ssse3 \
- strend-sse4 memcmp-sse4 memcpy-ssse3 \
+ memcmp-sse4 memcpy-ssse3 \
memcpy-sse2-unaligned mempcpy-ssse3 \
memmove-ssse3 memcpy-ssse3-back mempcpy-ssse3-back \
memmove-ssse3-back strcasestr-nonascii strcasecmp_l-ssse3 \
@@ -17,7 +17,7 @@ sysdep_routines += strncat-c stpncpy-c strncpy-c strcmp-ssse3 \
strcpy-sse2-unaligned strncpy-sse2-unaligned \
stpcpy-sse2-unaligned stpncpy-sse2-unaligned \
strcat-sse2-unaligned strncat-sse2-unaligned \
- strrchr-sse2-no-bsf strchr-sse2-no-bsf memcmp-ssse3
+ strchr-sse2-no-bsf memcmp-ssse3
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c varshift
CFLAGS-varshift.c += -msse4
diff --git a/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c
index f8756d7af..71beab82e 100644
--- a/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c
+++ b/libc/sysdeps/x86_64/multiarch/ifunc-impl-list.c
@@ -110,7 +110,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/x86_64/multiarch/strchr.S. */
IFUNC_IMPL (i, name, strchr,
- IFUNC_IMPL_ADD (array, i, strchr, HAS_SSE4_2, __strchr_sse42)
IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2_no_bsf)
IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2))
@@ -177,12 +176,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
__strpbrk_sse42)
IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_sse2))
- /* Support sysdeps/x86_64/multiarch/strrchr.S. */
- IFUNC_IMPL (i, name, strrchr,
- IFUNC_IMPL_ADD (array, i, strrchr, HAS_SSE4_2,
- __strrchr_sse42)
- IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2_no_bsf)
- IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2))
/* Support sysdeps/x86_64/multiarch/strspn.S. */
IFUNC_IMPL (i, name, strspn,
diff --git a/libc/sysdeps/x86_64/multiarch/memcmp-sse4.S b/libc/sysdeps/x86_64/multiarch/memcmp-sse4.S
index 1ed4200f4..d7b147e5c 100644
--- a/libc/sysdeps/x86_64/multiarch/memcmp-sse4.S
+++ b/libc/sysdeps/x86_64/multiarch/memcmp-sse4.S
@@ -25,10 +25,6 @@
# define MEMCMP __memcmp_sse4_1
# endif
-# ifndef ALIGN
-# define ALIGN(n) .p2align n
-# endif
-
# define JMPTBL(I, B) (I - B)
# define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
@@ -60,7 +56,7 @@ ENTRY (MEMCMP)
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(firstbyte):
movzbl (%rdi), %eax
movzbl (%rsi), %ecx
@@ -68,7 +64,7 @@ L(firstbyte):
ret
# endif
- ALIGN (4)
+ .p2align 4
L(79bytesormore):
movdqu (%rsi), %xmm1
movdqu (%rdi), %xmm2
@@ -316,7 +312,7 @@ L(less32bytesin256):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(512bytesormore):
# ifdef DATA_CACHE_SIZE_HALF
mov $DATA_CACHE_SIZE_HALF, %R8_LP
@@ -329,7 +325,7 @@ L(512bytesormore):
cmp %r8, %rdx
ja L(L2_L3_cache_unaglined)
sub $64, %rdx
- ALIGN (4)
+ .p2align 4
L(64bytesormore_loop):
movdqu (%rdi), %xmm2
pxor (%rsi), %xmm2
@@ -361,7 +357,7 @@ L(64bytesormore_loop):
L(L2_L3_cache_unaglined):
sub $64, %rdx
- ALIGN (4)
+ .p2align 4
L(L2_L3_unaligned_128bytes_loop):
prefetchnta 0x1c0(%rdi)
prefetchnta 0x1c0(%rsi)
@@ -396,7 +392,7 @@ L(L2_L3_unaligned_128bytes_loop):
/*
* This case is for machines which are sensitive for unaligned instructions.
*/
- ALIGN (4)
+ .p2align 4
L(2aligned):
cmp $128, %rdx
ja L(128bytesormorein2aligned)
@@ -444,7 +440,7 @@ L(less32bytesin64in2alinged):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(128bytesormorein2aligned):
cmp $512, %rdx
ja L(512bytesormorein2aligned)
@@ -519,7 +515,7 @@ L(less32bytesin128in2aligned):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(256bytesormorein2aligned):
sub $256, %rdx
@@ -632,7 +628,7 @@ L(less32bytesin256in2alinged):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(512bytesormorein2aligned):
# ifdef DATA_CACHE_SIZE_HALF
mov $DATA_CACHE_SIZE_HALF, %R8_LP
@@ -646,7 +642,7 @@ L(512bytesormorein2aligned):
ja L(L2_L3_cache_aglined)
sub $64, %rdx
- ALIGN (4)
+ .p2align 4
L(64bytesormore_loopin2aligned):
movdqa (%rdi), %xmm2
pxor (%rsi), %xmm2
@@ -678,7 +674,7 @@ L(64bytesormore_loopin2aligned):
L(L2_L3_cache_aglined):
sub $64, %rdx
- ALIGN (4)
+ .p2align 4
L(L2_L3_aligned_128bytes_loop):
prefetchnta 0x1c0(%rdi)
prefetchnta 0x1c0(%rsi)
@@ -711,7 +707,7 @@ L(L2_L3_aligned_128bytes_loop):
BRANCH_TO_JMPTBL_ENTRY(L(table_64bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(64bytesormore_loop_end):
add $16, %rdi
add $16, %rsi
@@ -806,7 +802,7 @@ L(8bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(12bytes):
mov -12(%rdi), %rax
mov -12(%rsi), %rcx
@@ -827,7 +823,7 @@ L(0bytes):
# ifndef USE_AS_WMEMCMP
/* unreal case for wmemcmp */
- ALIGN (4)
+ .p2align 4
L(65bytes):
movdqu -65(%rdi), %xmm1
movdqu -65(%rsi), %xmm2
@@ -864,7 +860,7 @@ L(9bytes):
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(13bytes):
mov -13(%rdi), %rax
mov -13(%rsi), %rcx
@@ -877,7 +873,7 @@ L(13bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(5bytes):
mov -5(%rdi), %eax
mov -5(%rsi), %ecx
@@ -888,7 +884,7 @@ L(5bytes):
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(66bytes):
movdqu -66(%rdi), %xmm1
movdqu -66(%rsi), %xmm2
@@ -929,7 +925,7 @@ L(10bytes):
sub %ecx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(14bytes):
mov -14(%rdi), %rax
mov -14(%rsi), %rcx
@@ -942,7 +938,7 @@ L(14bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(6bytes):
mov -6(%rdi), %eax
mov -6(%rsi), %ecx
@@ -958,7 +954,7 @@ L(2bytes):
sub %ecx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(67bytes):
movdqu -67(%rdi), %xmm2
movdqu -67(%rsi), %xmm1
@@ -997,7 +993,7 @@ L(11bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(15bytes):
mov -15(%rdi), %rax
mov -15(%rsi), %rcx
@@ -1010,7 +1006,7 @@ L(15bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(7bytes):
mov -7(%rdi), %eax
mov -7(%rsi), %ecx
@@ -1023,7 +1019,7 @@ L(7bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(3bytes):
movzwl -3(%rdi), %eax
movzwl -3(%rsi), %ecx
@@ -1036,7 +1032,7 @@ L(1bytes):
ret
# endif
- ALIGN (4)
+ .p2align 4
L(68bytes):
movdqu -68(%rdi), %xmm2
movdqu -68(%rsi), %xmm1
@@ -1079,7 +1075,7 @@ L(20bytes):
# ifndef USE_AS_WMEMCMP
/* unreal cases for wmemcmp */
- ALIGN (4)
+ .p2align 4
L(69bytes):
movdqu -69(%rsi), %xmm1
movdqu -69(%rdi), %xmm2
@@ -1115,7 +1111,7 @@ L(21bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(70bytes):
movdqu -70(%rsi), %xmm1
movdqu -70(%rdi), %xmm2
@@ -1151,7 +1147,7 @@ L(22bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(71bytes):
movdqu -71(%rsi), %xmm1
movdqu -71(%rdi), %xmm2
@@ -1188,7 +1184,7 @@ L(23bytes):
ret
# endif
- ALIGN (4)
+ .p2align 4
L(72bytes):
movdqu -72(%rsi), %xmm1
movdqu -72(%rdi), %xmm2
@@ -1227,7 +1223,7 @@ L(24bytes):
# ifndef USE_AS_WMEMCMP
/* unreal cases for wmemcmp */
- ALIGN (4)
+ .p2align 4
L(73bytes):
movdqu -73(%rsi), %xmm1
movdqu -73(%rdi), %xmm2
@@ -1265,7 +1261,7 @@ L(25bytes):
sub %ecx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(74bytes):
movdqu -74(%rsi), %xmm1
movdqu -74(%rdi), %xmm2
@@ -1302,7 +1298,7 @@ L(26bytes):
movzwl -2(%rsi), %ecx
jmp L(diffin2bytes)
- ALIGN (4)
+ .p2align 4
L(75bytes):
movdqu -75(%rsi), %xmm1
movdqu -75(%rdi), %xmm2
@@ -1342,7 +1338,7 @@ L(27bytes):
xor %eax, %eax
ret
# endif
- ALIGN (4)
+ .p2align 4
L(76bytes):
movdqu -76(%rsi), %xmm1
movdqu -76(%rdi), %xmm2
@@ -1388,7 +1384,7 @@ L(28bytes):
# ifndef USE_AS_WMEMCMP
/* unreal cases for wmemcmp */
- ALIGN (4)
+ .p2align 4
L(77bytes):
movdqu -77(%rsi), %xmm1
movdqu -77(%rdi), %xmm2
@@ -1430,7 +1426,7 @@ L(29bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(78bytes):
movdqu -78(%rsi), %xmm1
movdqu -78(%rdi), %xmm2
@@ -1470,7 +1466,7 @@ L(30bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(79bytes):
movdqu -79(%rsi), %xmm1
movdqu -79(%rdi), %xmm2
@@ -1510,7 +1506,7 @@ L(31bytes):
xor %eax, %eax
ret
# endif
- ALIGN (4)
+ .p2align 4
L(64bytes):
movdqu -64(%rdi), %xmm2
movdqu -64(%rsi), %xmm1
@@ -1548,7 +1544,7 @@ L(32bytes):
/*
* Aligned 8 bytes to avoid 2 branch "taken" in one 16 alinged code block.
*/
- ALIGN (3)
+ .p2align 3
L(less16bytes):
movsbq %dl, %rdx
mov (%rsi, %rdx), %rcx
@@ -1585,7 +1581,7 @@ L(diffin2bytes):
sub %ecx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(end):
and $0xff, %eax
and $0xff, %ecx
@@ -1599,7 +1595,7 @@ L(end):
neg %eax
ret
- ALIGN (4)
+ .p2align 4
L(nequal_bigger):
ret
@@ -1611,7 +1607,7 @@ L(unreal_case):
END (MEMCMP)
.section .rodata.sse4.1,"a",@progbits
- ALIGN (3)
+ .p2align 3
# ifndef USE_AS_WMEMCMP
L(table_64bytes):
.int JMPTBL (L(0bytes), L(table_64bytes))
diff --git a/libc/sysdeps/x86_64/multiarch/memcmp-ssse3.S b/libc/sysdeps/x86_64/multiarch/memcmp-ssse3.S
index e319df926..e04f918df 100644
--- a/libc/sysdeps/x86_64/multiarch/memcmp-ssse3.S
+++ b/libc/sysdeps/x86_64/multiarch/memcmp-ssse3.S
@@ -25,10 +25,6 @@
# define MEMCMP __memcmp_ssse3
# endif
-# ifndef ALIGN
-# define ALIGN(n) .p2align n
-# endif
-
/* Warning!
wmemcmp has to use SIGNED comparison for elements.
memcmp has to use UNSIGNED comparison for elemnts.
@@ -50,7 +46,7 @@ ENTRY (MEMCMP)
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
/* ECX >= 32. */
L(48bytesormore):
movdqu (%rdi), %xmm3
@@ -90,7 +86,7 @@ L(48bytesormore):
je L(shr_6)
jmp L(shr_7)
- ALIGN (2)
+ .p2align 2
L(next_unaligned_table):
cmp $8, %edx
je L(shr_8)
@@ -117,7 +113,7 @@ L(next_unaligned_table):
jmp L(shr_12)
# endif
- ALIGN (4)
+ .p2align 4
L(shr_0):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -137,7 +133,7 @@ L(shr_0):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_0_gobble):
movdqa (%rsi), %xmm0
xor %eax, %eax
@@ -180,7 +176,7 @@ L(next):
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(shr_1):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -207,7 +203,7 @@ L(shr_1):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_1_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -258,7 +254,7 @@ L(shr_1_gobble_next):
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_2):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -285,7 +281,7 @@ L(shr_2):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_2_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -335,7 +331,7 @@ L(shr_2_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_3):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -362,7 +358,7 @@ L(shr_3):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_3_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -414,7 +410,7 @@ L(shr_3_gobble_next):
# endif
- ALIGN (4)
+ .p2align 4
L(shr_4):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -441,7 +437,7 @@ L(shr_4):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_4_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -493,7 +489,7 @@ L(shr_4_gobble_next):
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(shr_5):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -520,7 +516,7 @@ L(shr_5):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_5_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -570,7 +566,7 @@ L(shr_5_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_6):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -597,7 +593,7 @@ L(shr_6):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_6_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -647,7 +643,7 @@ L(shr_6_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_7):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -674,7 +670,7 @@ L(shr_7):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_7_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -726,7 +722,7 @@ L(shr_7_gobble_next):
# endif
- ALIGN (4)
+ .p2align 4
L(shr_8):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -753,7 +749,7 @@ L(shr_8):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_8_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -805,7 +801,7 @@ L(shr_8_gobble_next):
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(shr_9):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -832,7 +828,7 @@ L(shr_9):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_9_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -882,7 +878,7 @@ L(shr_9_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_10):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -909,7 +905,7 @@ L(shr_10):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_10_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -959,7 +955,7 @@ L(shr_10_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_11):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -986,7 +982,7 @@ L(shr_11):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_11_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -1038,7 +1034,7 @@ L(shr_11_gobble_next):
# endif
- ALIGN (4)
+ .p2align 4
L(shr_12):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -1065,7 +1061,7 @@ L(shr_12):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_12_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -1117,7 +1113,7 @@ L(shr_12_gobble_next):
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(shr_13):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -1144,7 +1140,7 @@ L(shr_13):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_13_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -1194,7 +1190,7 @@ L(shr_13_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_14):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -1221,7 +1217,7 @@ L(shr_14):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_14_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -1271,7 +1267,7 @@ L(shr_14_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_15):
cmp $80, %rcx
lea -48(%rcx), %rcx
@@ -1298,7 +1294,7 @@ L(shr_15):
add %rcx, %rdi
jmp L(less48bytes)
- ALIGN (4)
+ .p2align 4
L(shr_15_gobble):
sub $32, %rcx
movdqa 16(%rsi), %xmm0
@@ -1348,7 +1344,7 @@ L(shr_15_gobble_next):
add %rcx, %rdi
jmp L(less48bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(exit):
pmovmskb %xmm1, %r8d
sub $0xffff, %r8d
@@ -1389,56 +1385,56 @@ L(less16bytes):
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte16):
movzbl -16(%rdi), %eax
movzbl -16(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte17):
movzbl -15(%rdi), %eax
movzbl -15(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte18):
movzbl -14(%rdi), %eax
movzbl -14(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte19):
movzbl -13(%rdi), %eax
movzbl -13(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte20):
movzbl -12(%rdi), %eax
movzbl -12(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte21):
movzbl -11(%rdi), %eax
movzbl -11(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(Byte22):
movzbl -10(%rdi), %eax
movzbl -10(%rsi), %edx
sub %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(next_24_bytes):
lea 8(%rdi), %rdi
lea 8(%rsi), %rsi
@@ -1479,14 +1475,14 @@ L(next_24_bytes):
jne L(find_diff)
ret
- ALIGN (4)
+ .p2align 4
L(second_double_word):
mov -12(%rdi), %eax
cmp -12(%rsi), %eax
jne L(find_diff)
ret
- ALIGN (4)
+ .p2align 4
L(next_two_double_words):
and $15, %dh
jz L(fourth_double_word)
@@ -1495,7 +1491,7 @@ L(next_two_double_words):
jne L(find_diff)
ret
- ALIGN (4)
+ .p2align 4
L(fourth_double_word):
mov -4(%rdi), %eax
cmp -4(%rsi), %eax
@@ -1503,7 +1499,7 @@ L(fourth_double_word):
ret
# endif
- ALIGN (4)
+ .p2align 4
L(less48bytes):
cmp $8, %ecx
jae L(more8bytes)
@@ -1527,7 +1523,7 @@ L(less48bytes):
jmp L(4bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(more8bytes):
cmp $16, %ecx
jae L(more16bytes)
@@ -1551,7 +1547,7 @@ L(more8bytes):
jmp L(12bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(more16bytes):
cmp $24, %ecx
jae L(more24bytes)
@@ -1575,7 +1571,7 @@ L(more16bytes):
jmp L(20bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(more24bytes):
cmp $32, %ecx
jae L(more32bytes)
@@ -1599,7 +1595,7 @@ L(more24bytes):
jmp L(28bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(more32bytes):
cmp $40, %ecx
jae L(more40bytes)
@@ -1623,7 +1619,7 @@ L(more32bytes):
jmp L(36bytes)
# endif
- ALIGN (4)
+ .p2align 4
L(more40bytes):
cmp $40, %ecx
je L(40bytes)
@@ -1642,7 +1638,7 @@ L(more40bytes):
je L(46bytes)
jmp L(47bytes)
- ALIGN (4)
+ .p2align 4
L(44bytes):
movl -44(%rdi), %eax
movl -44(%rsi), %ecx
@@ -1702,7 +1698,7 @@ L(0bytes):
xor %eax, %eax
ret
# else
- ALIGN (4)
+ .p2align 4
L(44bytes):
movl -44(%rdi), %eax
cmp -44(%rsi), %eax
@@ -1753,7 +1749,7 @@ L(0bytes):
# endif
# ifndef USE_AS_WMEMCMP
- ALIGN (4)
+ .p2align 4
L(45bytes):
movl -45(%rdi), %eax
movl -45(%rsi), %ecx
@@ -1816,7 +1812,7 @@ L(1bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(46bytes):
movl -46(%rdi), %eax
movl -46(%rsi), %ecx
@@ -1882,7 +1878,7 @@ L(2bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(47bytes):
movl -47(%rdi), %eax
movl -47(%rsi), %ecx
@@ -1951,7 +1947,7 @@ L(3bytes):
xor %eax, %eax
ret
- ALIGN (4)
+ .p2align 4
L(find_diff):
cmpb %cl, %al
jne L(set)
@@ -1973,19 +1969,19 @@ L(set):
# else
/* for wmemcmp */
- ALIGN (4)
+ .p2align 4
L(find_diff):
mov $1, %eax
jg L(find_diff_bigger)
neg %eax
ret
- ALIGN (4)
+ .p2align 4
L(find_diff_bigger):
ret
# endif
- ALIGN (4)
+ .p2align 4
L(equal):
xor %eax, %eax
ret
diff --git a/libc/sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S b/libc/sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S
index efdfea238..df6578ebc 100644
--- a/libc/sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S
+++ b/libc/sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S
@@ -20,10 +20,6 @@
#include "asm-syntax.h"
-#ifndef ALIGN
-# define ALIGN(n) .p2align n
-#endif
-
ENTRY(__memcpy_sse2_unaligned)
movq %rsi, %rax
@@ -44,7 +40,7 @@ L(return):
movq %rdi, %rax
ret
.p2align 4,,10
- ALIGN(4)
+ .p2align 4
.L31:
movdqu 16(%rsi), %xmm8
cmpq $64, %rdx
@@ -77,7 +73,7 @@ L(return):
leaq 32(%r10), %r8
leaq 48(%r10), %rax
.p2align 4,,10
- ALIGN(4)
+ .p2align 4
L(loop):
movdqu (%rcx,%r10), %xmm8
movdqa %xmm8, (%rcx)
@@ -151,7 +147,7 @@ L(less_16):
.L3:
leaq -1(%rdx), %rax
.p2align 4,,10
- ALIGN(4)
+ .p2align 4
.L11:
movzbl (%rsi,%rax), %edx
movb %dl, (%rdi,%rax)
diff --git a/libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
index fc9fcef27..0eb7d9b75 100644
--- a/libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+++ b/libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
@@ -31,10 +31,6 @@
# define MEMCPY_CHK __memcpy_chk_ssse3_back
#endif
-#ifndef ALIGN
-# define ALIGN(n) .p2align n
-#endif
-
#define JMPTBL(I, B) I - B
/* Branch to an entry in a jump table. TABLE is a jump table with
@@ -87,7 +83,7 @@ L(bk_write):
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
#endif
- ALIGN (4)
+ .p2align 4
L(144bytesormore):
#ifndef USE_AS_MEMMOVE
@@ -119,7 +115,7 @@ L(144bytesormore):
jmp *%r9
ud2
- ALIGN (4)
+ .p2align 4
L(copy_backward):
#ifdef DATA_CACHE_SIZE
mov $DATA_CACHE_SIZE, %RCX_LP
@@ -149,7 +145,7 @@ L(copy_backward):
jmp *%r9
ud2
- ALIGN (4)
+ .p2align 4
L(shl_0):
mov %rdx, %r9
@@ -162,7 +158,7 @@ L(shl_0):
#endif
jae L(gobble_mem_fwd)
sub $0x80, %rdx
- ALIGN (4)
+ .p2align 4
L(shl_0_loop):
movdqa (%rsi), %xmm1
movdqa %xmm1, (%rdi)
@@ -190,7 +186,7 @@ L(shl_0_loop):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_bwd):
sub $0x80, %rdx
L(copy_backward_loop):
@@ -221,7 +217,7 @@ L(copy_backward_loop):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_1):
sub $0x80, %rdx
movaps -0x01(%rsi), %xmm1
@@ -258,7 +254,7 @@ L(shl_1):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_1_bwd):
movaps -0x01(%rsi), %xmm1
@@ -304,7 +300,7 @@ L(shl_1_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_2):
sub $0x80, %rdx
movaps -0x02(%rsi), %xmm1
@@ -341,7 +337,7 @@ L(shl_2):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_2_bwd):
movaps -0x02(%rsi), %xmm1
@@ -387,7 +383,7 @@ L(shl_2_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_3):
sub $0x80, %rdx
movaps -0x03(%rsi), %xmm1
@@ -424,7 +420,7 @@ L(shl_3):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_3_bwd):
movaps -0x03(%rsi), %xmm1
@@ -470,7 +466,7 @@ L(shl_3_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_4):
sub $0x80, %rdx
movaps -0x04(%rsi), %xmm1
@@ -507,7 +503,7 @@ L(shl_4):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_4_bwd):
movaps -0x04(%rsi), %xmm1
@@ -553,7 +549,7 @@ L(shl_4_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_5):
sub $0x80, %rdx
movaps -0x05(%rsi), %xmm1
@@ -590,7 +586,7 @@ L(shl_5):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_5_bwd):
movaps -0x05(%rsi), %xmm1
@@ -636,7 +632,7 @@ L(shl_5_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_6):
sub $0x80, %rdx
movaps -0x06(%rsi), %xmm1
@@ -673,7 +669,7 @@ L(shl_6):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_6_bwd):
movaps -0x06(%rsi), %xmm1
@@ -719,7 +715,7 @@ L(shl_6_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_7):
sub $0x80, %rdx
movaps -0x07(%rsi), %xmm1
@@ -756,7 +752,7 @@ L(shl_7):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_7_bwd):
movaps -0x07(%rsi), %xmm1
@@ -802,7 +798,7 @@ L(shl_7_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_8):
sub $0x80, %rdx
movaps -0x08(%rsi), %xmm1
@@ -839,7 +835,7 @@ L(shl_8):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_8_bwd):
movaps -0x08(%rsi), %xmm1
@@ -886,7 +882,7 @@ L(shl_8_end_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_9):
sub $0x80, %rdx
movaps -0x09(%rsi), %xmm1
@@ -923,7 +919,7 @@ L(shl_9):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_9_bwd):
movaps -0x09(%rsi), %xmm1
@@ -969,7 +965,7 @@ L(shl_9_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_10):
sub $0x80, %rdx
movaps -0x0a(%rsi), %xmm1
@@ -1006,7 +1002,7 @@ L(shl_10):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_10_bwd):
movaps -0x0a(%rsi), %xmm1
@@ -1052,7 +1048,7 @@ L(shl_10_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_11):
sub $0x80, %rdx
movaps -0x0b(%rsi), %xmm1
@@ -1089,7 +1085,7 @@ L(shl_11):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_11_bwd):
movaps -0x0b(%rsi), %xmm1
@@ -1135,7 +1131,7 @@ L(shl_11_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_12):
sub $0x80, %rdx
movdqa -0x0c(%rsi), %xmm1
@@ -1173,7 +1169,7 @@ L(shl_12):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_12_bwd):
movaps -0x0c(%rsi), %xmm1
@@ -1219,7 +1215,7 @@ L(shl_12_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_13):
sub $0x80, %rdx
movaps -0x0d(%rsi), %xmm1
@@ -1256,7 +1252,7 @@ L(shl_13):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_13_bwd):
movaps -0x0d(%rsi), %xmm1
@@ -1302,7 +1298,7 @@ L(shl_13_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_14):
sub $0x80, %rdx
movaps -0x0e(%rsi), %xmm1
@@ -1339,7 +1335,7 @@ L(shl_14):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_14_bwd):
movaps -0x0e(%rsi), %xmm1
@@ -1385,7 +1381,7 @@ L(shl_14_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_15):
sub $0x80, %rdx
movaps -0x0f(%rsi), %xmm1
@@ -1422,7 +1418,7 @@ L(shl_15):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_15_bwd):
movaps -0x0f(%rsi), %xmm1
@@ -1468,7 +1464,7 @@ L(shl_15_bwd):
sub %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_bwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(gobble_mem_fwd):
movdqu (%rsi), %xmm1
movdqu %xmm0, (%r8)
@@ -1570,7 +1566,7 @@ L(gobble_mem_fwd_end):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY (L(table_144_bytes_fwd), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(gobble_mem_bwd):
add %rdx, %rsi
add %rdx, %rdi
@@ -2833,7 +2829,7 @@ L(bwd_write_1bytes):
END (MEMCPY)
.section .rodata.ssse3,"a",@progbits
- ALIGN (3)
+ .p2align 3
L(table_144_bytes_bwd):
.int JMPTBL (L(bwd_write_0bytes), L(table_144_bytes_bwd))
.int JMPTBL (L(bwd_write_1bytes), L(table_144_bytes_bwd))
@@ -2980,7 +2976,7 @@ L(table_144_bytes_bwd):
.int JMPTBL (L(bwd_write_142bytes), L(table_144_bytes_bwd))
.int JMPTBL (L(bwd_write_143bytes), L(table_144_bytes_bwd))
- ALIGN (3)
+ .p2align 3
L(table_144_bytes_fwd):
.int JMPTBL (L(fwd_write_0bytes), L(table_144_bytes_fwd))
.int JMPTBL (L(fwd_write_1bytes), L(table_144_bytes_fwd))
@@ -3127,7 +3123,7 @@ L(table_144_bytes_fwd):
.int JMPTBL (L(fwd_write_142bytes), L(table_144_bytes_fwd))
.int JMPTBL (L(fwd_write_143bytes), L(table_144_bytes_fwd))
- ALIGN (3)
+ .p2align 3
L(shl_table_fwd):
.int JMPTBL (L(shl_0), L(shl_table_fwd))
.int JMPTBL (L(shl_1), L(shl_table_fwd))
@@ -3146,7 +3142,7 @@ L(shl_table_fwd):
.int JMPTBL (L(shl_14), L(shl_table_fwd))
.int JMPTBL (L(shl_15), L(shl_table_fwd))
- ALIGN (3)
+ .p2align 3
L(shl_table_bwd):
.int JMPTBL (L(shl_0_bwd), L(shl_table_bwd))
.int JMPTBL (L(shl_1_bwd), L(shl_table_bwd))
diff --git a/libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S
index 9642ceecd..0cedab244 100644
--- a/libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+++ b/libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S
@@ -31,10 +31,6 @@
# define MEMCPY_CHK __memcpy_chk_ssse3
#endif
-#ifndef ALIGN
-# define ALIGN(n) .p2align n
-#endif
-
#define JMPTBL(I, B) I - B
/* Branch to an entry in a jump table. TABLE is a jump table with
@@ -80,7 +76,7 @@ L(copy_forward):
jmp *%r9
ud2
- ALIGN (4)
+ .p2align 4
L(80bytesormore):
#ifndef USE_AS_MEMMOVE
cmp %dil, %sil
@@ -113,7 +109,7 @@ L(80bytesormore):
#endif
BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %r9, 4)
- ALIGN (4)
+ .p2align 4
L(copy_backward):
movdqu -16(%rsi, %rdx), %xmm0
add %rdx, %rsi
@@ -144,7 +140,7 @@ L(copy_backward):
#endif
BRANCH_TO_JMPTBL_ENTRY (L(shl_table_bwd), %r9, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0):
sub $16, %rdx
movdqa (%rsi), %xmm1
@@ -172,7 +168,7 @@ L(shl_0_less_64bytes):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_gobble):
#ifdef DATA_CACHE_SIZE_HALF
cmp $DATA_CACHE_SIZE_HALF, %RDX_LP
@@ -228,7 +224,7 @@ L(shl_0_cache_less_64bytes):
add %rdx, %rdi
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_gobble_mem_loop):
prefetcht0 0x1c0(%rsi)
prefetcht0 0x280(%rsi)
@@ -287,7 +283,7 @@ L(shl_0_mem_less_32bytes):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_bwd):
sub $16, %rdx
movdqa -0x10(%rsi), %xmm1
@@ -313,7 +309,7 @@ L(shl_0_bwd):
L(shl_0_less_64bytes_bwd):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_gobble_bwd):
#ifdef DATA_CACHE_SIZE_HALF
cmp $DATA_CACHE_SIZE_HALF, %RDX_LP
@@ -367,7 +363,7 @@ L(shl_0_gobble_bwd_loop):
L(shl_0_gobble_bwd_less_64bytes):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_0_gobble_mem_bwd_loop):
prefetcht0 -0x1c0(%rsi)
prefetcht0 -0x280(%rsi)
@@ -423,7 +419,7 @@ L(shl_0_mem_bwd_less_64bytes):
L(shl_0_mem_bwd_less_32bytes):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_1):
lea (L(shl_1_loop_L1)-L(shl_1))(%r9), %r9
cmp %rcx, %rdx
@@ -466,7 +462,7 @@ L(shl_1_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_1_bwd):
lea (L(shl_1_bwd_loop_L1)-L(shl_1_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -508,7 +504,7 @@ L(shl_1_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_2):
lea (L(shl_2_loop_L1)-L(shl_2))(%r9), %r9
cmp %rcx, %rdx
@@ -551,7 +547,7 @@ L(shl_2_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_2_bwd):
lea (L(shl_2_bwd_loop_L1)-L(shl_2_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -593,7 +589,7 @@ L(shl_2_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_3):
lea (L(shl_3_loop_L1)-L(shl_3))(%r9), %r9
cmp %rcx, %rdx
@@ -636,7 +632,7 @@ L(shl_3_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_3_bwd):
lea (L(shl_3_bwd_loop_L1)-L(shl_3_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -678,7 +674,7 @@ L(shl_3_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_4):
lea (L(shl_4_loop_L1)-L(shl_4))(%r9), %r9
cmp %rcx, %rdx
@@ -721,7 +717,7 @@ L(shl_4_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_4_bwd):
lea (L(shl_4_bwd_loop_L1)-L(shl_4_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -763,7 +759,7 @@ L(shl_4_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_5):
lea (L(shl_5_loop_L1)-L(shl_5))(%r9), %r9
cmp %rcx, %rdx
@@ -806,7 +802,7 @@ L(shl_5_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_5_bwd):
lea (L(shl_5_bwd_loop_L1)-L(shl_5_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -848,7 +844,7 @@ L(shl_5_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_6):
lea (L(shl_6_loop_L1)-L(shl_6))(%r9), %r9
cmp %rcx, %rdx
@@ -891,7 +887,7 @@ L(shl_6_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_6_bwd):
lea (L(shl_6_bwd_loop_L1)-L(shl_6_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -933,7 +929,7 @@ L(shl_6_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_7):
lea (L(shl_7_loop_L1)-L(shl_7))(%r9), %r9
cmp %rcx, %rdx
@@ -976,7 +972,7 @@ L(shl_7_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_7_bwd):
lea (L(shl_7_bwd_loop_L1)-L(shl_7_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1018,7 +1014,7 @@ L(shl_7_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_8):
lea (L(shl_8_loop_L1)-L(shl_8))(%r9), %r9
cmp %rcx, %rdx
@@ -1051,7 +1047,7 @@ L(shl_8_loop_L1):
movaps %xmm5, -0x10(%rdi)
jmp *%r9
ud2
- ALIGN (4)
+ .p2align 4
L(shl_8_end):
lea 64(%rdx), %rdx
movaps %xmm4, -0x20(%rdi)
@@ -1061,7 +1057,7 @@ L(shl_8_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_8_bwd):
lea (L(shl_8_bwd_loop_L1)-L(shl_8_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1103,7 +1099,7 @@ L(shl_8_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_9):
lea (L(shl_9_loop_L1)-L(shl_9))(%r9), %r9
cmp %rcx, %rdx
@@ -1146,7 +1142,7 @@ L(shl_9_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_9_bwd):
lea (L(shl_9_bwd_loop_L1)-L(shl_9_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1188,7 +1184,7 @@ L(shl_9_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_10):
lea (L(shl_10_loop_L1)-L(shl_10))(%r9), %r9
cmp %rcx, %rdx
@@ -1231,7 +1227,7 @@ L(shl_10_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_10_bwd):
lea (L(shl_10_bwd_loop_L1)-L(shl_10_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1273,7 +1269,7 @@ L(shl_10_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_11):
lea (L(shl_11_loop_L1)-L(shl_11))(%r9), %r9
cmp %rcx, %rdx
@@ -1316,7 +1312,7 @@ L(shl_11_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_11_bwd):
lea (L(shl_11_bwd_loop_L1)-L(shl_11_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1358,7 +1354,7 @@ L(shl_11_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_12):
lea (L(shl_12_loop_L1)-L(shl_12))(%r9), %r9
cmp %rcx, %rdx
@@ -1401,7 +1397,7 @@ L(shl_12_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_12_bwd):
lea (L(shl_12_bwd_loop_L1)-L(shl_12_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1443,7 +1439,7 @@ L(shl_12_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_13):
lea (L(shl_13_loop_L1)-L(shl_13))(%r9), %r9
cmp %rcx, %rdx
@@ -1486,7 +1482,7 @@ L(shl_13_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_13_bwd):
lea (L(shl_13_bwd_loop_L1)-L(shl_13_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1528,7 +1524,7 @@ L(shl_13_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_14):
lea (L(shl_14_loop_L1)-L(shl_14))(%r9), %r9
cmp %rcx, %rdx
@@ -1571,7 +1567,7 @@ L(shl_14_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_14_bwd):
lea (L(shl_14_bwd_loop_L1)-L(shl_14_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1613,7 +1609,7 @@ L(shl_14_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_15):
lea (L(shl_15_loop_L1)-L(shl_15))(%r9), %r9
cmp %rcx, %rdx
@@ -1656,7 +1652,7 @@ L(shl_15_end):
add %rdx, %rsi
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(shl_15_bwd):
lea (L(shl_15_bwd_loop_L1)-L(shl_15_bwd))(%r9), %r9
cmp %rcx, %rdx
@@ -1698,7 +1694,7 @@ L(shl_15_bwd_end):
movdqu %xmm0, (%r8)
BRANCH_TO_JMPTBL_ENTRY(L(table_less_80bytes), %rdx, 4)
- ALIGN (4)
+ .p2align 4
L(write_72bytes):
movdqu -72(%rsi), %xmm0
movdqu -56(%rsi), %xmm1
@@ -1716,7 +1712,7 @@ L(write_72bytes):
mov %rcx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_64bytes):
movdqu -64(%rsi), %xmm0
mov -48(%rsi), %rcx
@@ -1734,7 +1730,7 @@ L(write_64bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_56bytes):
movdqu -56(%rsi), %xmm0
mov -40(%rsi), %r8
@@ -1750,7 +1746,7 @@ L(write_56bytes):
mov %rcx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_48bytes):
mov -48(%rsi), %rcx
mov -40(%rsi), %r8
@@ -1766,7 +1762,7 @@ L(write_48bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_40bytes):
mov -40(%rsi), %r8
mov -32(%rsi), %r9
@@ -1780,7 +1776,7 @@ L(write_40bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_32bytes):
mov -32(%rsi), %r9
mov -24(%rsi), %r10
@@ -1792,7 +1788,7 @@ L(write_32bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_24bytes):
mov -24(%rsi), %r10
mov -16(%rsi), %r11
@@ -1802,7 +1798,7 @@ L(write_24bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_16bytes):
mov -16(%rsi), %r11
mov -8(%rsi), %rdx
@@ -1810,14 +1806,14 @@ L(write_16bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_8bytes):
mov -8(%rsi), %rdx
mov %rdx, -8(%rdi)
L(write_0bytes):
ret
- ALIGN (4)
+ .p2align 4
L(write_73bytes):
movdqu -73(%rsi), %xmm0
movdqu -57(%rsi), %xmm1
@@ -1837,7 +1833,7 @@ L(write_73bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_65bytes):
movdqu -65(%rsi), %xmm0
movdqu -49(%rsi), %xmm1
@@ -1855,7 +1851,7 @@ L(write_65bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_57bytes):
movdqu -57(%rsi), %xmm0
mov -41(%rsi), %r8
@@ -1873,7 +1869,7 @@ L(write_57bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_49bytes):
movdqu -49(%rsi), %xmm0
mov -33(%rsi), %r9
@@ -1889,7 +1885,7 @@ L(write_49bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_41bytes):
mov -41(%rsi), %r8
mov -33(%rsi), %r9
@@ -1905,7 +1901,7 @@ L(write_41bytes):
mov %dl, -1(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_33bytes):
mov -33(%rsi), %r9
mov -25(%rsi), %r10
@@ -1919,7 +1915,7 @@ L(write_33bytes):
mov %dl, -1(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_25bytes):
mov -25(%rsi), %r10
mov -17(%rsi), %r11
@@ -1931,7 +1927,7 @@ L(write_25bytes):
mov %dl, -1(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_17bytes):
mov -17(%rsi), %r11
mov -9(%rsi), %rcx
@@ -1941,7 +1937,7 @@ L(write_17bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_9bytes):
mov -9(%rsi), %rcx
mov -4(%rsi), %edx
@@ -1949,13 +1945,13 @@ L(write_9bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_1bytes):
mov -1(%rsi), %dl
mov %dl, -1(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_74bytes):
movdqu -74(%rsi), %xmm0
movdqu -58(%rsi), %xmm1
@@ -1975,7 +1971,7 @@ L(write_74bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_66bytes):
movdqu -66(%rsi), %xmm0
movdqu -50(%rsi), %xmm1
@@ -1995,7 +1991,7 @@ L(write_66bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_58bytes):
movdqu -58(%rsi), %xmm1
mov -42(%rsi), %r8
@@ -2013,7 +2009,7 @@ L(write_58bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_50bytes):
movdqu -50(%rsi), %xmm0
mov -34(%rsi), %r9
@@ -2029,7 +2025,7 @@ L(write_50bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_42bytes):
mov -42(%rsi), %r8
mov -34(%rsi), %r9
@@ -2045,7 +2041,7 @@ L(write_42bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_34bytes):
mov -34(%rsi), %r9
mov -26(%rsi), %r10
@@ -2059,7 +2055,7 @@ L(write_34bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_26bytes):
mov -26(%rsi), %r10
mov -18(%rsi), %r11
@@ -2071,7 +2067,7 @@ L(write_26bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_18bytes):
mov -18(%rsi), %r11
mov -10(%rsi), %rcx
@@ -2081,7 +2077,7 @@ L(write_18bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_10bytes):
mov -10(%rsi), %rcx
mov -4(%rsi), %edx
@@ -2089,13 +2085,13 @@ L(write_10bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_2bytes):
mov -2(%rsi), %dx
mov %dx, -2(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_75bytes):
movdqu -75(%rsi), %xmm0
movdqu -59(%rsi), %xmm1
@@ -2115,7 +2111,7 @@ L(write_75bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_67bytes):
movdqu -67(%rsi), %xmm0
movdqu -59(%rsi), %xmm1
@@ -2135,7 +2131,7 @@ L(write_67bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_59bytes):
movdqu -59(%rsi), %xmm0
mov -43(%rsi), %r8
@@ -2153,7 +2149,7 @@ L(write_59bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_51bytes):
movdqu -51(%rsi), %xmm0
mov -35(%rsi), %r9
@@ -2169,7 +2165,7 @@ L(write_51bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_43bytes):
mov -43(%rsi), %r8
mov -35(%rsi), %r9
@@ -2185,7 +2181,7 @@ L(write_43bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_35bytes):
mov -35(%rsi), %r9
mov -27(%rsi), %r10
@@ -2199,7 +2195,7 @@ L(write_35bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_27bytes):
mov -27(%rsi), %r10
mov -19(%rsi), %r11
@@ -2211,7 +2207,7 @@ L(write_27bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_19bytes):
mov -19(%rsi), %r11
mov -11(%rsi), %rcx
@@ -2221,7 +2217,7 @@ L(write_19bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_11bytes):
mov -11(%rsi), %rcx
mov -4(%rsi), %edx
@@ -2229,7 +2225,7 @@ L(write_11bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_3bytes):
mov -3(%rsi), %dx
mov -2(%rsi), %cx
@@ -2237,7 +2233,7 @@ L(write_3bytes):
mov %cx, -2(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_76bytes):
movdqu -76(%rsi), %xmm0
movdqu -60(%rsi), %xmm1
@@ -2257,7 +2253,7 @@ L(write_76bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_68bytes):
movdqu -68(%rsi), %xmm0
movdqu -52(%rsi), %xmm1
@@ -2275,7 +2271,7 @@ L(write_68bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_60bytes):
movdqu -60(%rsi), %xmm0
mov -44(%rsi), %r8
@@ -2293,7 +2289,7 @@ L(write_60bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_52bytes):
movdqu -52(%rsi), %xmm0
mov -36(%rsi), %r9
@@ -2309,7 +2305,7 @@ L(write_52bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_44bytes):
mov -44(%rsi), %r8
mov -36(%rsi), %r9
@@ -2325,7 +2321,7 @@ L(write_44bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_36bytes):
mov -36(%rsi), %r9
mov -28(%rsi), %r10
@@ -2339,7 +2335,7 @@ L(write_36bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_28bytes):
mov -28(%rsi), %r10
mov -20(%rsi), %r11
@@ -2351,7 +2347,7 @@ L(write_28bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_20bytes):
mov -20(%rsi), %r11
mov -12(%rsi), %rcx
@@ -2361,7 +2357,7 @@ L(write_20bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_12bytes):
mov -12(%rsi), %rcx
mov -4(%rsi), %edx
@@ -2369,13 +2365,13 @@ L(write_12bytes):
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_4bytes):
mov -4(%rsi), %edx
mov %edx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_77bytes):
movdqu -77(%rsi), %xmm0
movdqu -61(%rsi), %xmm1
@@ -2395,7 +2391,7 @@ L(write_77bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_69bytes):
movdqu -69(%rsi), %xmm0
movdqu -53(%rsi), %xmm1
@@ -2413,7 +2409,7 @@ L(write_69bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_61bytes):
movdqu -61(%rsi), %xmm0
mov -45(%rsi), %r8
@@ -2431,7 +2427,7 @@ L(write_61bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_53bytes):
movdqu -53(%rsi), %xmm0
mov -45(%rsi), %r8
@@ -2448,7 +2444,7 @@ L(write_53bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_45bytes):
mov -45(%rsi), %r8
mov -37(%rsi), %r9
@@ -2464,7 +2460,7 @@ L(write_45bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_37bytes):
mov -37(%rsi), %r9
mov -29(%rsi), %r10
@@ -2478,7 +2474,7 @@ L(write_37bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_29bytes):
mov -29(%rsi), %r10
mov -21(%rsi), %r11
@@ -2490,7 +2486,7 @@ L(write_29bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_21bytes):
mov -21(%rsi), %r11
mov -13(%rsi), %rcx
@@ -2500,7 +2496,7 @@ L(write_21bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_13bytes):
mov -13(%rsi), %rcx
mov -8(%rsi), %rdx
@@ -2508,7 +2504,7 @@ L(write_13bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_5bytes):
mov -5(%rsi), %edx
mov -4(%rsi), %ecx
@@ -2516,7 +2512,7 @@ L(write_5bytes):
mov %ecx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_78bytes):
movdqu -78(%rsi), %xmm0
movdqu -62(%rsi), %xmm1
@@ -2536,7 +2532,7 @@ L(write_78bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_70bytes):
movdqu -70(%rsi), %xmm0
movdqu -54(%rsi), %xmm1
@@ -2554,7 +2550,7 @@ L(write_70bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_62bytes):
movdqu -62(%rsi), %xmm0
mov -46(%rsi), %r8
@@ -2572,7 +2568,7 @@ L(write_62bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_54bytes):
movdqu -54(%rsi), %xmm0
mov -38(%rsi), %r9
@@ -2588,7 +2584,7 @@ L(write_54bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_46bytes):
mov -46(%rsi), %r8
mov -38(%rsi), %r9
@@ -2604,7 +2600,7 @@ L(write_46bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_38bytes):
mov -38(%rsi), %r9
mov -30(%rsi), %r10
@@ -2618,7 +2614,7 @@ L(write_38bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_30bytes):
mov -30(%rsi), %r10
mov -22(%rsi), %r11
@@ -2630,7 +2626,7 @@ L(write_30bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_22bytes):
mov -22(%rsi), %r11
mov -14(%rsi), %rcx
@@ -2640,7 +2636,7 @@ L(write_22bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_14bytes):
mov -14(%rsi), %rcx
mov -8(%rsi), %rdx
@@ -2648,7 +2644,7 @@ L(write_14bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_6bytes):
mov -6(%rsi), %edx
mov -4(%rsi), %ecx
@@ -2656,7 +2652,7 @@ L(write_6bytes):
mov %ecx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_79bytes):
movdqu -79(%rsi), %xmm0
movdqu -63(%rsi), %xmm1
@@ -2676,7 +2672,7 @@ L(write_79bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_71bytes):
movdqu -71(%rsi), %xmm0
movdqu -55(%rsi), %xmm1
@@ -2694,7 +2690,7 @@ L(write_71bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_63bytes):
movdqu -63(%rsi), %xmm0
mov -47(%rsi), %r8
@@ -2712,7 +2708,7 @@ L(write_63bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_55bytes):
movdqu -55(%rsi), %xmm0
mov -39(%rsi), %r9
@@ -2728,7 +2724,7 @@ L(write_55bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_47bytes):
mov -47(%rsi), %r8
mov -39(%rsi), %r9
@@ -2744,7 +2740,7 @@ L(write_47bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_39bytes):
mov -39(%rsi), %r9
mov -31(%rsi), %r10
@@ -2758,7 +2754,7 @@ L(write_39bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_31bytes):
mov -31(%rsi), %r10
mov -23(%rsi), %r11
@@ -2770,7 +2766,7 @@ L(write_31bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_23bytes):
mov -23(%rsi), %r11
mov -15(%rsi), %rcx
@@ -2780,7 +2776,7 @@ L(write_23bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_15bytes):
mov -15(%rsi), %rcx
mov -8(%rsi), %rdx
@@ -2788,7 +2784,7 @@ L(write_15bytes):
mov %rdx, -8(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(write_7bytes):
mov -7(%rsi), %edx
mov -4(%rsi), %ecx
@@ -2796,7 +2792,7 @@ L(write_7bytes):
mov %ecx, -4(%rdi)
ret
- ALIGN (4)
+ .p2align 4
L(large_page_fwd):
movdqu (%rsi), %xmm1
lea 16(%rsi), %rsi
@@ -2859,7 +2855,7 @@ L(large_page_less_64bytes):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
#ifdef USE_AS_MEMMOVE
- ALIGN (4)
+ .p2align 4
L(ll_cache_copy_fwd_start):
prefetcht0 0x1c0(%rsi)
prefetcht0 0x200(%rsi)
@@ -2906,7 +2902,7 @@ L(large_page_ll_less_fwd_64bytes):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
#endif
- ALIGN (4)
+ .p2align 4
L(large_page_bwd):
movdqu -0x10(%rsi), %xmm1
lea -16(%rsi), %rsi
@@ -2966,7 +2962,7 @@ L(large_page_less_bwd_64bytes):
BRANCH_TO_JMPTBL_ENTRY (L(table_less_80bytes), %rdx, 4)
#ifdef USE_AS_MEMMOVE
- ALIGN (4)
+ .p2align 4
L(ll_cache_copy_bwd_start):
prefetcht0 -0x1c0(%rsi)
prefetcht0 -0x200(%rsi)
@@ -3014,7 +3010,7 @@ L(large_page_ll_less_bwd_64bytes):
END (MEMCPY)
.section .rodata.ssse3,"a",@progbits
- ALIGN (3)
+ .p2align 3
L(table_less_80bytes):
.int JMPTBL (L(write_0bytes), L(table_less_80bytes))
.int JMPTBL (L(write_1bytes), L(table_less_80bytes))
@@ -3097,7 +3093,7 @@ L(table_less_80bytes):
.int JMPTBL (L(write_78bytes), L(table_less_80bytes))
.int JMPTBL (L(write_79bytes), L(table_less_80bytes))
- ALIGN (3)
+ .p2align 3
L(shl_table):
.int JMPTBL (L(shl_0), L(shl_table))
.int JMPTBL (L(shl_1), L(shl_table))
@@ -3116,7 +3112,7 @@ L(shl_table):
.int JMPTBL (L(shl_14), L(shl_table))
.int JMPTBL (L(shl_15), L(shl_table))
- ALIGN (3)
+ .p2align 3
L(shl_table_bwd):
.int JMPTBL (L(shl_0_bwd), L(shl_table_bwd))
.int JMPTBL (L(shl_1_bwd), L(shl_table_bwd))
diff --git a/libc/sysdeps/x86_64/multiarch/strchr.S b/libc/sysdeps/x86_64/multiarch/strchr.S
index f170238b5..3f0b2c5f5 100644
--- a/libc/sysdeps/x86_64/multiarch/strchr.S
+++ b/libc/sysdeps/x86_64/multiarch/strchr.S
@@ -29,12 +29,6 @@ ENTRY(strchr)
jne 1f
call __init_cpu_features
1: leaq __strchr_sse2(%rip), %rax
- testl $bit_Slow_SSE4_2, __cpu_features+CPUID_OFFSET+index_Slow_SSE4_2(%rip)
- jnz 2f
- testl $bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
- jz 2f
- leaq __strchr_sse42(%rip), %rax
- ret
2: testl $bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
jz 3f
leaq __strchr_sse2_no_bsf(%rip), %rax
@@ -42,127 +36,6 @@ ENTRY(strchr)
END(strchr)
-/*
- This implementation uses SSE4 instructions to compare up to 16 bytes
- at a time looking for the first occurrence of the character c in the
- string s:
-
- char *strchr (const char *s, int c);
-
- We use 0xa:
- _SIDD_SBYTE_OPS
- | _SIDD_CMP_EQUAL_EACH
- | _SIDD_LEAST_SIGNIFICANT
- on pcmpistri to compare xmm/mem128
-
- 0 1 2 3 4 5 6 7 8 9 A B C D E F
- X X X X X X X X X X X X X X X X
-
- against xmm
-
- 0 1 2 3 4 5 6 7 8 9 A B C D E F
- C C C C C C C C C C C C C C C C
-
- to find out if the first 16byte data element has a byte C and the
- offset of the first byte. There are 3 cases:
-
- 1. The first 16byte data element has the byte C at the offset X.
- 2. The first 16byte data element has EOS and doesn't have the byte C.
- 3. The first 16byte data element is valid and doesn't have the byte C.
-
- Here is the table of ECX, CFlag, ZFlag and SFlag for 3 cases:
-
- case ECX CFlag ZFlag SFlag
- 1 X 1 0/1 0
- 2 16 0 1 0
- 3 16 0 0 0
-
- We exit from the loop for cases 1 and 2 with jbe which branches
- when either CFlag or ZFlag is 1. If CFlag == 1, ECX has the offset
- X for case 1. */
-
- .section .text.sse4.2,"ax",@progbits
- .align 16
- .type __strchr_sse42, @function
- .globl __strchr_sse42
- .hidden __strchr_sse42
-__strchr_sse42:
- cfi_startproc
- CALL_MCOUNT
- testb %sil, %sil
- je __strend_sse4
- pxor %xmm2, %xmm2
- movd %esi, %xmm1
- movl %edi, %ecx
- pshufb %xmm2, %xmm1
- andl $15, %ecx
- movq %rdi, %r8
- je L(aligned_start)
-
-/* Handle unaligned string. */
- andq $-16, %r8
- movdqa (%r8), %xmm0
- pcmpeqb %xmm0, %xmm2
- pcmpeqb %xmm1, %xmm0
- /* Find where NULL is. */
- pmovmskb %xmm2, %edx
- /* Check if there is a match. */
- pmovmskb %xmm0, %esi
- /* Remove the leading bytes. */
- sarl %cl, %edx
- sarl %cl, %esi
- testl %esi, %esi
- je L(unaligned_no_match)
- /* Check which byte is a match. */
- bsfl %esi, %eax
- /* Is there a NULL? */
- testl %edx, %edx
- je L(unaligned_match)
- bsfl %edx, %esi
- cmpl %esi, %eax
- /* Return NULL if NULL comes first. */
- ja L(return_null)
-L(unaligned_match):
- addq %rdi, %rax
- ret
-
- .p2align 4
-L(unaligned_no_match):
- testl %edx, %edx
- jne L(return_null)
-
-/* Loop start on aligned string. */
-L(loop):
- addq $16, %r8
-L(aligned_start):
- pcmpistri $0x2, (%r8), %xmm1
- jbe L(wrap)
- addq $16, %r8
- pcmpistri $0x2, (%r8), %xmm1
- jbe L(wrap)
- addq $16, %r8
- pcmpistri $0x2, (%r8), %xmm1
- jbe L(wrap)
- addq $16, %r8
- pcmpistri $0x2, (%r8), %xmm1
- jbe L(wrap)
- jmp L(loop)
-L(wrap):
- jc L(loop_exit)
-
-/* Return NULL. */
-L(return_null):
- xorl %eax, %eax
- ret
-
-/* Loop exit. */
- .p2align 4
-L(loop_exit):
- leaq (%r8,%rcx), %rax
- ret
- cfi_endproc
- .size __strchr_sse42, .-__strchr_sse42
-
# undef ENTRY
# define ENTRY(name) \
diff --git a/libc/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S b/libc/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S
index eed843297..4a8e57a24 100644
--- a/libc/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S
+++ b/libc/sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S
@@ -17,7 +17,6 @@
<http://www.gnu.org/licenses/>. */
#include "sysdep.h"
-#define ALIGN(x) .p2align x
ENTRY ( __strcmp_sse2_unaligned)
movl %edi, %eax
@@ -43,7 +42,7 @@ L(return):
subl %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(next_48_bytes):
movdqu 16(%rdi), %xmm6
movdqu 16(%rsi), %xmm3
@@ -85,7 +84,7 @@ L(main_loop_header):
movq %rcx, %rsi
jmp L(loop_start)
- ALIGN (4)
+ .p2align 4
L(loop):
addq $64, %rax
addq $64, %rdx
@@ -141,7 +140,7 @@ L(back_to_loop):
subl %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(loop_cross_page):
xor %r10, %r10
movq %rdx, %r9
@@ -191,7 +190,7 @@ L(loop_cross_page):
subl %edx, %eax
ret
- ALIGN (4)
+ .p2align 4
L(cross_page_loop):
cmpb %cl, %al
jne L(different)
diff --git a/libc/sysdeps/x86_64/multiarch/strend-sse4.S b/libc/sysdeps/x86_64/multiarch/strend-sse4.S
deleted file mode 100644
index c5a7ae28a..000000000
--- a/libc/sysdeps/x86_64/multiarch/strend-sse4.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Return the pointer to the end of string, using SSE4.2
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
- Contributed by Intel Corporation.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-
- .section .text.sse4.2,"ax",@progbits
-ENTRY (__strend_sse4)
- pxor %xmm2, %xmm2
- movq %rdi, %rcx
- andq $~15, %rdi
- movdqa %xmm2, %xmm1
- pcmpeqb (%rdi), %xmm2
- orl $0xffffffff, %esi
- subq %rdi, %rcx
- shll %cl, %esi
- pmovmskb %xmm2, %edx
- andl %esi, %edx
- jnz 1f
-
-2: pcmpistri $0x08, 16(%rdi), %xmm1
- leaq 16(%rdi), %rdi
- jnz 2b
-
- leaq (%rdi,%rcx), %rax
- ret
-
-1: bsfl %edx, %eax
- addq %rdi, %rax
- ret
-
-END (__strend_sse4)
diff --git a/libc/sysdeps/x86_64/multiarch/strrchr-sse2-no-bsf.S b/libc/sysdeps/x86_64/multiarch/strrchr-sse2-no-bsf.S
deleted file mode 100644
index fcef610db..000000000
--- a/libc/sysdeps/x86_64/multiarch/strrchr-sse2-no-bsf.S
+++ /dev/null
@@ -1,555 +0,0 @@
-/* strrchr with SSE2 without bsf and bsr
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
- Contributed by Intel Corporation.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#if defined SHARED && !defined NOT_IN_libc
-
-# include <sysdep.h>
-# include "asm-syntax.h"
-
- atom_text_section
-ENTRY (__strrchr_sse2_no_bsf)
-
- movd %rsi, %xmm1
- pxor %xmm2, %xmm2
- mov %rdi, %rcx
- punpcklbw %xmm1, %xmm1
- punpcklbw %xmm1, %xmm1
- /* ECX has OFFSET. */
- and $63, %rcx
- cmp $48, %rcx
- pshufd $0, %xmm1, %xmm1
- ja L(crosscache)
-
-/* unaligned string. */
- movdqu (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm2
- pcmpeqb %xmm1, %xmm0
- /* Find where NULL is. */
- pmovmskb %xmm2, %rcx
- /* Check if there is a match. */
- pmovmskb %xmm0, %rax
- add $16, %rdi
-
- test %rax, %rax
- jnz L(unaligned_match1)
-
- test %rcx, %rcx
- jnz L(return_null)
-
- and $-16, %rdi
- xor %r8, %r8
- jmp L(loop)
-
- .p2align 4
-L(unaligned_match1):
- test %rcx, %rcx
- jnz L(prolog_find_zero_1)
-
- mov %rax, %r8
- mov %rdi, %rsi
- and $-16, %rdi
- jmp L(loop)
-
- .p2align 4
-L(crosscache):
-/* Hancle unaligned string. */
- and $15, %rcx
- and $-16, %rdi
- pxor %xmm3, %xmm3
- movdqa (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm3
- pcmpeqb %xmm1, %xmm0
- /* Find where NULL is. */
- pmovmskb %xmm3, %rdx
- /* Check if there is a match. */
- pmovmskb %xmm0, %rax
- /* Remove the leading bytes. */
- shr %cl, %rdx
- shr %cl, %rax
- add $16, %rdi
-
- test %rax, %rax
- jnz L(unaligned_match)
-
- test %rdx, %rdx
- jnz L(return_null)
-
- xor %r8, %r8
- jmp L(loop)
-
- .p2align 4
-L(unaligned_match):
- test %rdx, %rdx
- jnz L(prolog_find_zero)
-
- mov %rax, %r8
- lea (%rdi, %rcx), %rsi
-
-/* Loop start on aligned string. */
- .p2align 4
-L(loop):
- movdqa (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm2
- add $16, %rdi
- pcmpeqb %xmm1, %xmm0
- pmovmskb %xmm2, %rcx
- pmovmskb %xmm0, %rax
- or %rax, %rcx
- jnz L(matches)
-
- movdqa (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm2
- add $16, %rdi
- pcmpeqb %xmm1, %xmm0
- pmovmskb %xmm2, %rcx
- pmovmskb %xmm0, %rax
- or %rax, %rcx
- jnz L(matches)
-
- movdqa (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm2
- add $16, %rdi
- pcmpeqb %xmm1, %xmm0
- pmovmskb %xmm2, %rcx
- pmovmskb %xmm0, %rax
- or %rax, %rcx
- jnz L(matches)
-
- movdqa (%rdi), %xmm0
- pcmpeqb %xmm0, %xmm2
- add $16, %rdi
- pcmpeqb %xmm1, %xmm0
- pmovmskb %xmm2, %rcx
- pmovmskb %xmm0, %rax
- or %rax, %rcx
- jz L(loop)
-
-L(matches):
- test %rax, %rax
- jnz L(match)
-L(return_value):
- test %r8, %r8
- jz L(return_null)
- mov %r8, %rax
- mov %rsi, %rdi
- jmp L(match_exit)
-
- .p2align 4
-L(match):
- pmovmskb %xmm2, %rcx
- test %rcx, %rcx
- jnz L(find_zero)
- mov %rax, %r8
- mov %rdi, %rsi
- jmp L(loop)
-
- .p2align 4
-L(find_zero):
- test %cl, %cl
- jz L(find_zero_high)
- mov %cl, %dl
- and $15, %dl
- jz L(find_zero_8)
- test $0x01, %cl
- jnz L(FindZeroExit1)
- test $0x02, %cl
- jnz L(FindZeroExit2)
- test $0x04, %cl
- jnz L(FindZeroExit3)
- and $1 << 4 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(find_zero_8):
- test $0x10, %cl
- jnz L(FindZeroExit5)
- test $0x20, %cl
- jnz L(FindZeroExit6)
- test $0x40, %cl
- jnz L(FindZeroExit7)
- and $1 << 8 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(find_zero_high):
- mov %ch, %dh
- and $15, %dh
- jz L(find_zero_high_8)
- test $0x01, %ch
- jnz L(FindZeroExit9)
- test $0x02, %ch
- jnz L(FindZeroExit10)
- test $0x04, %ch
- jnz L(FindZeroExit11)
- and $1 << 12 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(find_zero_high_8):
- test $0x10, %ch
- jnz L(FindZeroExit13)
- test $0x20, %ch
- jnz L(FindZeroExit14)
- test $0x40, %ch
- jnz L(FindZeroExit15)
- and $1 << 16 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit1):
- and $1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit2):
- and $1 << 2 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit3):
- and $1 << 3 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit5):
- and $1 << 5 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit6):
- and $1 << 6 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit7):
- and $1 << 7 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit9):
- and $1 << 9 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit10):
- and $1 << 10 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit11):
- and $1 << 11 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit13):
- and $1 << 13 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit14):
- and $1 << 14 - 1, %rax
- jz L(return_value)
- jmp L(match_exit)
-
- .p2align 4
-L(FindZeroExit15):
- and $1 << 15 - 1, %rax
- jz L(return_value)
-
- .p2align 4
-L(match_exit):
- test %ah, %ah
- jnz L(match_exit_high)
- mov %al, %dl
- and $15 << 4, %dl
- jnz L(match_exit_8)
- test $0x08, %al
- jnz L(Exit4)
- test $0x04, %al
- jnz L(Exit3)
- test $0x02, %al
- jnz L(Exit2)
- lea -16(%rdi), %rax
- ret
-
- .p2align 4
-L(match_exit_8):
- test $0x80, %al
- jnz L(Exit8)
- test $0x40, %al
- jnz L(Exit7)
- test $0x20, %al
- jnz L(Exit6)
- lea -12(%rdi), %rax
- ret
-
- .p2align 4
-L(match_exit_high):
- mov %ah, %dh
- and $15 << 4, %dh
- jnz L(match_exit_high_8)
- test $0x08, %ah
- jnz L(Exit12)
- test $0x04, %ah
- jnz L(Exit11)
- test $0x02, %ah
- jnz L(Exit10)
- lea -8(%rdi), %rax
- ret
-
- .p2align 4
-L(match_exit_high_8):
- test $0x80, %ah
- jnz L(Exit16)
- test $0x40, %ah
- jnz L(Exit15)
- test $0x20, %ah
- jnz L(Exit14)
- lea -4(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit2):
- lea -15(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit3):
- lea -14(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit4):
- lea -13(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit6):
- lea -11(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit7):
- lea -10(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit8):
- lea -9(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit10):
- lea -7(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit11):
- lea -6(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit12):
- lea -5(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit14):
- lea -3(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit15):
- lea -2(%rdi), %rax
- ret
-
- .p2align 4
-L(Exit16):
- lea -1(%rdi), %rax
- ret
-
-/* Return NULL. */
- .p2align 4
-L(return_null):
- xor %rax, %rax
- ret
-
- .p2align 4
-L(prolog_find_zero):
- add %rcx, %rdi
- mov %rdx, %rcx
-L(prolog_find_zero_1):
- test %cl, %cl
- jz L(prolog_find_zero_high)
- mov %cl, %dl
- and $15, %dl
- jz L(prolog_find_zero_8)
- test $0x01, %cl
- jnz L(PrologFindZeroExit1)
- test $0x02, %cl
- jnz L(PrologFindZeroExit2)
- test $0x04, %cl
- jnz L(PrologFindZeroExit3)
- and $1 << 4 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(prolog_find_zero_8):
- test $0x10, %cl
- jnz L(PrologFindZeroExit5)
- test $0x20, %cl
- jnz L(PrologFindZeroExit6)
- test $0x40, %cl
- jnz L(PrologFindZeroExit7)
- and $1 << 8 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(prolog_find_zero_high):
- mov %ch, %dh
- and $15, %dh
- jz L(prolog_find_zero_high_8)
- test $0x01, %ch
- jnz L(PrologFindZeroExit9)
- test $0x02, %ch
- jnz L(PrologFindZeroExit10)
- test $0x04, %ch
- jnz L(PrologFindZeroExit11)
- and $1 << 12 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(prolog_find_zero_high_8):
- test $0x10, %ch
- jnz L(PrologFindZeroExit13)
- test $0x20, %ch
- jnz L(PrologFindZeroExit14)
- test $0x40, %ch
- jnz L(PrologFindZeroExit15)
- and $1 << 16 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit1):
- and $1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit2):
- and $1 << 2 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit3):
- and $1 << 3 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit5):
- and $1 << 5 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit6):
- and $1 << 6 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit7):
- and $1 << 7 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit9):
- and $1 << 9 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit10):
- and $1 << 10 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit11):
- and $1 << 11 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit13):
- and $1 << 13 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit14):
- and $1 << 14 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
- .p2align 4
-L(PrologFindZeroExit15):
- and $1 << 15 - 1, %rax
- jnz L(match_exit)
- xor %rax, %rax
- ret
-
-END (__strrchr_sse2_no_bsf)
-#endif
diff --git a/libc/sysdeps/x86_64/multiarch/strrchr.S b/libc/sysdeps/x86_64/multiarch/strrchr.S
deleted file mode 100644
index 3f92a41ef..000000000
--- a/libc/sysdeps/x86_64/multiarch/strrchr.S
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Multiple versions of strrchr
- All versions must be listed in ifunc-impl-list.c.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <init-arch.h>
-
-
-/* Define multiple versions only for the definition in libc and for
- the DSO. In static binaries we need strrchr before the initialization
- happened. */
-#if defined SHARED && !defined NOT_IN_libc
- .text
-ENTRY(strrchr)
- .type strrchr, @gnu_indirect_function
- cmpl $0, __cpu_features+KIND_OFFSET(%rip)
- jne 1f
- call __init_cpu_features
-1: leaq __strrchr_sse2(%rip), %rax
- testl $bit_Slow_SSE4_2, __cpu_features+CPUID_OFFSET+index_Slow_SSE4_2(%rip)
- jnz 2f
- testl $bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
- jz 2f
- leaq __strrchr_sse42(%rip), %rax
- ret
-2: testl $bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
- jz 3f
- leaq __strrchr_sse2_no_bsf(%rip), %rax
-3: ret
-END(strrchr)
-
-/*
- This implementation uses SSE4 instructions to compare up to 16 bytes
- at a time looking for the last occurrence of the character c in the
- string s:
-
- char *strrchr (const char *s, int c);
-
- We use 0x4a:
- _SIDD_SBYTE_OPS
- | _SIDD_CMP_EQUAL_EACH
- | _SIDD_MOST_SIGNIFICANT
- on pcmpistri to compare xmm/mem128
-
- 0 1 2 3 4 5 6 7 8 9 A B C D E F
- X X X X X X X X X X X X X X X X
-
- against xmm
-
- 0 1 2 3 4 5 6 7 8 9 A B C D E F
- C C C C C C C C C C C C C C C C
-
- to find out if the first 16byte data element has a byte C and the
- last offset. There are 4 cases:
-
- 1. The first 16byte data element has EOS and has the byte C at the
- last offset X.
- 2. The first 16byte data element is valid and has the byte C at the
- last offset X.
- 3. The first 16byte data element has EOS and doesn't have the byte C.
- 4. The first 16byte data element is valid and doesn't have the byte C.
-
- Here is the table of ECX, CFlag, ZFlag and SFlag for 3 cases:
-
- case ECX CFlag ZFlag SFlag
- 1 X 1 1 0
- 2 X 1 0 0
- 3 16 0 1 0
- 4 16 0 0 0
-
- We exit from the loop for cases 1 and 3 with jz which branches
- when ZFlag is 1. If CFlag == 1, ECX has the offset X for case 1. */
-
-
- .section .text.sse4.2,"ax",@progbits
- .align 16
- .type __strrchr_sse42, @function
- .globl __strrchr_sse42
- .hidden __strrchr_sse42
-__strrchr_sse42:
- cfi_startproc
- CALL_MCOUNT
- testb %sil, %sil
- je __strend_sse4
- xor %eax,%eax /* RAX has the last occurrence of s. */
- movd %esi, %xmm1
- punpcklbw %xmm1, %xmm1
- movl %edi, %esi
- punpcklbw %xmm1, %xmm1
- andl $15, %esi
- pshufd $0, %xmm1, %xmm1
- movq %rdi, %r8
- je L(loop)
-
-/* Handle unaligned string using psrldq. */
- leaq L(psrldq_table)(%rip), %rdx
- andq $-16, %r8
- movslq (%rdx,%rsi,4),%r9
- movdqa (%r8), %xmm0
- addq %rdx, %r9
- jmp *%r9
-
-/* Handle unaligned string with offset 1 using psrldq. */
- .p2align 4
-L(psrldq_1):
- psrldq $1, %xmm0
-
- .p2align 4
-L(unaligned_pcmpistri):
- pcmpistri $0x4a, %xmm1, %xmm0
- jnc L(unaligned_no_byte)
- leaq (%rdi,%rcx), %rax
-L(unaligned_no_byte):
- /* Find the length of the unaligned string. */
- pcmpistri $0x3a, %xmm0, %xmm0
- movl $16, %edx
- subl %esi, %edx
- cmpl %ecx, %edx
- /* Return RAX if the unaligned fragment to next 16B already
- contain the NULL terminator. */
- jg L(exit)
- addq $16, %r8
-
-/* Loop start on aligned string. */
- .p2align 4
-L(loop):
- pcmpistri $0x4a, (%r8), %xmm1
- jbe L(match_or_eos)
- addq $16, %r8
- jmp L(loop)
- .p2align 4
-L(match_or_eos):
- je L(had_eos)
-L(match_no_eos):
- leaq (%r8,%rcx), %rax
- addq $16, %r8
- jmp L(loop)
- .p2align 4
-L(had_eos):
- jnc L(exit)
- leaq (%r8,%rcx), %rax
- .p2align 4
-L(exit):
- ret
-
-/* Handle unaligned string with offset 15 using psrldq. */
- .p2align 4
-L(psrldq_15):
- psrldq $15, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 14 using psrldq. */
- .p2align 4
-L(psrldq_14):
- psrldq $14, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 13 using psrldq. */
- .p2align 4
-L(psrldq_13):
- psrldq $13, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 12 using psrldq. */
- .p2align 4
-L(psrldq_12):
- psrldq $12, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 11 using psrldq. */
- .p2align 4
-L(psrldq_11):
- psrldq $11, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 10 using psrldq. */
- .p2align 4
-L(psrldq_10):
- psrldq $10, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 9 using psrldq. */
- .p2align 4
-L(psrldq_9):
- psrldq $9, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 8 using psrldq. */
- .p2align 4
-L(psrldq_8):
- psrldq $8, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 7 using psrldq. */
- .p2align 4
-L(psrldq_7):
- psrldq $7, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 6 using psrldq. */
- .p2align 4
-L(psrldq_6):
- psrldq $6, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 5 using psrldq. */
- .p2align 4
-L(psrldq_5):
- psrldq $5, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 4 using psrldq. */
- .p2align 4
-L(psrldq_4):
- psrldq $4, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 3 using psrldq. */
- .p2align 4
-L(psrldq_3):
- psrldq $3, %xmm0
- jmp L(unaligned_pcmpistri)
-
-/* Handle unaligned string with offset 2 using psrldq. */
- .p2align 4
-L(psrldq_2):
- psrldq $2, %xmm0
- jmp L(unaligned_pcmpistri)
-
- cfi_endproc
- .size __strrchr_sse42, .-__strrchr_sse42
-
- .section .rodata.sse4.2,"a",@progbits
- .p2align 4
-L(psrldq_table):
- .int L(loop) - L(psrldq_table)
- .int L(psrldq_1) - L(psrldq_table)
- .int L(psrldq_2) - L(psrldq_table)
- .int L(psrldq_3) - L(psrldq_table)
- .int L(psrldq_4) - L(psrldq_table)
- .int L(psrldq_5) - L(psrldq_table)
- .int L(psrldq_6) - L(psrldq_table)
- .int L(psrldq_7) - L(psrldq_table)
- .int L(psrldq_8) - L(psrldq_table)
- .int L(psrldq_9) - L(psrldq_table)
- .int L(psrldq_10) - L(psrldq_table)
- .int L(psrldq_11) - L(psrldq_table)
- .int L(psrldq_12) - L(psrldq_table)
- .int L(psrldq_13) - L(psrldq_table)
- .int L(psrldq_14) - L(psrldq_table)
- .int L(psrldq_15) - L(psrldq_table)
-
-
-# undef ENTRY
-# define ENTRY(name) \
- .type __strrchr_sse2, @function; \
- .align 16; \
- .globl __strrchr_sse2; \
- .hidden __strrchr_sse2; \
- __strrchr_sse2: cfi_startproc; \
- CALL_MCOUNT
-# undef END
-# define END(name) \
- cfi_endproc; .size __strrchr_sse2, .-__strrchr_sse2
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal strrchr calls through a PLT.
- The speedup we get from using SSE4.2 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_strrchr; __GI_strrchr = __strrchr_sse2
-#endif
-
-#include "../strrchr.S"
diff --git a/libc/sysdeps/x86_64/stackguard-macros.h b/libc/sysdeps/x86_64/stackguard-macros.h
index d7fedb373..1948800cd 100644
--- a/libc/sysdeps/x86_64/stackguard-macros.h
+++ b/libc/sysdeps/x86_64/stackguard-macros.h
@@ -4,3 +4,8 @@
({ uintptr_t x; \
asm ("mov %%fs:%c1, %0" : "=r" (x) \
: "i" (offsetof (tcbhead_t, stack_guard))); x; })
+
+#define POINTER_CHK_GUARD \
+ ({ uintptr_t x; \
+ asm ("mov %%fs:%c1, %0" : "=r" (x) \
+ : "i" (offsetof (tcbhead_t, pointer_guard))); x; })
diff --git a/libc/sysdeps/x86_64/strchr.S b/libc/sysdeps/x86_64/strchr.S
index d89f1eba8..7440500a6 100644
--- a/libc/sysdeps/x86_64/strchr.S
+++ b/libc/sysdeps/x86_64/strchr.S
@@ -19,51 +19,169 @@
#include <sysdep.h>
-
.text
ENTRY (strchr)
movd %esi, %xmm1
- movq %rdi, %rcx
- punpcklbw %xmm1, %xmm1
- andq $~15, %rdi
- pxor %xmm2, %xmm2
+ movl %edi, %eax
+ andl $4095, %eax
punpcklbw %xmm1, %xmm1
- orl $0xffffffff, %esi
- movdqa (%rdi), %xmm0
+ cmpl $4032, %eax
+ punpcklwd %xmm1, %xmm1
pshufd $0, %xmm1, %xmm1
- subq %rdi, %rcx
- movdqa %xmm0, %xmm3
- leaq 16(%rdi), %rdi
+ jg L(cross_page)
+ movdqu (%rdi), %xmm0
+ pxor %xmm3, %xmm3
+ movdqa %xmm0, %xmm4
pcmpeqb %xmm1, %xmm0
- pcmpeqb %xmm2, %xmm3
- shl %cl, %esi
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- andl %esi, %edx
- andl %esi, %ecx
- orl %edx, %ecx
- jnz 1f
+ pcmpeqb %xmm3, %xmm4
+ por %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ je L(next_48_bytes)
+ bsf %eax, %eax
+#ifdef AS_STRCHRNUL
+ leaq (%rdi,%rax), %rax
+#else
+ movl $0, %edx
+ leaq (%rdi,%rax), %rax
+ cmpb %sil, (%rax)
+ cmovne %rdx, %rax
+#endif
+ ret
-2: movdqa (%rdi), %xmm0
- leaq 16(%rdi), %rdi
- movdqa %xmm0, %xmm3
+ .p2align 3
+ L(next_48_bytes):
+ movdqu 16(%rdi), %xmm0
+ movdqa %xmm0, %xmm4
pcmpeqb %xmm1, %xmm0
- pcmpeqb %xmm2, %xmm3
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- orl %edx, %ecx
- jz 2b
+ pcmpeqb %xmm3, %xmm4
+ por %xmm4, %xmm0
+ pmovmskb %xmm0, %ecx
+ movdqu 32(%rdi), %xmm0
+ movdqa %xmm0, %xmm4
+ pcmpeqb %xmm1, %xmm0
+ salq $16, %rcx
+ pcmpeqb %xmm3, %xmm4
+ por %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ movdqu 48(%rdi), %xmm0
+ pcmpeqb %xmm0, %xmm3
+ salq $32, %rax
+ pcmpeqb %xmm1, %xmm0
+ orq %rcx, %rax
+ por %xmm3, %xmm0
+ pmovmskb %xmm0, %ecx
+ salq $48, %rcx
+ orq %rcx, %rax
+ testq %rax, %rax
+ jne L(return)
+L(loop_start):
+ /* We use this alignment to force loop be aligned to 8 but not
+ 16 bytes. This gives better sheduling on AMD processors. */
+ .p2align 4
+ pxor %xmm6, %xmm6
+ andq $-64, %rdi
+ .p2align 3
+L(loop64):
+ addq $64, %rdi
+ movdqa (%rdi), %xmm5
+ movdqa 16(%rdi), %xmm2
+ movdqa 32(%rdi), %xmm3
+ pxor %xmm1, %xmm5
+ movdqa 48(%rdi), %xmm4
+ pxor %xmm1, %xmm2
+ pxor %xmm1, %xmm3
+ pminub (%rdi), %xmm5
+ pxor %xmm1, %xmm4
+ pminub 16(%rdi), %xmm2
+ pminub 32(%rdi), %xmm3
+ pminub %xmm2, %xmm5
+ pminub 48(%rdi), %xmm4
+ pminub %xmm3, %xmm5
+ pminub %xmm4, %xmm5
+ pcmpeqb %xmm6, %xmm5
+ pmovmskb %xmm5, %eax
+
+ testl %eax, %eax
+ je L(loop64)
+
+ movdqa (%rdi), %xmm5
+ movdqa %xmm5, %xmm0
+ pcmpeqb %xmm1, %xmm5
+ pcmpeqb %xmm6, %xmm0
+ por %xmm0, %xmm5
+ pcmpeqb %xmm6, %xmm2
+ pcmpeqb %xmm6, %xmm3
+ pcmpeqb %xmm6, %xmm4
+
+ pmovmskb %xmm5, %ecx
+ pmovmskb %xmm2, %eax
+ salq $16, %rax
+ pmovmskb %xmm3, %r8d
+ pmovmskb %xmm4, %edx
+ salq $32, %r8
+ orq %r8, %rax
+ orq %rcx, %rax
+ salq $48, %rdx
+ orq %rdx, %rax
+ .p2align 3
+L(return):
+ bsfq %rax, %rax
+#ifdef AS_STRCHRNUL
+ leaq (%rdi,%rax), %rax
+#else
+ movl $0, %edx
+ leaq (%rdi,%rax), %rax
+ cmpb %sil, (%rax)
+ cmovne %rdx, %rax
+#endif
+ ret
+ .p2align 4
+
+L(cross_page):
+ movq %rdi, %rdx
+ pxor %xmm2, %xmm2
+ andq $-64, %rdx
+ movdqa %xmm1, %xmm0
+ movdqa (%rdx), %xmm3
+ movdqa %xmm3, %xmm4
+ pcmpeqb %xmm1, %xmm3
+ pcmpeqb %xmm2, %xmm4
+ por %xmm4, %xmm3
+ pmovmskb %xmm3, %r8d
+ movdqa 16(%rdx), %xmm3
+ movdqa %xmm3, %xmm4
+ pcmpeqb %xmm1, %xmm3
+ pcmpeqb %xmm2, %xmm4
+ por %xmm4, %xmm3
+ pmovmskb %xmm3, %eax
+ movdqa 32(%rdx), %xmm3
+ movdqa %xmm3, %xmm4
+ pcmpeqb %xmm1, %xmm3
+ salq $16, %rax
+ pcmpeqb %xmm2, %xmm4
+ por %xmm4, %xmm3
+ pmovmskb %xmm3, %r9d
+ movdqa 48(%rdx), %xmm3
+ pcmpeqb %xmm3, %xmm2
+ salq $32, %r9
+ pcmpeqb %xmm3, %xmm0
+ orq %r9, %rax
+ orq %r8, %rax
+ por %xmm2, %xmm0
+ pmovmskb %xmm0, %ecx
+ salq $48, %rcx
+ orq %rcx, %rax
+ movl %edi, %ecx
+ subb %dl, %cl
+ shrq %cl, %rax
+ testq %rax, %rax
+ jne L(return)
+ jmp L(loop_start)
-1: bsfl %edx, %edx
- jz 4f
- bsfl %ecx, %ecx
- leaq -16(%rdi,%rdx), %rax
- cmpl %edx, %ecx
- je 5f
-4: xorl %eax, %eax
-5: ret
END (strchr)
+#ifndef AS_STRCHRNUL
weak_alias (strchr, index)
libc_hidden_builtin_def (strchr)
-
+#endif
diff --git a/libc/sysdeps/x86_64/strchrnul.S b/libc/sysdeps/x86_64/strchrnul.S
index d8c345ba7..bceeb6187 100644
--- a/libc/sysdeps/x86_64/strchrnul.S
+++ b/libc/sysdeps/x86_64/strchrnul.S
@@ -20,43 +20,8 @@
#include <sysdep.h>
-
- .text
-ENTRY (__strchrnul)
- movd %esi, %xmm1
- movq %rdi, %rcx
- punpcklbw %xmm1, %xmm1
- andq $~15, %rdi
- pxor %xmm2, %xmm2
- punpcklbw %xmm1, %xmm1
- orl $0xffffffff, %esi
- movdqa (%rdi), %xmm0
- pshufd $0, %xmm1, %xmm1
- subq %rdi, %rcx
- movdqa %xmm0, %xmm3
- leaq 16(%rdi), %rdi
- pcmpeqb %xmm1, %xmm0
- pcmpeqb %xmm2, %xmm3
- shl %cl, %esi
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- orl %edx, %ecx
- andl %esi, %ecx
- jnz 1f
-
-2: movdqa (%rdi), %xmm0
- leaq 16(%rdi), %rdi
- movdqa %xmm0, %xmm3
- pcmpeqb %xmm1, %xmm0
- pcmpeqb %xmm2, %xmm3
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- orl %edx, %ecx
- jz 2b
-
-1: bsfl %ecx, %edx
- leaq -16(%rdi,%rdx), %rax
- ret
-END (__strchrnul)
+#define strchr __strchrnul
+#define AS_STRCHRNUL
+#include "strchr.S"
weak_alias (__strchrnul, strchrnul)
diff --git a/libc/sysdeps/x86_64/strrchr.S b/libc/sysdeps/x86_64/strrchr.S
index e413b0743..2a07ff75a 100644
--- a/libc/sysdeps/x86_64/strrchr.S
+++ b/libc/sysdeps/x86_64/strrchr.S
@@ -1,6 +1,5 @@
/* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR.
- For AMD x86-64.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,63 +16,212 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sysdep.h>
+#include <sysdep.h>
.text
ENTRY (strrchr)
movd %esi, %xmm1
- movq %rdi, %rcx
- punpcklbw %xmm1, %xmm1
- andq $~15, %rdi
- pxor %xmm2, %xmm2
- punpcklbw %xmm1, %xmm1
- orl $0xffffffff, %esi
- movdqa (%rdi), %xmm0
+ movq %rdi, %rax
+ andl $4095, %eax
+ punpcklbw %xmm1, %xmm1
+ cmpq $4032, %rax
+ punpcklwd %xmm1, %xmm1
pshufd $0, %xmm1, %xmm1
- subq %rdi, %rcx
+ ja L(cross_page)
+ movdqu (%rdi), %xmm0
+ pxor %xmm2, %xmm2
movdqa %xmm0, %xmm3
- leaq 16(%rdi), %rdi
pcmpeqb %xmm1, %xmm0
pcmpeqb %xmm2, %xmm3
- shl %cl, %esi
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- andl %esi, %edx
- andl %esi, %ecx
- xorl %eax, %eax
- movl %edx, %esi
- orl %ecx, %esi
- jnz 1f
+ pmovmskb %xmm0, %ecx
+ pmovmskb %xmm3, %edx
+ testq %rdx, %rdx
+ je L(next_48_bytes)
+ leaq -1(%rdx), %rax
+ xorq %rdx, %rax
+ andq %rcx, %rax
+ je L(exit)
+ bsrq %rax, %rax
+ addq %rdi, %rax
+ ret
-2: movdqa (%rdi), %xmm0
- leaq 16(%rdi), %rdi
- movdqa %xmm0, %xmm3
+ .p2align 4
+L(next_48_bytes):
+ movdqu 16(%rdi), %xmm4
+ movdqa %xmm4, %xmm5
+ movdqu 32(%rdi), %xmm3
+ pcmpeqb %xmm1, %xmm4
+ pcmpeqb %xmm2, %xmm5
+ movdqu 48(%rdi), %xmm0
+ pmovmskb %xmm5, %edx
+ movdqa %xmm3, %xmm5
+ pcmpeqb %xmm1, %xmm3
+ pcmpeqb %xmm2, %xmm5
+ pcmpeqb %xmm0, %xmm2
+ salq $16, %rdx
+ pmovmskb %xmm3, %r8d
+ pmovmskb %xmm5, %eax
+ pmovmskb %xmm2, %esi
+ salq $32, %r8
+ salq $32, %rax
pcmpeqb %xmm1, %xmm0
- pcmpeqb %xmm2, %xmm3
- pmovmskb %xmm0, %edx
- pmovmskb %xmm3, %ecx
- movl %edx, %esi
- orl %ecx, %esi
- jz 2b
+ orq %rdx, %rax
+ movq %rsi, %rdx
+ pmovmskb %xmm4, %esi
+ salq $48, %rdx
+ salq $16, %rsi
+ orq %r8, %rsi
+ orq %rcx, %rsi
+ pmovmskb %xmm0, %ecx
+ salq $48, %rcx
+ orq %rcx, %rsi
+ orq %rdx, %rax
+ je L(loop_header2)
+ leaq -1(%rax), %rcx
+ xorq %rax, %rcx
+ andq %rcx, %rsi
+ je L(exit)
+ bsrq %rsi, %rsi
+ leaq (%rdi,%rsi), %rax
+ ret
-1: bsfl %ecx, %r9d
- movl $0xffffffff, %r8d
- movl $31, %ecx
- jnz 5f
+ .p2align 4
+L(loop_header2):
+ testq %rsi, %rsi
+ movq %rdi, %rcx
+ je L(no_c_found)
+L(loop_header):
+ addq $64, %rdi
+ pxor %xmm7, %xmm7
+ andq $-64, %rdi
+ jmp L(loop_entry)
+
+ .p2align 4
+L(loop64):
+ testq %rdx, %rdx
+ cmovne %rdx, %rsi
+ cmovne %rdi, %rcx
+ addq $64, %rdi
+L(loop_entry):
+ movdqa 32(%rdi), %xmm3
+ pxor %xmm6, %xmm6
+ movdqa 48(%rdi), %xmm2
+ movdqa %xmm3, %xmm0
+ movdqa 16(%rdi), %xmm4
+ pminub %xmm2, %xmm0
+ movdqa (%rdi), %xmm5
+ pminub %xmm4, %xmm0
+ pminub %xmm5, %xmm0
+ pcmpeqb %xmm7, %xmm0
+ pmovmskb %xmm0, %eax
+ movdqa %xmm5, %xmm0
+ pcmpeqb %xmm1, %xmm0
+ pmovmskb %xmm0, %r9d
+ movdqa %xmm4, %xmm0
+ pcmpeqb %xmm1, %xmm0
+ pmovmskb %xmm0, %edx
+ movdqa %xmm3, %xmm0
+ pcmpeqb %xmm1, %xmm0
+ salq $16, %rdx
+ pmovmskb %xmm0, %r10d
+ movdqa %xmm2, %xmm0
+ pcmpeqb %xmm1, %xmm0
+ salq $32, %r10
+ orq %r10, %rdx
+ pmovmskb %xmm0, %r8d
+ orq %r9, %rdx
+ salq $48, %r8
+ orq %r8, %rdx
+ testl %eax, %eax
+ je L(loop64)
+ pcmpeqb %xmm6, %xmm4
+ pcmpeqb %xmm6, %xmm3
+ pcmpeqb %xmm6, %xmm5
+ pmovmskb %xmm4, %eax
+ pmovmskb %xmm3, %r10d
+ pcmpeqb %xmm6, %xmm2
+ pmovmskb %xmm5, %r9d
+ salq $32, %r10
+ salq $16, %rax
+ pmovmskb %xmm2, %r8d
+ orq %r10, %rax
+ orq %r9, %rax
+ salq $48, %r8
+ orq %r8, %rax
+ leaq -1(%rax), %r8
+ xorq %rax, %r8
+ andq %r8, %rdx
+ cmovne %rdi, %rcx
+ cmovne %rdx, %rsi
+ bsrq %rsi, %rsi
+ leaq (%rcx,%rsi), %rax
+ ret
- bsrl %edx, %edx
- jz 2b
- leaq -16(%rdi,%rdx), %rax
- jmp 2b
+ .p2align 4
+L(no_c_found):
+ movl $1, %esi
+ xorl %ecx, %ecx
+ jmp L(loop_header)
+
+ .p2align 4
+L(exit):
+ xorl %eax, %eax
+ ret
-5: subl %r9d, %ecx
- shrl %cl, %r8d
- andl %r8d, %edx
- bsrl %edx, %edx
- jz 4f
- leaq -16(%rdi,%rdx), %rax
-4: ret
+ .p2align 4
+L(cross_page):
+ movq %rdi, %rax
+ pxor %xmm0, %xmm0
+ andq $-64, %rax
+ movdqu (%rax), %xmm5
+ movdqa %xmm5, %xmm6
+ movdqu 16(%rax), %xmm4
+ pcmpeqb %xmm1, %xmm5
+ pcmpeqb %xmm0, %xmm6
+ movdqu 32(%rax), %xmm3
+ pmovmskb %xmm6, %esi
+ movdqa %xmm4, %xmm6
+ movdqu 48(%rax), %xmm2
+ pcmpeqb %xmm1, %xmm4
+ pcmpeqb %xmm0, %xmm6
+ pmovmskb %xmm6, %edx
+ movdqa %xmm3, %xmm6
+ pcmpeqb %xmm1, %xmm3
+ pcmpeqb %xmm0, %xmm6
+ pcmpeqb %xmm2, %xmm0
+ salq $16, %rdx
+ pmovmskb %xmm3, %r9d
+ pmovmskb %xmm6, %r8d
+ pmovmskb %xmm0, %ecx
+ salq $32, %r9
+ salq $32, %r8
+ pcmpeqb %xmm1, %xmm2
+ orq %r8, %rdx
+ salq $48, %rcx
+ pmovmskb %xmm5, %r8d
+ orq %rsi, %rdx
+ pmovmskb %xmm4, %esi
+ orq %rcx, %rdx
+ pmovmskb %xmm2, %ecx
+ salq $16, %rsi
+ salq $48, %rcx
+ orq %r9, %rsi
+ orq %r8, %rsi
+ orq %rcx, %rsi
+ movl %edi, %ecx
+ subl %eax, %ecx
+ shrq %cl, %rdx
+ shrq %cl, %rsi
+ testq %rdx, %rdx
+ je L(loop_header2)
+ leaq -1(%rdx), %rax
+ xorq %rdx, %rax
+ andq %rax, %rsi
+ je L(exit)
+ bsrq %rsi, %rax
+ addq %rdi, %rax
+ ret
END (strrchr)
weak_alias (strrchr, rindex)