Compare commits

...
Author SHA1 Message Date
Ryan S. Arnold a70a592633 Correct ordering of entries and spurious whitespace on the end of a line. 2012-01-11 14:42:27 -06:00
Adhemerval Zanella eea213be41 Merge Adhemerval Zanella's pipe2 fix into ibm/2.12/master. 2012-01-11 14:37:26 -06:00
Adhemerval Zanella 0a08973fdf Fix for AIO stack size (backported from 'master' branch) 2012-01-05 21:36:23 -05:00
Adhemerval Zanella 81552be4df Add have_pipe2. 2011-12-29 20:42:16 -05:00
Adhemerval Zanella b20eec6a2b PowerPC - Optimization for str[n]casecmp functions
This patch provides throughput boost for the strcasecmp function
(25% on ppc32 and 40% on ppc64) and strncasecmp (15% on both ppc32
and ppc64) for POWER7. The optimization is done by manually
(strcasecmp) or automatically (strncasecmp) unrolling the test loop
to avoid CPU stalls caused by a test followed by a load.
2011-12-29 19:43:33 -05:00
Adhemerval Zanella a960be3fad PowerPC - Optimization for nearbyint[f]
This patch provides throughput boost for the nearbyint[f] functions
for POWER. For POWER7, it improves performance for nearbyintf from
5 (ppc32) to 6 times (ppc64) and for nearbyint from 2.5 up to 5
times. For POWER6 it improves nearbyintf up to 2x (ppc64) and
nearbyint up to 4x.
2011-12-29 19:41:37 -05:00
Adhemerval Zanella e73988fd47 Fix compilation due to __nan defines
Backport of commit #ee2aafe08e68c88412b7dcfa4b1e0d11789348f8
2011-12-29 19:39:22 -05:00
Andreas Schwab be802bc670 Fix a wrong constant in powerpc hypot implementation
Backport of commit #850fb039cec802072f70ed9763927881bbbf639c
2011-12-29 19:38:42 -05:00
Adhemerval Zanella 994f2519e9 PowerPC: Arithmetic function optimizations for POWER
This patch creates inline assembly functions that use intrinsic PPC
floating point instructions when the platform supports them but rely on
the internal GLIBC functions when the instructions are not implemented
(for instance, on POWER4).
2011-12-29 19:37:51 -05:00
Ulrich Drepper 69573077ca Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option
and lots of the wrapper functions have been optimized.

Backport of commit #0ac5ae2335292908f39031b1ea9fe8edce433c0f
2011-12-29 19:37:22 -05:00
Andreas Schwab bb365f5895 Fix PLT uses in libm on powerpc
Backport of commit #edc121be8b53da57950daf6f42a619b5826f30b6
2011-12-29 19:36:37 -05:00
Andreas Schwab 91f0a13b84 Fix POWER4/POWER7 optimized strncmp to not read past differing bytes 2011-09-28 08:50:59 -05:00
Will Schmidt b8ab495888 Optimize the aligned copy for power7 with vector-scalar insns. 2011-09-12 16:38:37 -05:00
Ryan S. Arnold 33ec460272 Prevent Altivec and VSX insns on PowerPC64 when no FPRs or VRs are avail. 2011-09-12 16:37:09 -05:00
Alan Modra 736d35d801 Fix profiling on powerpc32 secure-plt shared libs and PIEs
This patch moves the ppc32 _mcount to libc_shared.a, fixing a
long-standing bug with profiling of secure-plt shared libraries and
PIEs.  The problem is that a ppc32 PIC PLT call stub uses r30 (GOT
pointer) to load the function address from the PLT, r30 being set up
in the function prologue, but _mcount is called before the function
prologue.  So chances are good that r30 will be pointing to the
executable GOT when trying to call _mcount in a shared lib function.
A similar problem can occur in a PIE if a shared lib calls a function
in the executable.
2011-09-12 16:33:41 -05:00
Dave Flaherty f0b0adf85a Check for finite/infinity parms in IBM Long Double 128 fmal( )
This patch addresses some IBM Long Double 128 fmal () test-ldouble.out
and test-ildoubl.out failures.  If the ‘x’ and ‘y’ parameters are
finite values and ‘z’ is infinity, the result of fmal () should be ‘z’
not NaN.
2011-09-12 16:33:28 -05:00
Will Schmidt 26c6464705 Provide a throughput boost to the 64-bit power7 strncmp code of approx
15%.  The 32-bit throughput is not notably affected by this change, so
the change to the 32-bit code is done to keep the two files in sync
with each other.
2011-09-12 16:33:08 -05:00
Adhemerval Zanella db97a804d6 Trigonometric optimizations for POWER cpus
These POWER optimizations remove most of the FP->INT conversions in
hypot/hypotf and sinf/cosf on POWER making the computation done with
FP operations instead.  This eliminates Load-Hit-Store (LHS) stalls,
increasing performance of hypot/hypotf (by about 100% on POWER7 and
12% on POWER6) and sinf/cosf (by 80% on POWER7 and 30% on POWER6).
2011-09-12 16:31:18 -05:00
Ryan S. Arnold 84bd767be4 Complete revert of git commit ec11dbe1aa
Avoid deadcode and remove regressive optimization for POWER[5|6].

Complete revert of git commit 5939fc0867

    Trigonometric optimizations for POWER cpus
2011-09-12 16:30:23 -05:00
Ryan S. Arnold fd5033a97d Revert git commit ec11dbe1aa
Avoid deadcode and remove regressive optimization for POWER[5|6].

Revert git commit 5939fc0867

    Trigonometric optimizations for POWER cpus
2011-09-09 11:58:57 -05:00
ryanarn 2c3d9ba9a3 Remove pthread_attr_setstacksize from __aio_create_helper_thread. 2011-07-01 09:42:21 -05:00
ryanarn 8ff7fa1ab2 Revert git commit db90a4844f 2011-07-01 09:20:52 -05:00
Alan Modra 114814b2f6 Static TLS memory leak fix (DTV case) 2011-07-01 07:43:18 -05:00
Ryan S. Arnold db90a4844f Set stacksize in __aio_create_helper_thread to default for AIO with TLS. 2011-07-01 07:02:57 -05:00
Adhemerval Zanella ec11dbe1aa Avoid deadcode and remove regressive optimization for POWER[5|6]. 2011-06-28 15:50:13 -05:00
Adhemerval Zanella 5939fc0867 Trigonometric optimizations for POWER cpus
These optimizations remove most of the FP->INT conversions making
the computation done with FP operations instead. This eliminates
Load-Hit-Store (LHS) stalls on POWER, increasing performance of
hypot/hypotf (about 50% on POWER7, 25% on POWER6, and 30% on POWER5)
and sinf/cosf (30% on POWER7, 15% on POWER6, and 10% on POWER5).
2011-06-17 13:30:52 -05:00
Ryan S. Arnold d3207287b3 Correct "//" in search paths due to LD_AT_PLATFORM="" 2011-05-25 11:11:25 -05:00
Jakub Jelinek a789ac9292 Fix two printf handler issues.
(cherry picked from commit c1d0e639a9)
2011-05-12 11:58:25 -05:00
Ryan S. Arnold 6c00470353 Correct POWER6 END(__isnan) to END(__isnanf). 2011-03-16 11:13:23 -05:00
Ryan S. Arnold 5322f446d6 Add #include <stdint.h> to tst-writev.c for backport. 2011-02-17 10:59:17 -06:00
Ryan S. Arnold d91306b8a4 Fix INTERNAL_[V]SYSCALL_NCS macros to not cast return val to int.
(cherry picked from commit d55fd7a557)
2011-02-17 10:26:34 -06:00
Ryan S. Arnold 8130708fe5 Prevent VSX type TOC ref in _dl_start before relocs are resolved.
Disable VSX instruction usage in rtld.c with -mno-vsx so that, under
-O3 optimization, a TOC reference isn't used for a zero constant in a
VSX register prior to resolution of relocations.
2011-02-16 13:04:16 -06:00
Ryan S. Arnold c5413f82ce Reverse -mno-vsx commits in order to correct it later.
Reversing commits c3b77b811f
and 4265a8e355
2011-02-16 12:49:32 -06:00
Ryan S. Arnold 4265a8e355 Prevent VSX type TOC ref in _dl_start before relocs are resolved.
Disable VSX instruction usage in rtld.c with -mno-vsx so that, under
-O3 optimization, a TOC reference isn't used for a zero constant in a
VSX register prior to resolution of relocations.
2011-02-15 10:06:16 -06:00
Ryan S. Arnold c3b77b811f Prevent VSX type TOC ref in _dl_start before relocs are resolved.
Disable VSX instruction usage in rtld.c with -mno-vsx so that, under
-O3 optimization, a TOC reference isn't used for a zero constant in a
VSX register prior to resolution of relocations.
2011-02-15 09:50:09 -06:00
Luis Machado 89972db69f Fix comparison in sqrtl for IBM long double 128.
(cherry picked from commit da93d21475)
2010-12-03 04:02:00 -02:00
Luis Machado d23dba104a power7-optimized mempcpy
(cherry picked from commit 344d0b545d)
2010-11-05 14:25:44 -02:00
Ryan Arnold 4e49771361 This patch is not upstream. It is useful and non-invasive. It allows some
recent versions of GCC to compile GLIBC when altivec is configured.

2009-11-06  Petr Baudis <pasky@suse.cz>

	* include/sys/uio.h: Change __vector to __iovec to avoid clash
	with altivec.
(cherry picked from commit bcb7566995)
2010-11-05 14:24:07 -02:00
Ryan Arnold ac02cf3af6 PowerPC64 doesn't need an executable stack and therefore doesn't need
PT_GNU_STACK to make the stack no-exec.  This change abstracts the stack
permissions settings into a macro defined in a header.
2010-11-01 15:38:51 -05:00
Jakub Jelinek fbe0f55169 IEEE quad fmal fixes
(cherry picked from commit 7c08a05c5f)
2010-11-01 03:19:24 -02:00
Michael Meissner f302527f2c Add C99 FP_FAST_FMA{,F,L} macros to math.h
(cherry picked from commit d20501241e)
2010-11-01 03:14:29 -02:00
Jakub Jelinek e5aca84376 Missing CL.
(cherry picked from commit 475facd1f5)
2010-11-01 02:59:32 -02:00
Jakub Jelinek 8c12ca1392 Implement fmal, some fma bugfixes
(cherry picked from commit 3e692e0518)
2010-11-01 02:55:04 -02:00
Jakub Jelinek fdef892bb5 Fix some more dbl-64/s_fma.c issue
(cherry picked from commit f3f7372de1)
2010-11-01 02:53:53 -02:00
Jakub Jelinek 975df17058 Implement accurate fma.
(cherry picked from commit 5e908464b9)
2010-11-01 02:52:40 -02:00
Jakub Jelinek 95636801ca Correct implementation of fmaf. 2010-11-01 02:45:05 -02:00
Michael B. Brutman e938cde08c powerpc: PPCA2/A2 optimized memcpy function
(cherry picked from commit d0b9e94faf)
2010-11-01 00:48:37 -02:00
Alan Modra f17cdc83d3 PowerPC64 ABI fixes
(cherry picked from commit bebff237c5)
2010-11-01 00:08:50 -02:00
Ulrich Drepper 3a93b6d439 Whitespace fixes.
(cherry picked from commit 9b059f9774)
2010-11-01 00:05:53 -02:00
Luis Machado bc0fd0203a POWER6/7 optimizations for copysign
(cherry picked from commit 77c1b06986)
2010-11-01 00:04:36 -02:00
Luis Machado 1693efdc71 powerpc: Various P7-optimized string functions
(cherry picked from commit fe2f79db99)
2010-10-31 23:59:38 -02:00
Luis Machado 27513ffe71 powerpc: Re-work the Implies structure
This patch tries to organize the implies files for ppc, since there are
a number of processors and most of them are compatible with each other
(backwards compatible).

Having in mind that we start the search for processor-specific files in
the sysdeps/unix/sysv/linux tree
(sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/[processor]/fpu to be
exact), we would like to grab any linux-specific code from that tree
prior to going through the other tree (sysdeps/powerpc/...).

For that, i removed the Implies files that were originally inside the
fpu directories and placed then in the non-fpu directories (still inside
the unix/sysv/linux tree). If no processor-specific/linux-specific files
could be found, we "imply" the other tree's (sysdeps/powerpc/...) fpu
directory for that specific processor AND also the non-fpu directory for
that same tree.

If, again, no processor-specific code is found, we read another Implies
file that will point to the most compatible processor that we should
grab code from, and so on, until we reach the power4 processor.

So, in summary, the Implies files will live inside these directories
now:

* sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/[processor]
* sysdeps/powerpc/powerpc[32|64]/[processor]

Practical example of the order we will use to pick power6-specific code
with the new structure.

sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/power6/fpu ->
sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/power6 ->
sysdeps/powerpc/powerpc[32|64]/power6/fpu ->
sysdeps/powerpc/powerpc[32|64]/power6 ->
sysdeps/powerpc/powerpc[32|64]/power5+/fpu ->
sysdeps/powerpc/powerpc[32|64]/power5+ ->
sysdeps/powerpc/powerpc[32|64]/power5/fpu ->
sysdeps/powerpc/powerpc[32|64]/power5 ->
sysdeps/powerpc/powerpc[32|64]/power4/fpu ->
sysdeps/powerpc/powerpc[32|64]/power4 (from here, it'll go to the
generic path as usual)
(cherry picked from commit f47c9a11ad)
2010-10-31 23:58:13 -02:00
Ulrich Drepper eee4b41933 More whitespace fixes.
(cherry picked from commit af6edc9c6a)
2010-10-31 23:55:21 -02:00
Ulrich Drepper 866aed341f Fix whitespaces.
(cherry picked from commit 1dc242356a)
2010-10-31 23:55:15 -02:00
Luis Machado 06c11f2a33 power7 string compare optimizations
(cherry picked from commit 158db12267)
2010-10-31 23:55:11 -02:00
Luis Machado 4b2ab09c59 Small fix to POWER7 32-bit memset
(cherry picked from commit ebd2e13d67)
2010-10-30 11:27:26 -02:00
Luis Machado 35521fabd4 Small fix to POWER7 32-bit memcpy
(cherry picked from commit eb5ad2eb0d)
2010-10-30 11:26:08 -02:00
Luis Machado 37b7beb6d6 Add missing files.
(cherry picked from commit 33b8d90a1b)
2010-10-30 01:17:24 -02:00
Luis Machado 855d8c8796 POWER7 optimized memset.
(cherry picked from commit 4828935d38)
2010-10-30 01:17:15 -02:00
Ryan Arnold f44ace3d49 Allow AT_PLATFORM=foo as an env variable to the loader to override the
AT_PLATFORM value coming out of the aux vector.
2010-10-26 16:26:43 -05:00
Ulrich Drepper fc0ed7b647 Add test case for strstr problem.
(cherry picked from commit 67a67b950b)
2010-10-08 12:12:51 +02:00
Eric Blake e6620c0a44 Fix strstr and memmem algorithm.
(cherry picked from commit 5fb308bca2)
2010-10-08 12:12:50 +02:00
Ulrich Drepper b422509e58 Fix handling of tail bytes of buffer in SSE2/SSSE3 x86-64 version strncmp
(cherry picked from commit 45db99c7d0)
2010-10-08 12:12:29 +02:00
Andreas Schwab fdae8096fe Fix ifunc thunk for strspn on x86 in static libc
(cherry picked from commit bdaa77bc20)
2010-08-19 17:33:30 +02:00
Ulrich Drepper d8d583fc44 (__getlogin_r_loginuid): Also fail if tpwd after pwuid call is NULL.
(cherry picked from commit c86434ccb5)
2010-08-17 11:06:31 +02:00
Andreas Schwab d48b760747 More fixes to error handling in getlogin_r.
(cherry picked from commit e35fcef8b7)
2010-08-17 10:59:28 +02:00
Ulrich Drepper 5305f9b09d Fix error handling in Linux getlogin*.
(cherry picked from commit 63c4ed22b5)
2010-08-17 10:59:13 +02:00
Andreas Schwab 6164128f1c glibc 2.12.1 release 2010-07-27 13:34:39 +02:00
Andreas Schwab e91943bf35 Regenerate NOTES 2010-07-27 13:34:17 +02:00
Kirill A. Shutemov 9a98163f26 Flush cache after solving TEXTRELs if arch requires it.
(cherry picked from commit 80da2e093c)
2010-06-15 15:02:46 +02:00
Takashi Yoshii edf8365a16 [sh] Fix incorrect location of ifndef for __ASSUME_FUTEX_CLOCK_REALTIME.
(cherry picked from commit 4bc93b3033)
2010-06-15 15:02:19 +02:00
Andreas Schwab cea9bac7b2 Fix use of extend_alloca in NIS
(cherry picked from commit caa78cf824)
2010-06-15 14:56:04 +02:00
Jakub Jelinek d9c46d474b Fix a couple of __REDIRECT () __THROW occurrences
This patch fixes some cases which fail to parse with C++.
(cherry picked from commit f32f28695d)
2010-06-14 17:27:22 +02:00
H.J. Lu 6f8d0c6391 Incorrect x86 CPU family and model check.
(cherry picked from commit 3c88fe1e3a)
2010-06-01 09:54:08 +02:00
Takashi Yoshii f29cabcd71 Fix iov[] size in SH register_dump()
(cherry picked from commit d2f7315176)
2010-06-01 09:54:07 +02:00
Ulrich Drepper a0ba5dee69 Don't crash on unresolved weak symbol reference when auditing.
(cherry picked from commit b32b8b451b)
2010-06-01 09:54:07 +02:00
Andreas Schwab 6155a84f4a Don't crash on unresolved weak symbol reference
(cherry picked from commit 9acbe24da8)
2010-06-01 09:54:07 +02:00
Andreas Schwab ea25a417dc Implement recvmmsg also as socketcall
(cherry picked from commit 3d04ff3a5d)
2010-06-01 09:54:07 +02:00
Andreas Schwab 0f67951a9a sunrpc: Fix spurious fall-through
(cherry picked from commit f0ccf6ea41)
2010-06-01 09:54:06 +02:00
Andreas Schwab 269f8e906b Make <sys/timex.h> compatible with C++
(cherry picked from commit 5b08ac571f)
2010-05-24 14:50:24 +02:00
238 changed files with 12294 additions and 644 deletions
+586
View File
@@ -1,3 +1,583 @@
2011-12-28 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* include/unistd.h: Defining __have_pipe2 as external variable.
* io/Makefile: Added have_pipe2 object.
* io/have_pipe2.c: Declaring __have_pipe2 variable.
2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
[BZ #13472]
* sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* math/libm-test.inc: Added more nerabyint tests.
* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file: nearbyint
optimized for PPC32.
* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file: nearbyintf
optimized for PPC32.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file: nearbyint
optimized for PPC64.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file: nearbyintf
optimized for PPC64.
2011-11-16 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
* sysdeps/powerpc/locale-defines.sym: Locale definitions for strcasecmp
optimized code.
* sysdeps/powerpc/powerpc32/power7/Makefile: New file: added unroll-loop
option for strncasecmp/strncasecmp_l compilation.
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S: New file: strcasecmp
optimization for PPC32.
* sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S: New file: strcasecmp_l
optimization for PPC32.
* sysdeps/powerpc/powerpc64/power7/Makefile: Added unroll-loop option for
strncasecmp/strncasecmp_l compilation.
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S: New file: strcasecmp
optimization for PPC64.
* sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S: New file: strcasecmp_l
optimization for PPC64.
2011-11-07 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/math_private.h: Using inline assembly version
of math functions ceil, trunc, floor, round, and sqrt, when
avaliable on the platform.
* sysdeps/powerpc/fpu/e_sqrt.c: Undefine __ieee754_sqrt to avoid
name clash.
* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
"math_private.h".
2011-10-12 Ulrich Drepper <drepper@gmail.com>
Add integration with gcc's -ffinite-math-only and optimize wrapper
functions in libm.
* sysdeps/powerpc/fpu/e_hypot.c: Add __*_finite alias.
* sysdeps/powerpc/fpu/e_hypotf.c: Likewise.
* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
* sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
2011-09-15 Andreas Schwab <schwab@redhat.com>
* sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Use
__ieee754_sqrt instead of sqrt.
* sysdeps/powerpc/fpu/e_hypotf.c (__ieee754_hypotf): Use
__ieee754_sqrtf instead of sqrtf.
* sysdeps/powerpc/fpu/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
__floorf instead of floorf.
* sysdeps/powerpc/fpu/k_rem_pio2f.c (__fp_kernel_rem_pio2f): Use
__floorf, __truncf instead of floorf, truncf.
2011-08-18 David Flaherty <flaherty@linux.vnet.ibm.com>
* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: New file which checks
for finite and infinity parameters.
2011-08-15 Alan Modra <amodra@gmail.com>
PR 13092
* sysdeps/powerpc/Makefile (gmon): Move sysdep_routines to..
* sysdeps/powerpc/powerpc64/Makefile (gmon): ..here..
* sysdeps/powerpc/powerpc32/Makefile (gmon): ..and here. Add
ppc_mcount to static-only-routines.
* sysdeps/powerpc/powerpc32/Versions: Export GLIBC_PRIVATE
__mcount_internal.
* sysdeps/powerpc/powerpc32/ppc-mcount.S (_mcount): Call
__mcount_internal with usual JUMPTARGET. Remove useless nop.
2011-08-04 Will Schmidt <will_schmidt@vnet.ibm.com>
* sysdeps/powerpc/powerpc32/power7/strncmp.S: Adjust the alignment
and add nop instructions for throughput optimization.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Adjust the alignment
and nop instructions for throughput optimization.
2011-08-01 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/e_hypot.c: New file: hypot optimized for POWER.
* sysdeps/powerpc/fpu/e_hypotf.c: New file: hypotf optimized for POWER.
* sysdeps/powerpc/fpu/e_rem_pio2f.c: New file: optimized for POWER.
* sysdeps/powerpc/fpu/k_rem_pio2f.c: Likewise.
* sysdeps/powerpc/fpu/k_cosf.c: Likewise.
* sysdeps/powerpc/fpu/k_sinf.c: Likewise.
* sysdeps/powerpc/fpu/s_cosf.c: Likewise.
* sysdeps/powerpc/fpu/s_sinf.c: Likewise.
* sysdeps/powerpc/fpu/s_scalbnf.c: Likewise.
* sysdeps/powerpc/fpu/s_float_bitwise.h: new file: bitwise operation over
floats optimized for POWER7.
2011-07-28 Will Schmidt <will_schmidt@vnet.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memcpy.S: Optimize the
aligned copy for power7 with vector-scalar instructions.
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Optimize the
aligned copy for power7 with vector-scalar instructions.
2011-06-30 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
* nptl/sysdeps/unix/sysv/linux/aio_misc.h
(__aio_create_helper_thread): Remove call to
pthread_attr_setstacksize () which set the stacksize to
PTHREAD_STACK_MIN. This is too small if large amounts of TLS are in
use. Removing this call effectively sets stacksize to 'default'.
2011-05-25 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/dl-librecon.h
(EXTRA_LD_ENVVARS_11): Fix condition where there's an extra slash in
the search path, i.e., "//" when LD_AT_PLATFORM= or
LD_AT_PLATFORM="".
(EXTRA_UNSECURE_ENVVARS): Add LD_AT_PLATFORM to the list.
2011-05-18 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/powerpc/powerpc64/Makefile (no-special-regs): Add -mno-vsx
and -mno-altivec to prevent the compiler from using Altivec and/or
VSX instructions when the corresponding registers are not available.
2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
* sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
differing bytes.
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
2011-03-15 Alan Modra <amodra@gmail.com>
* elf/dl-reloc.c (_dl_try_allocate_static_tls <TLS_DTV_AT_TP>): Handle
l_tls_firstbyte_offset non-zero. Save padding offset in
l_tls_firstbyte_offset for later use. Add debug print.
* elf/dl-close.c (_dl_close_worker <TLS_DTV_AT_TP>): Correct code
freeing static tls block. Add debug print.
* elf/fl-tls.c (_dl_determine_tlsoffset): Add debug print.
2011-02-16 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
(INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
cast from r3.
* sysdeps/wordsize-64/Makefile: New file. Add tst-writev to
'tests' variable.
* sysdeps/wordsize-64/tst-writev.c: New file.
2011-02-16 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
-mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
insns in _dl_start to prevent a TOC reference before relocs are
resolved.
2011-02-11 Jakub Jelinek <jakub@redhat.com>
* stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
arginfo fn returning -1.
* stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
and thousands string is zero terminated.
2010-11-10 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Force
signed comparison.
2010-11-04 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power7/mempcpy.S: New file.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: New file.
2010-10-26 Ryan S. Arnold <rsa@us.ibm.com>
* config.h.in: Added HAVE_PPC64_PT_GNU_STACK which is set during a
configure test to determine whether the the $(CC) compiler defaults to
PT_GNU_STACK support for PPC64.
* elf/Makefile (($objpfx)check-execstac:): Replaced $(native-compile)
with an operation which does the same thing but searches sysdeps/ for
the testcase before settling on elf/check-execstack.c. This allows
overriding in sysdeps/powerpc/powerpc64/check-execstack.c.
* elf/dl-load.c (_dl_map_object_from_fd): Replace PF_R|RF_W|PF_X with
_STACK_FLAGS, defined in stackinfo.h.
* elf/dl-support.c (_dl_stack_flags): Likewise.
* elf/rtld.c (_rtld_global): Likewise.
* sysdeps/generic/stackinfo.h: Define _STACK_FLAGS = PF_R|PF_W|PF_X.
Define _STACKINFO_H.
* sysdeps/i386/stackinfo.h: Include <sysdeps/generic/stackinfo.h> and
remove #define _STACKINFO_H.
* sysdeps/ia64/stackinfo.h: Likewise.
* sysdeps/s390/stackinfo.h: Likewise.
* sysdeps/sh/stackinfo.h: Likewise.
* sysdeps/sparc/stackinfo.h: Likewise.
* sysdeps/x86_64/stackinfo.h: Likewise.
* sysdeps/powerpc/stackinfo.h: Define _STACK_FLAGS as PF_R|PF_W, i.e.,
nonexecutable, on PowerPC64, but PF_R|PF_W|PF_X on PowerPC32.
* sysdeps/powerpc/powerpc64/check-execstack.c: New file which checks
the test executable to make sure it doesn't have PT_GNU_STACK set and
then checks the executable to see if the mapfile indicates that
the [stack] is nonexecutable.
* sysdeps/powerpc/powerpc64/configure: Regenerated.
* sysdeps/powerpc/powerpc64/configure.in: Added fragment to test for
PT_GNU_STACK default in the compiler. It sets HAVE_PPC64_PT_GNU_STACK.
2010-10-16 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Add IEEE quad long double fmal tests.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Ensure a1 + u.d
computation is not scheduled after fetestexcept. Fix value
of minimum denormal long double.
2010-10-19 Michael Meissner <meissner@linux.vnet.ibm.com>
* bits/mathdef.h (FP_FAST_FMA): If the GCC 4.6 port has fast fma
builtins, define the macros in the C99 standard.
(FP_FAST_FMAF): Likewise.
(FP_FAST_FMAL): Likewise.
* sysdeps/powerpc/bits/mathdef.h (FP_FAST_FMA): Define, ppc as
multiply/add.
(FP_FAST_FMAF): Likewise.
2010-10-15 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Some new testcases.
* sysdeps/ieee754/ldbl-128/s_fmal.c: New file.
* sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Fix fma with finite x and
y and infinite z. Do multiplication by C already in long double.
* sysdeps/ieee754/ldbl-96/s_fmal.c: New file.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Fix fma with finite x and
y and infinite z. Do bitwise or of inexact bit into u.d.
* sysdeps/ieee754/ldbl-64-128/s_fmal.c: New file.
* sysdeps/i386/fpu/s_fmaf.S: Removed.
* sysdeps/i386/fpu/s_fma.S: Removed.
* sysdeps/i386/fpu/s_fmal.S: Removed.
2010-10-14 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Add some more tests.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Handle underflows
correctly.
2010-10-13 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Some more fmaf and fma tests.
* sysdeps/i386/i686/multiarch/s_fma.c: Include ldbl-96 version
instead of dbl-64.
* sysdeps/i386/fpu/bits/mathinline.h (fma, fmaf, fmal): Remove
inlines.
* sysdeps/ieee754/ldbl-96/s_fma.c: New file.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Fix exponent adjustment
if one of x and y is very large and the other is subnormal.
* sysdeps/s390/fpu/s_fmaf.c: New file.
* sysdeps/s390/fpu/s_fma.c: New file.
* sysdeps/powerpc/fpu/s_fmaf.S: New file.
* sysdeps/powerpc/fpu/s_fma.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_fma.S: New file.
* sysdeps/powerpc/powerpc64/fpu/s_fma.S: New file.
* sysdeps/unix/sysv/linux/s390/fpu/s_fma.c: New file.
2010-10-12 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Add some more fmaf tests, add
fma tests.
* sysdeps/ieee754/dbl-64/s_fmaf.c (__fmaf): Fix Inf/Nan check.
* sysdeps/ieee754/dbl-64/s_fma.c: New file.
* sysdeps/i386/i686/multiarch/s_fma.c: Include
sysdeps/ieee754/dbl-64/s_fma.c instead of math/s_fma.c.
* sysdeps/x86_64/multiarch/s_fma.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fma.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_fma.c: New file.
2010-10-07 Jakub Jelinek <jakub@redhat.com>
[BZ #3268]
* math/libm-test.inc (fma_test): Add 2 fmaf tests.
* sysdeps/ieee754/dbl-64/s_fmaf.c: New file.
* sysdeps/i386/i686/multiarch/s_fmaf.c: Include
sysdeps/ieee754/dbl-64/s_fmaf.c instead of math/s_fmaf.c.
* sysdeps/x86_64/multiarch/s_fmaf.c: Likewise.
* include/fenv.h (feupdateenv, fetestexcept): Add libm_hidden_proto.
* math/feupdateenv.c (feupdateenv): Add libm_hidden_ver.
* sysdeps/i386/fpu/feupdateenv.c (feupdateenv): Likewise.
* sysdeps/powerpc/fpu/feupdateenv.c (feupdateenv): Likewise.
* sysdeps/x86_64/fpu/feupdateenv.c (feupdateenv): Likewise.
* sysdeps/sparc/fpu/feupdateenv.c (feupdateenv): Likewise.
* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Add libm_hidden_def.
* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
* math/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/ia64/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/i386/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/s390/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/x86_64/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/sparc/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/sh/sh4/fpu/ftestexcept.c (fetestexcept): Likewise.
2010-10-20 Michael B. Brutman <brutman@us.ibm.com>
* sysdeps/powerpc/dl-procinfo.c: Add support for ppca2 platform
* sysdeps/powerpc/dl-procinfo.h: Add support for ppca2 platform
* sysdeps/powerpc/powerpc32/a2/memcpy.S: New file.
* sysdeps/powerpc/powerpc64/a2/memcpy.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/a2/Implies: New
submachine.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/a2/Implies: Likewise.
2010-05-01 Alan Modra <amodra@gmail.com>
* sysdeps/powerpc/powerpc32/power4/memcmp.S: Correct cfi for r24.
* sysdeps/powerpc/powerpc64/bsd-_setjmp.S: Move contents..
* sysdeps/powerpc/powerpc64/bsd-setjmp.S: ..and these too..
* sysdeps/powerpc/powerpc64/setjmp.S: ..to here..
* sysdeps/powerpc/powerpc64/setjmp-common.S: ..and here, with some
tidying. Don't tail-call __sigjmp_save for static lib.
* sysdeps/powerpc/powerpc64/sysdep.h (SAVE_ARG, REST_ARG): Correct
save location.
(CFI_SAVE_ARG, CFI_REST_ARG): New macros.
(CALL_MCOUNT): Add eh info, and nop after bl.
(TAIL_CALL_SYSCALL_ERROR): New macro.
(PSEUDO_RET): Use it.
* sysdeps/powerpc/powerpc64/dl-trampoline.S (_dl_runtime_resolve):
Correct save location of integer regs and cr.
(_dl_profile_resolve): Correct cr save location. Delete nops
after bl when SHARED. Reduce cfi size a little by better
placement of cfi directives.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S (__copysign): Don't
make a stack frame. Instead use parm save area as a temp.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S (__brk): Don't
make a stack frame. Use TAIL_CALL_SYSCALL_ERROR.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
Don't make a stack frame for parent, use parm save area.
Increase child stack frame to 112 bytes. Don't save unused reg,
and adjust reg usage. Set up cfi on error recovery and
epilogue of parent, and use TAIL_CALL_SYSCALL_ERROR, PSEUDO_RET.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
(__makecontext): Add dummy nop after jump to exit.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S (__socket):
Use correct parm save area and cr save, reduce stack frame.
Correct cfi for possible PSEUDO_RET frame setup.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S (__vfork):
Branch to local label emitted by PSEUDO_RET rather than
__syscall_error.
2010-06-15 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: New file.
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S: New file.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: New file.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S: New file.
2010-08-19 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memchr.S: New file.
* sysdeps/powerpc/powerpc32/power7/memrchr.S: New file.
* sysdeps/powerpc/powerpc32/power7/rawmemchr.S: New file.
* sysdeps/powerpc/powerpc32/power7/strchr.S: New file.
* sysdeps/powerpc/powerpc32/power7/strchrnul.S: New file.
* sysdeps/powerpc/powerpc32/power7/strlen.S: New file.
* sysdeps/powerpc/powerpc32/power7/strnlen.S: New file.
* sysdeps/powerpc/powerpc64/power7/memchr.S: New file.
* sysdeps/powerpc/powerpc64/power7/memrchr.S: New file.
* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: New file.
* sysdeps/powerpc/powerpc64/power7/strchr.S: New file.
* sysdeps/powerpc/powerpc64/power7/strchrnul.S: New file.
* sysdeps/powerpc/powerpc64/power7/strlen.S: New file.
* sysdeps/powerpc/powerpc64/power7/strnlen.S: New file.
2010-06-21 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/970/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc32/power5/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc32/power5+/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc32/power6x/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc64/970/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc64/power5/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc64/power5+/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc64/power6x/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/970/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power4/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power5/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power5+/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6x/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power7/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/970/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power4/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power5/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power5+/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6x/fpu/Implies: Remove.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power7/fpu/Implies: Remove.
* sysdeps/powerpc/powerpc32/970/Implies: Point to power4.
* sysdeps/powerpc/powerpc32/power5/Implies: Point to power4.
* sysdeps/powerpc/powerpc32/power5+/Implies: Point to power5.
* sysdeps/powerpc/powerpc32/power6/Implies: Point to power5+.
* sysdeps/powerpc/powerpc32/power6x/Implies: Point to power6.
* sysdeps/powerpc/powerpc64/970/Implies: Point to power4.
* sysdeps/powerpc/powerpc64/power5/Implies: Point to power4.
* sysdeps/powerpc/powerpc64/power5+/Implies: Point to power5.
* sysdeps/powerpc/powerpc64/power6/Implies: Point to power5+.
* sysdeps/powerpc/powerpc64/power6x/Implies: Point to power6.
* sysdeps/powerpc/powerpc32/power7/Implies: New file.
* sysdeps/powerpc/powerpc64/power7/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/970/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/cell/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power4/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power5/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6x/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power7/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/970/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/cell/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power4/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power5/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6x/Implies: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power7/Implies: New file.
2010-06-10 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memcmp.S: New file
* sysdeps/powerpc/powerpc64/power7/memcmp.S: New file.
* sysdeps/powerpc/powerpc32/power7/strncmp.S: New file.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: New file.
2010-05-24 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memset.S: POWER7 32-bit memset fix.
2010-05-28 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memcpy.S: Exchange srdi for srwi.
2010-05-17 Luis Machado <luisgpm@br.ibm.com>
POWER7 optimizations.
* sysdeps/powerpc/powerpc64/power7/memset.S: New file.
* sysdeps/powerpc/powerpc32/power7/memset.S: New file.
2010-10-26 Peter Bergner <bergner@vnet.ibm.com>
* elf/rtld.c (process_envvars): Added conditional EXTRA_LD_ENVVARS_11
macro which allows overriding of AT_PLATFORM using an environment
variable.
* sysdeps/unix/sysv/linux/powerpc/dl-librecon.h: New file adding
definition for the EXTRA_LD_ENVVARS_11 macro.
2010-10-06 Ulrich Drepper <drepper@gmail.com>
* string/bug-strstr1.c: New file.
* string/Makefile: Add rules to build and run bug-strstr1.
2010-10-05 Eric Blake <eblake@redhat.com>
[BZ #12092]
* string/str-two-way.h (two_way_long_needle): Always clear memory
when skipping input due to the shift table.
2010-10-03 Ulrich Drepper <drepper@gmail.com>
[BZ #12077]
* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
for strncmp.
* string/stratcliff.c: Add tests for strcmp and strncmp.
* wcsmbs/wcsatcliff.c: Adjust for stratcliff change.
2010-08-19 Andreas Schwab <schwab@redhat.com>
* sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check.
2010-08-06 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
Also fail if tpwd after pwuid call is NULL.
2010-06-21 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
Restore proper fallback handling.
2010-06-19 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Handle
OOM in getpwuid_r correctly. Return error number when the caller
should return, otherwise -1.
(getlogin_r): Adjust to return also for result of __getlogin_r_loginuid
call returning > 0 value.
* sysdeps/unix/sysv/linux/getlogin.c (getlogin): Likewise.
2010-07-27 Andreas Schwab <schwab@redhat.com>
* version.h (VERSION): Bump for 2.12.1 release.
2010-06-02 Kirill A. Shutemov <kirill@shutemov.name>
* elf/dl-reloc.c: Flush cache after solving TEXTRELs if arch
requires it.
2010-06-02 Andreas Schwab <schwab@redhat.com>
* nis/nss_nis/nis-initgroups.c (get_uid): Properly resize buffer.
2010-06-07 Jakub Jelinek <jakub@redhat.com>
* libio/stdio.h (sscanf, vsscanf): Use __REDIRECT_NTH instead of
__REDIRECT followed by __THROW.
* wcsmbs/wchar.h (swscanf, vswscanf): Likewise.
* posix/getopt.h (getopt): Likewise.
2010-05-26 H.J. Lu <hongjiu.lu@intel.com>
[BZ #11640]
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
Properly check family and model.
2010-05-26 Takashi Yoshii <takashi.yoshii.zj@renesas.com>
* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Fix iov[] size.
2010-05-21 Ulrich Drepper <drepper@redhat.com>
* elf/dl-runtime.c (_dl_profile_fixup): Don't crash on unresolved weak
symbol reference.
2010-05-19 Andreas Schwab <schwab@redhat.com>
* elf/dl-runtime.c (_dl_fixup): Don't crash on unresolved weak
symbol reference.
2010-05-21 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add recvmmsg
and internal_recvmmsg.
* sysdeps/unix/sysv/linux/recvmmsg.c: New file.
* sysdeps/unix/sysv/linux/internal_recvmmsg.S: New file.
* sysdeps/unix/sysv/linux/socketcall.h (SOCKOP_recvmmsg): Define.
* sysdeps/unix/sysv/linux/syscalls.list (recvmmsg): Remove.
2010-05-21 Andreas Schwab <schwab@redhat.com>
* sunrpc/clnt_tcp.c (clnttcp_control): Add missing break.
* sunrpc/clnt_udp.c (clntudp_control): Likewise.
* sunrpc/clnt_unix.c (clntunix_control): Likewise.
2010-05-20 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/sys/timex.h: Use __REDIRECT_NTH.
2010-05-12 Andrew Stubbs <ams@codesourcery.com>
* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Really disable all
@@ -18,4 +598,10 @@
added check. Only act on the data if no current modification
happened.
2009-11-06 Petr Baudis <pasky@suse.cz>
* include/sys/uio.h: Change __vector to __iovec to avoid clash
with altivec.
See ChangeLog.17 for earlier changes.
+16 -1
View File
@@ -1,10 +1,25 @@
GNU C Library NEWS -- history of user-visible changes. 2010-5-4
GNU C Library NEWS -- history of user-visible changes. 2010-5-19
Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
See the end for copying conditions.
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
using `glibc' in the "product" field.
Version 2.13
* The following bugs are resolved with this release:
3268, 7066, 10851, 11611, 11640, 11701, 11840, 11856, 11883, 11903, 11904,
11968, 11979, 12005, 12037, 12067, 12077, 12092, 12107
* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
* POWER7 optimizations: memset, memcmp, strncmp
* New optimized string functions for x86-64: strnlen (SSE2),
strcasecmp (SSE2, SSSE3, SSE4.2), strncasecmp (SSE2, SSSE3, SSE4.2)
Implemented by Ulrich Drepper.
Version 2.12
* The following bugs are resolved with this release:
+1 -1
View File
@@ -184,7 +184,7 @@ relying on semantics undefined within the standard.
Note that if you do this, you must link your program with the BSD
compatibility library by passing the `-lbsd-compat' option to the
compiler or linker. *Note:* If you forget to do this, you may get
compiler or linker. *NB:* If you forget to do this, you may get
very strange errors at run time.
-- Macro: _REENTRANT
+14
View File
@@ -34,6 +34,20 @@ typedef double double_t; /* `double' expressions are evaluated as
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN 2147483647
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
builtins are supported. */
#if __FP_FAST_FMA
# define FP_FAST_FMA 1
#endif
#if __FP_FAST_FMAF
# define FP_FAST_FMAF 1
#endif
#if __FP_FAST_FMAL
# define FP_FAST_FMAL 1
#endif
#endif /* ISO C99 */
#ifndef __NO_LONG_DOUBLE_MATH
+3
View File
@@ -195,6 +195,9 @@
/* Define if your compiler defaults to -msecure-plt mode on ppc. */
#undef HAVE_PPC_SECURE_PLT
/* Define if your compiler emits a PT_GNU_STACK header for ppc64. */
#undef HAVE_PPC64_PT_GNU_STACK
/* Define if __stack_chk_guard canary should be randomized at program startup. */
#undef ENABLE_STACKGUARD_RANDOMIZE
+6 -1
View File
@@ -899,8 +899,13 @@ $(objpfx)check-textrel: check-textrel.c
$(native-compile)
check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99
# Perform the same operation as $(native-compile) but search sysdeps/ for a
# matching testcase file before settling for the testcase in elf/.
$(objpfx)check-execstack: check-execstack.c
$(native-compile)
$(make-target-directory)
$(patsubst %/,cd % &&,$(objpfx)) \
$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
$(firstword $(wildcard $(addsuffix /$<,$(addprefix $(shell pwd)/,$(sysdirs)) $(shell pwd)))) -o $(@F)
check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
$(objpfx)check-localplt: check-localplt.c
+36 -10
View File
@@ -582,25 +582,51 @@ _dl_close_worker (struct link_map *map)
}
}
#elif TLS_DTV_AT_TP
if ((size_t) imap->l_tls_offset == tls_free_end)
if (tls_free_start == NO_TLS_OFFSET)
{
tls_free_start = imap->l_tls_firstbyte_offset;
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
}
else if (imap->l_tls_firstbyte_offset == tls_free_end)
/* Extend the contiguous chunk being reclaimed. */
tls_free_end -= imap->l_tls_blocksize;
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
else if (imap->l_tls_offset + imap->l_tls_blocksize
== tls_free_start)
/* Extend the chunk backwards. */
tls_free_start = imap->l_tls_offset;
else
tls_free_start = imap->l_tls_firstbyte_offset;
/* This isn't contiguous with the last chunk freed.
One of them will be leaked unless we can free
one block right away. */
else if (imap->l_tls_offset + imap->l_tls_blocksize
== GL(dl_tls_static_used))
GL(dl_tls_static_used) = imap->l_tls_firstbyte_offset;
else if (tls_free_end == GL(dl_tls_static_used))
{
/* This isn't contiguous with the last chunk freed.
One of them will be leaked. */
if (tls_free_end == GL(dl_tls_static_used))
GL(dl_tls_static_used) = tls_free_start;
tls_free_start = imap->l_tls_offset;
tls_free_end = tls_free_start + imap->l_tls_blocksize;
GL(dl_tls_static_used) = tls_free_start;
tls_free_start = imap->l_tls_firstbyte_offset;
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
}
else if (tls_free_end < imap->l_tls_firstbyte_offset)
{
/* We pick the later block. It has a chance to
be freed. */
tls_free_start = imap->l_tls_firstbyte_offset;
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
}
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
_dl_debug_printf ("\nstatic tls free: %s\n"
" tls_free_start = %Zu, "
"tls_free_end = %Zu, "
"dl_tls_static_used = %Zu\n",
imap->l_name[0] ? imap->l_name
: rtld_progname,
tls_free_start, tls_free_end,
GL(dl_tls_static_used));
}
}
+4 -2
View File
@@ -999,8 +999,10 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
}
}
/* Presumed absent PT_GNU_STACK. */
uint_fast16_t stack_flags = PF_R|PF_W|PF_X;
/* On most architectures presume that PT_GNU_STACK is absent and the stack is
* executable. Other architectures default to a nonexecutable stack and don't
* need PT_GNU_STACK to do so. */
uint_fast16_t stack_flags = _STACK_FLAGS;
{
/* Scan the program header table, collecting its load commands. */
+20 -6
View File
@@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
Copyright (C) 1995-2006, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1995-2006, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -77,23 +77,33 @@ _dl_try_allocate_static_tls (struct link_map *map)
map->l_tls_offset = GL(dl_tls_static_used) = offset;
#elif TLS_DTV_AT_TP
size_t offset;
size_t used;
size_t check;
size_t offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
used = offset + map->l_tls_blocksize;
check = used;
/* dl_tls_static_used includes the TCB at the beginning. */
offset = (((GL(dl_tls_static_used)
- map->l_tls_firstbyte_offset
+ map->l_tls_align - 1) & -map->l_tls_align)
+ map->l_tls_firstbyte_offset);
used = offset + map->l_tls_blocksize;
if (check > GL(dl_tls_static_size))
if (used > GL(dl_tls_static_size))
goto fail;
map->l_tls_offset = offset;
map->l_tls_firstbyte_offset = GL(dl_tls_static_used);
GL(dl_tls_static_used) = used;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
_dl_debug_printf ("\nstatic tls: %s\n"
" l_tls_offset = %Zu, l_tls_firstbyte_offset = %Zu,"
" dl_tls_static_used = %Zu\n",
map->l_name[0] ? map->l_name : rtld_progname,
map->l_tls_offset, map->l_tls_firstbyte_offset,
GL(dl_tls_static_used));
/* If the object is not yet relocated we cannot initialize the
static TLS region. Delay it. */
if (map->l_real->l_relocated)
@@ -307,6 +317,10 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
goto call_error;
}
#ifdef CLEAR_CACHE
CLEAR_CACHE (textrels->start, textrels->start + textrels->len);
#endif
textrels = textrels->next;
}
+7 -5
View File
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -144,7 +144,8 @@ _dl_fixup (
/* And now perhaps the relocation addend. */
value = elf_machine_plt_value (l, reloc, value);
if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
if (sym != NULL
&& __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
value = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) ();
/* Finally, fix up the plt itself. */
@@ -231,8 +232,9 @@ _dl_profile_fixup (
? LOOKUP_VALUE_ADDRESS (result)
+ defsym->st_value : 0);
if (__builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
== STT_GNU_IFUNC, 0))
if (defsym != NULL
&& __builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
== STT_GNU_IFUNC, 0))
value = ((DL_FIXUP_VALUE_TYPE (*) (void))
DL_FIXUP_VALUE_ADDR (value)) ();
}
@@ -369,7 +371,7 @@ _dl_profile_fixup (
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
{
if (afct->ARCH_LA_PLTENTER != NULL
if (afct->ARCH_LA_PLTENTER != NULL
&& (reloc_result->enterexit
& (LA_SYMB_NOPLTENTER << (2 * (cnt + 1)))) == 0)
{
+4 -2
View File
@@ -32,6 +32,7 @@
#include <dl-procinfo.h>
#include <unsecvars.h>
#include <hp-timing.h>
#include <stackinfo.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
@@ -134,8 +135,9 @@ uint64_t _dl_hwcap __attribute__ ((nocommon));
setting _dl_hwcap nonzero below, but we do anyway. */
uint64_t _dl_hwcap_mask __attribute__ ((nocommon));
/* Prevailing state of the stack, PF_X indicating it's executable. */
ElfW(Word) _dl_stack_flags = PF_R|PF_W|PF_X;
/* Prevailing state of the stack. Generally this includes PF_X, indicating it's
* executable but this isn't true for all architectures. */
ElfW(Word) _dl_stack_flags = _STACK_FLAGS;
/* If loading a shared object requires that we make the stack executable
when it was not, we do it by calling this function.
+5
View File
@@ -249,6 +249,11 @@ _dl_determine_tlsoffset (void)
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
_dl_debug_printf ("\ninitial static tls: "
"dl_tls_static_used = %Zu, dl_tls_status_size = %Zu\n",
GL(dl_tls_static_used), GL(dl_tls_static_size));
/* The alignment requirement for the static TLS block. */
GL(dl_tls_static_align) = max_align;
}
+9 -2
View File
@@ -40,6 +40,7 @@
#include <dl-osinfo.h>
#include <dl-procinfo.h>
#include <tls.h>
#include <stackinfo.h>
#include <assert.h>
@@ -122,8 +123,9 @@ INTVARDEF(_dl_starting_up)
(except those which cannot be added for some reason). */
struct rtld_global _rtld_global =
{
/* Default presumption without further information is executable stack. */
._dl_stack_flags = PF_R|PF_W|PF_X,
/* Generally the default presumption without further information is an
* executable stack but this is not true on all architectures. */
._dl_stack_flags = _STACK_FLAGS,
#ifdef _LIBC_REENTRANT
._dl_load_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
._dl_load_write_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
@@ -2600,6 +2602,11 @@ process_envvars (enum mode *modep)
break;
case 11:
#ifdef EXTRA_LD_ENVVARS_11
/* We might have some extra environment variables with length 11
to handle. */
EXTRA_LD_ENVVARS_11
#endif
/* Path where the binary is found. */
if (!INTUSE(__libc_enable_secure)
&& memcmp (envline, "ORIGIN_PATH", 11) == 0)
+2
View File
@@ -17,5 +17,7 @@ libm_hidden_proto (fegetenv)
libm_hidden_proto (fesetenv)
libm_hidden_proto (fesetround)
libm_hidden_proto (feholdexcept)
libm_hidden_proto (feupdateenv)
libm_hidden_proto (fetestexcept)
#endif
+4 -4
View File
@@ -2,12 +2,12 @@
#include <misc/sys/uio.h>
/* Now define the internal interfaces. */
extern ssize_t __readv (int __fd, __const struct iovec *__vector,
extern ssize_t __readv (int __fd, __const struct iovec *__iovec,
int __count);
extern ssize_t __libc_readv (int __fd, __const struct iovec *__vector,
extern ssize_t __libc_readv (int __fd, __const struct iovec *__iovec,
int __count);
extern ssize_t __writev (int __fd, __const struct iovec *__vector,
extern ssize_t __writev (int __fd, __const struct iovec *__iovec,
int __count);
extern ssize_t __libc_writev (int __fd, __const struct iovec *__vector,
extern ssize_t __libc_writev (int __fd, __const struct iovec *__iovec,
int __count);
#endif
+1 -4
View File
@@ -171,10 +171,7 @@ extern int __libc_pause (void);
extern int __pause_nocancel (void) attribute_hidden;
extern int __have_sock_cloexec;
/* At lot of other functionality became available at the same time as
SOCK_CLOEXEC. Avoid defining separate variables for all of them
unless it is really necessary. */
#define __have_pipe2 __have_sock_cloexec
extern int __have_pipe2;
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;
+1 -1
View File
@@ -54,7 +54,7 @@ routines := \
sendfile sendfile64 \
utimensat futimens
aux := have_o_cloexec
aux := have_o_cloexec have_pipe2
# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
+6 -14
View File
@@ -1,7 +1,5 @@
/* Compute (X * Y) + Z as ternary operation.
Copyright (C) 1997 Free Software Foundation, Inc.
/* Copyright (C) 2011 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
@@ -18,15 +16,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <unistd.h>
#include <kernel-features.h>
.text
ENTRY(__fmal)
fldt 4(%esp) // x
fldt 16(%esp) // x : y
fmulp // x * y
fldt 28(%esp) // z : x * y
faddp // (x * y) + z
ret
END(__fmal)
weak_alias (__fmal, fmal)
#ifndef __ASSUME_PIPE2
int __have_pipe2;
#endif
+8 -8
View File
@@ -447,9 +447,9 @@ extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
__isoc99_fscanf) __wur;
extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
__isoc99_scanf) __wur;
extern int __REDIRECT (sscanf, (__const char *__restrict __s,
__const char *__restrict __format, ...),
__isoc99_sscanf) __THROW;
extern int __REDIRECT_NTH (sscanf, (__const char *__restrict __s,
__const char *__restrict __format, ...),
__isoc99_sscanf);
# else
extern int __isoc99_fscanf (FILE *__restrict __stream,
__const char *__restrict __format, ...) __wur;
@@ -501,11 +501,11 @@ extern int __REDIRECT (vfscanf,
extern int __REDIRECT (vscanf, (__const char *__restrict __format,
_G_va_list __arg), __isoc99_vscanf)
__attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
extern int __REDIRECT (vsscanf,
(__const char *__restrict __s,
__const char *__restrict __format, _G_va_list __arg),
__isoc99_vsscanf)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
extern int __REDIRECT_NTH (vsscanf,
(__const char *__restrict __s,
__const char *__restrict __format,
_G_va_list __arg), __isoc99_vsscanf)
__attribute__ ((__format__ (__scanf__, 2, 0)));
# else
extern int __isoc99_vfscanf (FILE *__restrict __s,
__const char *__restrict __format,
+2 -1
View File
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1997, 1999, 2000, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -31,6 +31,7 @@ __feupdateenv (const fenv_t *envp)
strong_alias (__feupdateenv, __old_feupdateenv)
compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
#endif
libm_hidden_ver (__feupdateenv, feupdateenv)
versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
stub_warning (feupdateenv)
+2 -1
View File
@@ -1,5 +1,5 @@
/* Test exception in current environment.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -25,5 +25,6 @@ fetestexcept (int excepts)
{
return 0;
}
libm_hidden_def (fetestexcept)
stub_warning (fetestexcept)
#include <stub-tag.h>
+74
View File
@@ -2787,9 +2787,79 @@ fma_test (void)
TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, plus_infty, 3.5L, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, -7.5L, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, -13.5L, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, 7.5L, plus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
LDBL_MAX, DBL_MAX, FLT_MAX);
TEST_fff_f (fma, -fltmax, -fltmax, minus_infty, minus_infty);
TEST_fff_f (fma, fltmax / 2, fltmax / 2, minus_infty, minus_infty);
TEST_fff_f (fma, -fltmax, fltmax, plus_infty, plus_infty);
TEST_fff_f (fma, fltmax / 2, -fltmax / 4, plus_infty, plus_infty);
TEST_fff_f (fma, plus_infty, 4, plus_infty, plus_infty);
TEST_fff_f (fma, 2, minus_infty, minus_infty, minus_infty);
TEST_fff_f (fma, minus_infty, minus_infty, plus_infty, plus_infty);
TEST_fff_f (fma, plus_infty, minus_infty, minus_infty, minus_infty);
#if defined (TEST_FLOAT) && FLT_MANT_DIG == 24
TEST_fff_f (fma, 0x1.7ff8p+13, 0x1.000002p+0, 0x1.ffffp-24, 0x1.7ff802p+13);
TEST_fff_f (fma, 0x1.fffp+0, 0x1.00001p+0, -0x1.fffp+0, 0x1.fffp-20);
TEST_fff_f (fma, 0x1.9abcdep+127, 0x0.9abcdep-126, -0x1.f08948p+0, 0x1.bb421p-25);
TEST_fff_f (fma, 0x1.9abcdep+100, 0x0.9abcdep-126, -0x1.f08948p-27, 0x1.bb421p-52);
TEST_fff_f (fma, 0x1.fffffep+127, 0x1.001p+0, -0x1.fffffep+127, 0x1.fffffep+115);
TEST_fff_f (fma, -0x1.fffffep+127, 0x1.fffffep+0, 0x1.fffffep+127, -0x1.fffffap+127);
TEST_fff_f (fma, 0x1.fffffep+127, 2.0, -0x1.fffffep+127, 0x1.fffffep+127);
#endif
#if defined (TEST_DOUBLE) && DBL_MANT_DIG == 53
TEST_fff_f (fma, 0x1.7fp+13, 0x1.0000000000001p+0, 0x1.ffep-48, 0x1.7f00000000001p+13);
TEST_fff_f (fma, 0x1.fffp+0, 0x1.0000000000001p+0, -0x1.fffp+0, 0x1.fffp-52);
TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, 0x1p-300, 1.0);
TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, -0x1p-300, 0x1.fffffffffffffp-1);
TEST_fff_f (fma, 0x1.deadbeef2feedp+1023, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp+1, 0x1.0989687bc9da4p-53);
TEST_fff_f (fma, 0x1.deadbeef2feedp+900, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp-122, 0x1.0989687bc9da4p-176);
TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 0x1.001p+0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1011);
TEST_fff_f (fma, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+0, 0x1.fffffffffffffp+1023, -0x1.ffffffffffffdp+1023);
TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 2.0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023);
TEST_fff_f (fma, 0x1.6a09e667f3bccp-538, 0x1.6a09e667f3bccp-538, 0.0, 0.0);
TEST_fff_f (fma, 0x1.deadbeef2feedp-495, 0x1.deadbeef2feedp-495, -0x1.bf86a5786a574p-989, 0x0.0000042625a1fp-1022);
TEST_fff_f (fma, 0x1.deadbeef2feedp-503, 0x1.deadbeef2feedp-503, -0x1.bf86a5786a574p-1005, 0x0.0000000004262p-1022);
TEST_fff_f (fma, 0x1p-537, 0x1p-538, 0x1p-1074, 0x0.0000000000002p-1022);
TEST_fff_f (fma, 0x1.7fffff8p-968, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000001p-1022);
TEST_fff_f (fma, 0x1.4000004p-967, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000003p-1022);
TEST_fff_f (fma, 0x1.4p-967, -0x1p-106, -0x0.000001p-1022, -0x0.0000010000002p-1022);
TEST_fff_f (fma, -0x1.19cab66d73e17p-959, 0x1.c7108a8c5ff51p-107, -0x0.80b0ad65d9b64p-1022, -0x0.80b0ad65d9d59p-1022);
TEST_fff_f (fma, -0x1.d2eaed6e8e9d3p-979, -0x1.4e066c62ac9ddp-63, -0x0.9245e6b003454p-1022, -0x0.9245c09c5fb5dp-1022);
TEST_fff_f (fma, 0x1.153d650bb9f06p-907, 0x1.2d01230d48407p-125, -0x0.b278d5acfc3cp-1022, -0x0.b22757123bbe9p-1022);
TEST_fff_f (fma, -0x1.fffffffffffffp-711, 0x1.fffffffffffffp-275, 0x1.fffffe00007ffp-983, 0x1.7ffffe00007ffp-983);
#endif
#if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 64
TEST_fff_f (fma, -0x8.03fcp+3696L, 0xf.fffffffffffffffp-6140L, 0x8.3ffffffffffffffp-2450L, -0x8.01ecp-2440L);
TEST_fff_f (fma, 0x9.fcp+2033L, -0x8.000e1f000ff800fp-3613L, -0xf.fffffffffffc0ffp-1579L, -0xd.fc119fb093ed092p-1577L);
TEST_fff_f (fma, 0xc.7fc000003ffffffp-1194L, 0x8.1e0003fffffffffp+15327L, -0x8.fffep+14072L, 0xc.ae9f164020effffp+14136L);
TEST_fff_f (fma, -0x8.0001fc000000003p+1798L, 0xcp-2230L, 0x8.f7e000000000007p-468L, -0xc.0002f9ffee10404p-429L);
TEST_fff_f (fma, 0xc.0000000000007ffp+10130L, -0x8.000000000000001p+4430L, 0xc.07000000001ffffp+14513L, -0xb.fffffffffffd7e4p+14563L);
TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L);
#endif
#if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 113
TEST_fff_f (fma, 0x1.bb2de33e02ccbbfa6e245a7c1f71p-2584L, -0x1.6b500daf0580d987f1bc0cadfcddp-13777L, 0x1.613cd91d9fed34b33820e5ab9d8dp-16378L, -0x1.3a79fb50eb9ce887cffa0f09bd9fp-16360L);
TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L);
TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L);
TEST_fff_f (fma, -0x1.ac79c9376ef447f3827c9e9de008p-2228L, -0x1.5ba830022b6139e21fbe7270cad8p-6314L, 0x1.e8282b6a26bb6a9daf5c8e73e9f9p-8616L, 0x1.22f14a0253878a730cd1aee373adp-8541L);
TEST_fff_f (fma, -0x1.c69749ec574caaa2ab8e97ddb9f3p+2652L, 0x1.f34235ff9d095449c29b4831b62dp+3311L, 0x1.fbe4302df23354dbd0c4d3cfe606p+5879L, -0x1.bb473bfdfb7a6e18886ce6e57eafp+5964L);
TEST_fff_f (fma, -0x1.ca8835fc6ecfb5398625fc891be5p-1686L, 0x1.621e1972bbe2180e5be9dd7d8df5p-7671L, -0x1.7d2d21b73b52cf20dec2a83902a4p-9395L, -0x1.3d2322191c9c88bc68a62ab8042cp-9356L);
TEST_fff_f (fma, -0x1.55cff679ec49c2541fab41fc843ep-11819L, 0x1.e60e9f464f9e8df0509647c7c971p+12325L, 0x1.eaa2a7649d765c2f564f7a5beca7p+454L, -0x1.447e29fa7e406a285f4e350fcf86p+507L);
TEST_fff_f (fma, 0x1.f0e7b1454908576f2537d863cf9bp+11432L, 0x1.cdce52f09d4ca76e68706f34b5d5p-1417L, -0x1.2e986187c70f146235ea2066e486p+9979L, 0x1.c030dad3cc5643f3dd0f5619f661p+10016L);
TEST_fff_f (fma, 0x1.f102f7da4a57a3a4aab620e29452p-3098L, -0x1.cc06a4ff40248f9e2dcc4b6afd84p-11727L, 0x1.d512a11126b5ac8ed8973b8580c8p-14849L, -0x1.be8f1cf737ab4d1c31c54f5ec23bp-14824L);
TEST_fff_f (fma, -0x1.fc47ac7434b993cd8dcb2b431f25p-3816L, 0x1.fbc9750da8468852d84558e1db6dp-5773L, -0x1.00a98abf783f75c40fe5b7a37d86p-9607L, -0x1.f81917b166f45e763cfcc057e2adp-9588L);
TEST_fff_f (fma, 0x1.00000000000007ffffffffffffffp-9045L, -0x1.ffffffffffff80000001ffffffffp+4773L, -0x1.f8p-4316L, -0x1.00000000000f88000000fffffdffp-4271L);
TEST_fff_f (fma, 0x1.4e922764c90701d4a2f21d01893dp-8683L, -0x1.955a12e2d7c9447c27fa022fc865p+212L, -0x1.e9634462eaef96528b90b6944578p-8521L, -0x1.08e1783184a371943d3598e10865p-8470L);
TEST_fff_f (fma, 0x1.801181509c03bdbef10d6165588cp-15131L, 0x1.ad86f8e57d3d40bfa8007780af63p-368L, -0x1.6e9df0dab1c9f1d7a6043c390741p-15507L, 0x1.417c9b2b15e2ad57dc9e0e920844p-15498L);
#endif
END (fma);
}
@@ -4537,6 +4607,10 @@ nearbyint_test (void)
TEST_f_f (nearbyint, minus_infty, minus_infty);
TEST_f_f (nearbyint, nan_value, nan_value);
/* Subnormal values */
TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
/* Default rounding mode is round to nearest. */
TEST_f_f (nearbyint, 0.5, 0.0);
TEST_f_f (nearbyint, 1.5, 2.0);
+1 -1
View File
@@ -139,7 +139,7 @@ get_uid (const char *user, uid_t *uidp)
if (r != ERANGE)
break;
extend_alloca (buf, buflen, 2 * buflen);
buf = extend_alloca (buf, buflen, 2 * buflen);
}
return 1;
+16
View File
@@ -1,3 +1,19 @@
2010-05-01 Alan Modra <amodra@gmail.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
(PSEUDO): Use correct cr save. Don't use wrong parm save area
to save temps. Correct cfi for possible later frame manipulation.
(DOCARGS_1, UNDOCARGS_1): Use the correct parm save area.
(DOCARGS_2, UNDOCARGS_2, DOCARGS_3, UNDOCARGS_3): Likewise.
(DOCARGS_4, UNDOCARGS_4, DOCARGS_5, UNDOCARGS_5): Likewise.
(DOCARGS_6, UNDOCARGS_6): Likewise.
(CENABLE, CDISABLE): Add nops for non-shared calls.
2010-06-01 Takashi Yoshii <takashi.yoshii.zj@renesas.com>
* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Fix incorrect
location of ifndef __ASSUME_FUTEX_CLOCK_REALTIME.
2010-04-09 Ulrich Drepper <drepper@redhat.com>
[BZ #11390]
+1 -1
View File
@@ -254,6 +254,6 @@ libpthread {
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
__pthread_unwind;
__pthread_unwind; __pthread_get_minstack;
}
}
+11 -1
View File
@@ -408,7 +408,7 @@ __pthread_initialize_minimal_internal (void)
/* Make sure it meets the minimum size that allocate_stack
(allocatestack.c) will demand, which depends on the page size. */
const uintptr_t pagesz = __sysconf (_SC_PAGESIZE);
const uintptr_t pagesz = GLRO(dl_pagesize);
const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK;
if (limit.rlim_cur < minstack)
limit.rlim_cur = minstack;
@@ -450,3 +450,13 @@ __pthread_initialize_minimal_internal (void)
}
strong_alias (__pthread_initialize_minimal_internal,
__pthread_initialize_minimal)
size_t
__pthread_get_minstack (const pthread_attr_t *attr)
{
struct pthread_attr *iattr = (struct pthread_attr *) attr;
return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN
+ iattr->guardsize);
}
+1
View File
@@ -397,6 +397,7 @@ weak_function;
extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
/* Namespace save aliases. */
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2004, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
@@ -47,7 +47,7 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
/* The helper thread needs only very little resources. */
(void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
(void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread. To do this thoroughly we
temporarily have to block all signals here. */
@@ -52,51 +52,70 @@
cfi_offset (lr, 16); \
DOCARGS_##args; /* save syscall args around CENABLE. */ \
CENABLE; \
std 3,72(1); /* store CENABLE return value (MASK). */ \
std 3,112(1); /* store CENABLE return value (MASK). */ \
UNDOCARGS_##args; /* restore syscall args. */ \
DO_CALL (SYS_ify (syscall_name)); \
mfcr 0; /* save CR/R3 around CDISABLE. */ \
std 3,64(1); \
std 0,8(1); \
ld 3,72(1); /* pass MASK to CDISABLE. */ \
std 3,120(1); \
std 0,128+8(1); \
cfi_offset (cr, 8); \
ld 3,112(1); /* pass MASK to CDISABLE. */ \
CDISABLE; \
ld 9,128+16(1); \
ld 0,8(1); /* restore CR/R3. */ \
ld 3,64(1); \
ld 0,128+8(1); /* restore CR/R3. */ \
ld 3,120(1); \
mtlr 9; \
mtcr 0; \
addi 1,1,128;
addi 1,1,128; \
cfi_adjust_cfa_offset (-128); \
cfi_restore (lr); \
cfi_restore (cr)
# define DOCARGS_0
# define UNDOCARGS_0
# define DOCARGS_1 std 3,80(1); DOCARGS_0
# define UNDOCARGS_1 ld 3,80(1); UNDOCARGS_0
# define DOCARGS_1 std 3,128+48(1); DOCARGS_0
# define UNDOCARGS_1 ld 3,128+48(1); UNDOCARGS_0
# define DOCARGS_2 std 4,88(1); DOCARGS_1
# define UNDOCARGS_2 ld 4,88(1); UNDOCARGS_1
# define DOCARGS_2 std 4,128+56(1); DOCARGS_1
# define UNDOCARGS_2 ld 4,128+56(1); UNDOCARGS_1
# define DOCARGS_3 std 5,96(1); DOCARGS_2
# define UNDOCARGS_3 ld 5,96(1); UNDOCARGS_2
# define DOCARGS_3 std 5,128+64(1); DOCARGS_2
# define UNDOCARGS_3 ld 5,128+64(1); UNDOCARGS_2
# define DOCARGS_4 std 6,104(1); DOCARGS_3
# define UNDOCARGS_4 ld 6,104(1); UNDOCARGS_3
# define DOCARGS_4 std 6,128+72(1); DOCARGS_3
# define UNDOCARGS_4 ld 6,128+72(1); UNDOCARGS_3
# define DOCARGS_5 std 7,112(1); DOCARGS_4
# define UNDOCARGS_5 ld 7,112(1); UNDOCARGS_4
# define DOCARGS_5 std 7,128+80(1); DOCARGS_4
# define UNDOCARGS_5 ld 7,128+80(1); UNDOCARGS_4
# define DOCARGS_6 std 8,120(1); DOCARGS_5
# define UNDOCARGS_6 ld 8,120(1); UNDOCARGS_5
# define DOCARGS_6 std 8,128+88(1); DOCARGS_5
# define UNDOCARGS_6 ld 8,128+88(1); UNDOCARGS_5
# ifdef IS_IN_libpthread
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
# ifdef SHARED
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
# else
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel); nop
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel); nop
# endif
# elif !defined NOT_IN_libc
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__libc_disable_asynccancel)
# ifdef SHARED
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__libc_disable_asynccancel)
# else
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel); nop
# define CDISABLE bl JUMPTARGET(__libc_disable_asynccancel); nop
# endif
# elif defined IS_IN_librt
# define CENABLE bl JUMPTARGET(__librt_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel)
# ifdef SHARED
# define CENABLE bl JUMPTARGET(__librt_enable_asynccancel)
# define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel)
# else
# define CENABLE bl JUMPTARGET(__librt_enable_asynccancel); nop
# define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel); nop
# endif
# else
# error Unsupported library
# endif
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -282,6 +282,7 @@ __lll_timedlock_wait:
rts
mov.l @r15+, r12
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
.align 2
# ifdef PIC
.Lgot:
@@ -293,7 +294,6 @@ __lll_timedlock_wait:
.long __have_futex_clock_realtime
# endif
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
.Lreltmo:
/* Check for a valid timeout value. */
mov.l @(4,r6), r1
@@ -165,7 +165,7 @@ __start_helper_thread (void)
and should go away automatically when canceled. */
pthread_attr_t attr;
(void) pthread_attr_init (&attr);
(void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
(void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread but SIGSETXID. To do this
thoroughly we temporarily have to block all signals here. The
+4 -4
View File
@@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009
Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -158,9 +158,9 @@ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
additional functionality can be disable at runtime. This redirection
helps to also do this at runtime. */
# ifdef __REDIRECT
extern int __REDIRECT (getopt, (int ___argc, char *const *___argv,
const char *__shortopts),
__posix_getopt) __THROW;
extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv,
const char *__shortopts),
__posix_getopt);
# else
extern int __posix_getopt (int ___argc, char *const *___argv,
const char *__shortopts) __THROW;
+10 -4
View File
@@ -30,8 +30,8 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
# define decimal NULL
# define thousands NULL
#else
char decimal[MB_LEN_MAX];
char thousands[MB_LEN_MAX];
char decimal[MB_LEN_MAX + 1];
char thousands[MB_LEN_MAX + 1];
#endif
/* "to_outpunct" is a map from ASCII decimal point and thousands-sep
@@ -47,13 +47,19 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
mbstate_t state;
memset (&state, '\0', sizeof (state));
if (__wcrtomb (decimal, wdecimal, &state) == (size_t) -1)
size_t n = __wcrtomb (decimal, wdecimal, &state);
if (n == (size_t) -1)
memcpy (decimal, ".", 2);
else
decimal[n] = '\0';
memset (&state, '\0', sizeof (state));
if (__wcrtomb (thousands, wthousands, &state) == (size_t) -1)
n = __wcrtomb (thousands, wthousands, &state);
if (n == (size_t) -1)
memcpy (thousands, ",", 2);
else
thousands[n] = '\0';
}
#endif
+3 -3
View File
@@ -295,9 +295,9 @@ __parse_one_specmb (const UCHAR_T *format, size_t posn,
/* We don't try to get the types for all arguments if the format
uses more than one. The normal case is covered though. If
the call returns -1 we continue with the normal specifiers. */
|| (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
(&spec->info, 1, &spec->data_arg_type,
&spec->size)) < 0)
|| (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
(&spec->info, 1, &spec->data_arg_type,
&spec->size)) < 0)
{
/* Find the data argument types of a built-in spec. */
spec->ndata_args = 1;
+3 -1
View File
@@ -54,7 +54,8 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
bug-strtok1 $(addprefix test-,$(strop-tests)) \
bug-envz1 tst-strxfrm2 tst-endian tst-svc2
bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
bug-strstr1
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \
str-two-way.h
@@ -73,6 +74,7 @@ CFLAGS-tst-strlen.c = -fno-builtin
CFLAGS-stratcliff.c = -fno-builtin
CFLAGS-test-ffs.c = -fno-builtin
CFLAGS-tst-inlcall.c = -fno-builtin
CFLAGS-bug-strstr1.c = -fno-builtin
ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-svc.out
+26
View File
@@ -0,0 +1,26 @@
#include <stdio.h>
#include <string.h>
int main (int argc, char** argv)
{
const char haystack[] =
"F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
const char needle[] =
"_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
const char* sub = strstr (haystack, needle);
if (sub != NULL)
{
int j;
fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
for (j = 0; needle[j] != '\0'; ++j)
putchar (needle[j] == sub[j] ? ' ' : '^');
puts ("");
return 1;
}
return 0;
}
+1 -1
View File
@@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
a byte out of place, there can be no match until
after the mismatch. */
shift = needle_len - period;
memory = 0;
}
memory = 0;
j += shift;
continue;
}
+107 -37
View File
@@ -1,5 +1,6 @@
/* Test for string function add boundaries of usable memory.
Copyright (C) 1996,1997,1999-2003,2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1996,1997,1999-2003,2007,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -47,6 +48,8 @@
# define MEMCPY memcpy
# define MEMPCPY mempcpy
# define MEMCHR memchr
# define STRCMP strcmp
# define STRNCMP strncmp
#endif
@@ -70,12 +73,12 @@ do_test (void)
if (adr == MAP_FAILED || dest == MAP_FAILED)
{
if (errno == ENOSYS)
puts ("No test, mmap not available.");
puts ("No test, mmap not available.");
else
{
printf ("mmap failed: %m");
result = 1;
}
{
printf ("mmap failed: %m");
result = 1;
}
}
else
{
@@ -93,8 +96,8 @@ do_test (void)
/* strlen/wcslen test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
adr[inner] = L('\0');
@@ -107,12 +110,12 @@ do_test (void)
adr[inner] = L('T');
}
}
}
/* strnlen/wcsnlen test */
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
adr[inner] = L('\0');
@@ -126,9 +129,9 @@ do_test (void)
adr[inner] = L('T');
}
}
}
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
{
{
for (inner = MAX (outer, nchars - 64); inner <= nchars; ++inner)
{
if (STRNLEN (&adr[outer], inner - outer)
@@ -139,11 +142,11 @@ do_test (void)
result = 1;
}
}
}
}
/* strchr/wcschr test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
for (inner = middle; inner < nchars; ++inner)
@@ -167,7 +170,7 @@ do_test (void)
adr[middle] = L('T');
}
}
}
}
/* Special test. */
adr[nchars - 1] = L('\0');
@@ -180,7 +183,7 @@ do_test (void)
/* strrchr/wcsrchr test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
for (inner = middle; inner < nchars; ++inner)
@@ -204,11 +207,11 @@ do_test (void)
adr[middle] = L('T');
}
}
}
}
/* memchr test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
adr[middle] = L('V');
@@ -224,9 +227,9 @@ do_test (void)
adr[middle] = L('T');
}
}
}
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
{
{
CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer);
if (cp != NULL)
@@ -235,13 +238,13 @@ do_test (void)
STRINGIFY (MEMCHR), outer);
result = 1;
}
}
}
/* This function only exists for single-byte characters. */
#ifndef WCSTEST
/* rawmemchr test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
adr[middle] = L('V');
@@ -257,13 +260,13 @@ do_test (void)
adr[middle] = L('T');
}
}
}
#endif
/* strcpy/wcscpy test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
adr[inner] = L('\0');
@@ -277,7 +280,74 @@ do_test (void)
adr[inner] = L('T');
}
}
}
/* strcmp/wcscmp tests */
for (outer = 1; outer < 32; ++outer)
for (middle = 0; middle < 16; ++middle)
{
MEMSET (adr + middle, L('T'), 256);
adr[256] = L('\0');
MEMSET (dest + nchars - outer, L('T'), outer - 1);
dest[nchars - 1] = L('\0');
if (STRCMP (adr + middle, dest + nchars - outer) <= 0)
{
printf ("%s 1 flunked for outer = %d, middle = %d\n",
STRINGIFY (STRCMP), outer, middle);
result = 1;
}
if (STRCMP (dest + nchars - outer, adr + middle) >= 0)
{
printf ("%s 2 flunked for outer = %d, middle = %d\n",
STRINGIFY (STRCMP), outer, middle);
result = 1;
}
}
/* strncmp/wcsncmp tests */
for (outer = 1; outer < 32; ++outer)
for (middle = 0; middle < 16; ++middle)
{
MEMSET (adr + middle, L('T'), 256);
adr[256] = L('\0');
MEMSET (dest + nchars - outer, L('T'), outer - 1);
dest[nchars - 1] = L('U');
for (inner = 0; inner < outer; ++inner)
{
if (STRNCMP (adr + middle, dest + nchars - outer, inner) != 0)
{
printf ("%s 1 flunked for outer = %d, middle = %d, "
"inner = %d\n",
STRINGIFY (STRNCMP), outer, middle, inner);
result = 1;
}
if (STRNCMP (dest + nchars - outer, adr + middle, inner) != 0)
{
printf ("%s 2 flunked for outer = %d, middle = %d, "
"inner = %d\n",
STRINGIFY (STRNCMP), outer, middle, inner);
result = 1;
}
}
if (STRNCMP (adr + middle, dest + nchars - outer, outer) >= 0)
{
printf ("%s 1 flunked for outer = %d, middle = %d, full\n",
STRINGIFY (STRNCMP), outer, middle);
result = 1;
}
if (STRNCMP (dest + nchars - outer, adr + middle, outer) <= 0)
{
printf ("%s 2 flunked for outer = %d, middle = %d, full\n",
STRINGIFY (STRNCMP), outer, middle);
result = 1;
}
}
/* strncpy/wcsncpy tests */
adr[nchars - 1] = L('T');
@@ -295,12 +365,12 @@ do_test (void)
result = 1;
}
}
}
}
adr[nchars - 1] = L('\0');
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
size_t len;
@@ -334,12 +404,12 @@ do_test (void)
adr[inner] = L('T');
}
}
}
/* stpcpy/wcpcpy test */
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
{
adr[inner] = L('\0');
@@ -352,7 +422,7 @@ do_test (void)
adr[inner] = L('T');
}
}
}
/* stpncpy/wcpncpy test */
adr[nchars - 1] = L('T');
@@ -374,8 +444,8 @@ do_test (void)
adr[nchars - 1] = L('\0');
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
{
adr[middle] = L('\0');
@@ -393,7 +463,7 @@ do_test (void)
adr[middle] = L('T');
}
}
}
/* memcpy/wmemcpy test */
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
+1
View File
@@ -399,6 +399,7 @@ clnttcp_control (CLIENT *cl, int request, char *info)
/* This will set the xid of the NEXT call */
*(u_long *)ct->ct_mcall = htonl (*(u_long *)info - 1);
/* decrement by 1 as clnttcp_call() increments once */
break;
case CLGET_VERS:
/*
* This RELIES on the information that, in the call body,
+1
View File
@@ -582,6 +582,7 @@ clntudp_control (CLIENT *cl, int request, char *info)
/* This will set the xid of the NEXT call */
*(u_long *)cu->cu_outbuf = htonl(*(u_long *)info - 1);
/* decrement by 1 as clntudp_call() increments once */
break;
case CLGET_VERS:
/*
* This RELIES on the information that, in the call body,
+1
View File
@@ -376,6 +376,7 @@ clntunix_control (CLIENT *cl, int request, char *info)
/* This will set the xid of the NEXT call */
*(u_long *) ct->ct_mcall = htonl (*(u_long *)info - 1);
/* decrement by 1 as clntunix_call() increments once */
break;
case CLGET_VERS:
/*
* This RELIES on the information that, in the call body,
+12 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1999 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* This file contains a bit of information about the stack allocation
of the processor. Since there is no general truth we can't say
anything here. */
/* This file contains generic information about the stack allocation. */
#ifndef _STACKINFO_H
#define _STACKINFO_H 1
#include <elf.h>
/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is
* present, but it is presumed absent. */
#define _STACK_FLAGS (PF_R|PF_W|PF_X)
#endif /* stackinfo.h */
+2 -4
View File
@@ -1,6 +1,6 @@
/* Inline math functions for i387.
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007,2009
Free Software Foundation, Inc.
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007,2009,
2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -657,8 +657,6 @@ __NTH (ldexpl (long double __x, int __y))
__ldexp_code;
}
__inline_mathcodeNP3 (fma, __x, __y, __z, return (__x * __y) + __z)
__inline_mathopNP (rint, "frndint")
# endif /* __FAST_MATH__ */
+2 -1
View File
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc.
Copyright (C) 1997,99,2000,01,07,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -57,4 +57,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
#endif
libm_hidden_ver (__feupdateenv, feupdateenv)
versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
+2 -1
View File
@@ -1,5 +1,5 @@
/* Test exception in current environment.
Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 1997, 2003, 2004, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -38,3 +38,4 @@ fetestexcept (int excepts)
return (temp | xtemp) & excepts & FE_ALL_EXCEPT;
}
libm_hidden_def (fetestexcept)
+1 -1
View File
@@ -33,4 +33,4 @@ weak_alias (__fma, fma)
# define __fma __fma_ia32
#endif
#include <math/s_fma.c>
#include <sysdeps/ieee754/ldbl-96/s_fma.c>
+1 -1
View File
@@ -33,4 +33,4 @@ weak_alias (__fmaf, fmaf)
# define __fmaf __fmaf_ia32
#endif
#include <math/s_fmaf.c>
#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
+2 -2
View File
@@ -1,5 +1,5 @@
/* Multiple versions of strspn
Copyright (C) 2009 Free Software Foundation, Inc.
Copyright (C) 2009,2010 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -65,7 +65,7 @@ ENTRY(strspn)
jne 1f
call __init_cpu_features
1: leal __strspn_ia32, %eax
testl $index_SSE2, CPUID_OFFSET+index_SSE4_2+__cpu_features
testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
jz 2f
leal __strspn_sse42, %eax
2: ret
+4 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2009 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,9 @@
of the processor. */
#ifndef _STACKINFO_H
#define _STACKINFO_H 1
/* Pick up the default definition for _STACK_FLAGS and define _STACKINFO_H. */
#include <sysdeps/generic/stackinfo.h>
/* On x86 the stack grows down. */
#define _STACK_GROWS_DOWN 1
+2 -1
View File
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc.
Copyright (C) 1997, 2000, 2007, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
@@ -38,3 +38,4 @@ feupdateenv (const fenv_t *envp)
/* Success. */
return 0;
}
libm_hidden_def (feupdateenv)
+2 -1
View File
@@ -1,5 +1,5 @@
/* Test exception in current environment.
Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1997, 1999, 2000, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
@@ -30,3 +30,4 @@ fetestexcept (int excepts)
return (fpsr >> 13) & excepts & FE_ALL_EXCEPT;
}
libm_hidden_def (fetestexcept)
+4 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,9 @@
of the processor. */
#ifndef _STACKINFO_H
#define _STACKINFO_H 1
/* Pick up the default definition for _STACK_FLAGS and define _STACKINFO_H. */
#include <sysdeps/generic/stackinfo.h>
/* On IA-64 the stack grows down. The register stack is of no concern
here. */
+8 -10
View File
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
* Copyright (C) 2001, 2005 Free Software Foundation
* Copyright (C) 2001, 2005, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -40,13 +40,11 @@
#include "dla.h"
#include "math_private.h"
double __ieee754_sqrt(double x);
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 };
7, 6, 5, 5, 5, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3 };
double __halfulp(double x, double y)
@@ -64,12 +62,12 @@ double __halfulp(double x, double y)
z = (double) k;
return (z*y == -1075.0)?0: -10.0;
}
/* if y > 0 */
/* if y > 0 */
v.x = y;
if (v.i[LOW_HALF] != 0) return -10.0;
v.x=x;
/* case where x = 2**n for some integer n */
/* 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;
@@ -90,7 +88,7 @@ double __halfulp(double x, double y)
k = -k;
if (k>5) return -10.0;
/* now treat x */
/* now treat x */
while (k>0) {
z = __ieee754_sqrt(x);
EMULV(z,z,u,uu,j1,j2,j3,j4,j5);
@@ -111,11 +109,11 @@ double __halfulp(double x, double y)
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;
/* 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;
+227
View File
@@ -0,0 +1,227 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <float.h>
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation uses rounding to odd to avoid problems with
double rounding. See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
double
__fma (double x, double y, double z)
{
union ieee754_double u, v, w;
int adjust = 0;
u.d = x;
v.d = y;
w.d = z;
if (__builtin_expect (u.ieee.exponent + v.ieee.exponent
>= 0x7ff + IEEE754_DOUBLE_BIAS - DBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent >= 0x7ff - DBL_MANT_DIG, 0)
|| __builtin_expect (v.ieee.exponent >= 0x7ff - DBL_MANT_DIG, 0)
|| __builtin_expect (w.ieee.exponent >= 0x7ff - DBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent + v.ieee.exponent
<= IEEE754_DOUBLE_BIAS + DBL_MANT_DIG, 0))
{
/* If z is Inf, but x and y are finite, the result should be
z rather than NaN. */
if (w.ieee.exponent == 0x7ff
&& u.ieee.exponent != 0x7ff
&& v.ieee.exponent != 0x7ff)
return (z + x) + y;
/* If x or y or z is Inf/NaN, or if fma will certainly overflow,
or if x * y is less than half of DBL_DENORM_MIN,
compute as x * y + z. */
if (u.ieee.exponent == 0x7ff
|| v.ieee.exponent == 0x7ff
|| w.ieee.exponent == 0x7ff
|| u.ieee.exponent + v.ieee.exponent
> 0x7ff + IEEE754_DOUBLE_BIAS
|| u.ieee.exponent + v.ieee.exponent
< IEEE754_DOUBLE_BIAS - DBL_MANT_DIG - 2)
return x * y + z;
if (u.ieee.exponent + v.ieee.exponent
>= 0x7ff + IEEE754_DOUBLE_BIAS - DBL_MANT_DIG)
{
/* Compute 1p-53 times smaller result and multiply
at the end. */
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent -= DBL_MANT_DIG;
else
v.ieee.exponent -= DBL_MANT_DIG;
/* If x + y exponent is very large and z exponent is very small,
it doesn't matter if we don't adjust it. */
if (w.ieee.exponent > DBL_MANT_DIG)
w.ieee.exponent -= DBL_MANT_DIG;
adjust = 1;
}
else if (w.ieee.exponent >= 0x7ff - DBL_MANT_DIG)
{
/* Similarly.
If z exponent is very large and x and y exponents are
very small, it doesn't matter if we don't adjust it. */
if (u.ieee.exponent > v.ieee.exponent)
{
if (u.ieee.exponent > DBL_MANT_DIG)
u.ieee.exponent -= DBL_MANT_DIG;
}
else if (v.ieee.exponent > DBL_MANT_DIG)
v.ieee.exponent -= DBL_MANT_DIG;
w.ieee.exponent -= DBL_MANT_DIG;
adjust = 1;
}
else if (u.ieee.exponent >= 0x7ff - DBL_MANT_DIG)
{
u.ieee.exponent -= DBL_MANT_DIG;
if (v.ieee.exponent)
v.ieee.exponent += DBL_MANT_DIG;
else
v.d *= 0x1p53;
}
else if (v.ieee.exponent >= 0x7ff - DBL_MANT_DIG)
{
v.ieee.exponent -= DBL_MANT_DIG;
if (u.ieee.exponent)
u.ieee.exponent += DBL_MANT_DIG;
else
u.d *= 0x1p53;
}
else /* if (u.ieee.exponent + v.ieee.exponent
<= IEEE754_DOUBLE_BIAS + DBL_MANT_DIG) */
{
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent += 2 * DBL_MANT_DIG;
else
v.ieee.exponent += 2 * DBL_MANT_DIG;
if (w.ieee.exponent <= 4 * DBL_MANT_DIG + 4)
{
if (w.ieee.exponent)
w.ieee.exponent += 2 * DBL_MANT_DIG;
else
w.d *= 0x1p106;
adjust = -1;
}
/* Otherwise x * y should just affect inexact
and nothing else. */
}
x = u.d;
y = v.d;
z = w.d;
}
/* Multiplication m1 + m2 = x * y using Dekker's algorithm. */
#define C ((1 << (DBL_MANT_DIG + 1) / 2) + 1)
double x1 = x * C;
double y1 = y * C;
double m1 = x * y;
x1 = (x - x1) + x1;
y1 = (y - y1) + y1;
double x2 = x - x1;
double y2 = y - y1;
double m2 = (((x1 * y1 - m1) + x1 * y2) + x2 * y1) + x2 * y2;
/* Addition a1 + a2 = z + m1 using Knuth's algorithm. */
double a1 = z + m1;
double t1 = a1 - z;
double t2 = a1 - t1;
t1 = m1 - t1;
t2 = z - t2;
double a2 = t1 + t2;
fenv_t env;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
if (__builtin_expect (adjust == 0, 1))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d. */
return a1 + u.d;
}
else if (__builtin_expect (adjust > 0, 1))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d, scaled up. */
return (a1 + u.d) * 0x1p53;
}
else
{
if ((u.ieee.mantissa1 & 1) == 0)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
v.d = a1 + u.d;
int j = fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Ensure the following computations are performed in default rounding
mode instead of just reusing the round to zero computation. */
asm volatile ("" : "=m" (u) : "m" (u));
/* If a1 + u.d is exact, the only rounding happens during
scaling down. */
if (j == 0)
return v.d * 0x1p-106;
/* If result rounded to zero is not subnormal, no double
rounding will occur. */
if (v.ieee.exponent > 106)
return (a1 + u.d) * 0x1p-106;
/* If v.d * 0x1p-106 with round to zero is a subnormal above
or equal to DBL_MIN / 2, then v.d * 0x1p-106 shifts mantissa
down just by 1 bit, which means v.ieee.mantissa1 |= j would
change the round bit, not sticky or guard bit.
v.d * 0x1p-106 never normalizes by shifting up,
so round bit plus sticky bit should be already enough
for proper rounding. */
if (v.ieee.exponent == 106)
{
/* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding,
v.ieee.mantissa1 & 1 is the round bit and j is our sticky
bit. In round-to-nearest 001 rounds down like 00,
011 rounds up, even though 01 rounds down (thus we need
to adjust), 101 rounds down like 10 and 111 rounds up
like 11. */
if ((v.ieee.mantissa1 & 3) == 1)
{
v.d *= 0x1p-106;
if (v.ieee.negative)
return v.d - 0x1p-1074 /* __DBL_DENORM_MIN__ */;
else
return v.d + 0x1p-1074 /* __DBL_DENORM_MIN__ */;
}
else
return v.d * 0x1p-106;
}
v.ieee.mantissa1 |= j;
return v.d * 0x1p-106;
}
}
#ifndef __fma
weak_alias (__fma, fma)
#endif
#ifdef NO_LONG_DOUBLE
strong_alias (__fma, __fmal)
weak_alias (__fmal, fmal)
#endif
+50
View File
@@ -0,0 +1,50 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation relies on double being more than twice as
precise as float and uses rounding to odd in order to avoid problems
with double rounding.
See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
float
__fmaf (float x, float y, float z)
{
fenv_t env;
/* Multiplication is always exact. */
double temp = (double) x * (double) y;
union ieee754_double u;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform addition with round to odd. */
u.d = temp + (double) z;
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* And finally truncation with round to nearest. */
return (float) u.d;
}
#ifndef __fmaf
weak_alias (__fmaf, fmaf)
#endif
+50
View File
@@ -0,0 +1,50 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation relies on long double being more than twice as
precise as double and uses rounding to odd in order to avoid problems
with double rounding.
See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
double
__fma (double x, double y, double z)
{
fenv_t env;
/* Multiplication is always exact. */
long double temp = (long double) x * (long double) y;
union ieee854_long_double u;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform addition with round to odd. */
u.d = temp + (long double) z;
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* And finally truncation with round to nearest. */
return (double) u.d;
}
#ifndef __fma
weak_alias (__fma, fma)
#endif
+223
View File
@@ -0,0 +1,223 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <float.h>
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation uses rounding to odd to avoid problems with
double rounding. See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
long double
__fmal (long double x, long double y, long double z)
{
union ieee854_long_double u, v, w;
int adjust = 0;
u.d = x;
v.d = y;
w.d = z;
if (__builtin_expect (u.ieee.exponent + v.ieee.exponent
>= 0x7fff + IEEE854_LONG_DOUBLE_BIAS
- LDBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (v.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (w.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent + v.ieee.exponent
<= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG, 0))
{
/* If z is Inf, but x and y are finite, the result should be
z rather than NaN. */
if (w.ieee.exponent == 0x7fff
&& u.ieee.exponent != 0x7fff
&& v.ieee.exponent != 0x7fff)
return (z + x) + y;
/* If x or y or z is Inf/NaN, or if fma will certainly overflow,
or if x * y is less than half of LDBL_DENORM_MIN,
compute as x * y + z. */
if (u.ieee.exponent == 0x7fff
|| v.ieee.exponent == 0x7fff
|| w.ieee.exponent == 0x7fff
|| u.ieee.exponent + v.ieee.exponent
> 0x7fff + IEEE854_LONG_DOUBLE_BIAS
|| u.ieee.exponent + v.ieee.exponent
< IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2)
return x * y + z;
if (u.ieee.exponent + v.ieee.exponent
>= 0x7fff + IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG)
{
/* Compute 1p-113 times smaller result and multiply
at the end. */
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent -= LDBL_MANT_DIG;
else
v.ieee.exponent -= LDBL_MANT_DIG;
/* If x + y exponent is very large and z exponent is very small,
it doesn't matter if we don't adjust it. */
if (w.ieee.exponent > LDBL_MANT_DIG)
w.ieee.exponent -= LDBL_MANT_DIG;
adjust = 1;
}
else if (w.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
/* Similarly.
If z exponent is very large and x and y exponents are
very small, it doesn't matter if we don't adjust it. */
if (u.ieee.exponent > v.ieee.exponent)
{
if (u.ieee.exponent > LDBL_MANT_DIG)
u.ieee.exponent -= LDBL_MANT_DIG;
}
else if (v.ieee.exponent > LDBL_MANT_DIG)
v.ieee.exponent -= LDBL_MANT_DIG;
w.ieee.exponent -= LDBL_MANT_DIG;
adjust = 1;
}
else if (u.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
u.ieee.exponent -= LDBL_MANT_DIG;
if (v.ieee.exponent)
v.ieee.exponent += LDBL_MANT_DIG;
else
v.d *= 0x1p113L;
}
else if (v.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
v.ieee.exponent -= LDBL_MANT_DIG;
if (u.ieee.exponent)
u.ieee.exponent += LDBL_MANT_DIG;
else
u.d *= 0x1p113L;
}
else /* if (u.ieee.exponent + v.ieee.exponent
<= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) */
{
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent += 2 * LDBL_MANT_DIG;
else
v.ieee.exponent += 2 * LDBL_MANT_DIG;
if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 4)
{
if (w.ieee.exponent)
w.ieee.exponent += 2 * LDBL_MANT_DIG;
else
w.d *= 0x1p226L;
adjust = -1;
}
/* Otherwise x * y should just affect inexact
and nothing else. */
}
x = u.d;
y = v.d;
z = w.d;
}
/* Multiplication m1 + m2 = x * y using Dekker's algorithm. */
#define C ((1LL << (LDBL_MANT_DIG + 1) / 2) + 1)
long double x1 = x * C;
long double y1 = y * C;
long double m1 = x * y;
x1 = (x - x1) + x1;
y1 = (y - y1) + y1;
long double x2 = x - x1;
long double y2 = y - y1;
long double m2 = (((x1 * y1 - m1) + x1 * y2) + x2 * y1) + x2 * y2;
/* Addition a1 + a2 = z + m1 using Knuth's algorithm. */
long double a1 = z + m1;
long double t1 = a1 - z;
long double t2 = a1 - t1;
t1 = m1 - t1;
t2 = z - t2;
long double a2 = t1 + t2;
fenv_t env;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
if (__builtin_expect (adjust == 0, 1))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d. */
return a1 + u.d;
}
else if (__builtin_expect (adjust > 0, 1))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d, scaled up. */
return (a1 + u.d) * 0x1p113L;
}
else
{
if ((u.ieee.mantissa3 & 1) == 0)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
v.d = a1 + u.d;
/* Ensure the addition is not scheduled after fetestexcept call. */
asm volatile ("" : "m" (v));
int j = fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Ensure the following computations are performed in default rounding
mode instead of just reusing the round to zero computation. */
asm volatile ("" : "=m" (u) : "m" (u));
/* If a1 + u.d is exact, the only rounding happens during
scaling down. */
if (j == 0)
return v.d * 0x1p-226L;
/* If result rounded to zero is not subnormal, no double
rounding will occur. */
if (v.ieee.exponent > 226)
return (a1 + u.d) * 0x1p-226L;
/* If v.d * 0x1p-226L with round to zero is a subnormal above
or equal to LDBL_MIN / 2, then v.d * 0x1p-226L shifts mantissa
down just by 1 bit, which means v.ieee.mantissa3 |= j would
change the round bit, not sticky or guard bit.
v.d * 0x1p-226L never normalizes by shifting up,
so round bit plus sticky bit should be already enough
for proper rounding. */
if (v.ieee.exponent == 226)
{
/* v.ieee.mantissa3 & 2 is LSB bit of the result before rounding,
v.ieee.mantissa3 & 1 is the round bit and j is our sticky
bit. In round-to-nearest 001 rounds down like 00,
011 rounds up, even though 01 rounds down (thus we need
to adjust), 101 rounds down like 10 and 111 rounds up
like 11. */
if ((v.ieee.mantissa3 & 3) == 1)
{
v.d *= 0x1p-226L;
if (v.ieee.negative)
return v.d - 0x1p-16494L /* __LDBL_DENORM_MIN__ */;
else
return v.d + 0x1p-16494L /* __LDBL_DENORM_MIN__ */;
}
else
return v.d * 0x1p-226L;
}
v.ieee.mantissa3 |= j;
return v.d * 0x1p-226L;
}
}
weak_alias (__fmal, fmal)
+2 -2
View File
@@ -73,9 +73,9 @@ long double __ieee754_sqrtl(long double x)
m = ((a.i[2] >> 20) & 0x7ff) - 54;
}
m += n;
if (m > 0)
if ((int) m > 0)
a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
else if (m <= -54) {
else if ((int) m <= -54) {
a.i[2] &= 0x80000000;
a.i[3] = 0;
} else {
+1 -1
View File
@@ -58,7 +58,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <math.h>
#include "math_private.h"
#include <math_ldbl_opt.h>
+39
View File
@@ -0,0 +1,39 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Flaherty <flaherty@linux.vnet.ibm.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <math.h>
#include <math_ldbl_opt.h>
long double
__fmal (long double x, long double y, long double z)
{
/* An IBM long double 128 is really just 2 IEEE64 doubles, and in
* the case of inf/nan only the first double counts. So we use the
* (double) cast to avoid any data movement. */
if ((finite ((double)x) && finite ((double)y)) && isinf ((double)z))
return (z);
return (x * y) + z;
}
#ifdef IS_IN_libm
long_double_symbol (libm, __fmal, fmal);
#else
long_double_symbol (libc, __fmal, fmal);
#endif
+5
View File
@@ -0,0 +1,5 @@
#include <math_ldbl_opt.h>
#undef weak_alias
#define weak_alias(n,a)
#include <sysdeps/ieee754/ldbl-128/s_fmal.c>
long_double_symbol (libm, __fmal, fmal);
+79
View File
@@ -0,0 +1,79 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <float.h>
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation uses rounding to odd to avoid problems with
double rounding. See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
double
__fma (double x, double y, double z)
{
if (__builtin_expect (isinf (z), 0))
{
/* If z is Inf, but x and y are finite, the result should be
z rather than NaN. */
if (finite (x) && finite (y))
return (z + x) + y;
return (x * y) + z;
}
/* Multiplication m1 + m2 = x * y using Dekker's algorithm. */
#define C ((1ULL << (LDBL_MANT_DIG + 1) / 2) + 1)
long double x1 = (long double) x * C;
long double y1 = (long double) y * C;
long double m1 = (long double) x * y;
x1 = (x - x1) + x1;
y1 = (y - y1) + y1;
long double x2 = x - x1;
long double y2 = y - y1;
long double m2 = (((x1 * y1 - m1) + x1 * y2) + x2 * y1) + x2 * y2;
/* Addition a1 + a2 = z + m1 using Knuth's algorithm. */
long double a1 = z + m1;
long double t1 = a1 - z;
long double t2 = a1 - t1;
t1 = m1 - t1;
t2 = z - t2;
long double a2 = t1 + t2;
fenv_t env;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform m2 + a2 addition with round to odd. */
a2 = a2 + m2;
/* Add that to a1 again using rounding to odd. */
union ieee854_long_double u;
u.d = a1 + a2;
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Add finally round to double precision. */
return u.d;
}
#ifndef __fma
weak_alias (__fma, fma)
#endif
+221
View File
@@ -0,0 +1,221 @@
/* Compute x * y + z as ternary operation.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <float.h>
#include <math.h>
#include <fenv.h>
#include <ieee754.h>
/* This implementation uses rounding to odd to avoid problems with
double rounding. See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
long double
__fmal (long double x, long double y, long double z)
{
union ieee854_long_double u, v, w;
int adjust = 0;
u.d = x;
v.d = y;
w.d = z;
if (__builtin_expect (u.ieee.exponent + v.ieee.exponent
>= 0x7fff + IEEE854_LONG_DOUBLE_BIAS
- LDBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (v.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (w.ieee.exponent >= 0x7fff - LDBL_MANT_DIG, 0)
|| __builtin_expect (u.ieee.exponent + v.ieee.exponent
<= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG, 0))
{
/* If z is Inf, but x and y are finite, the result should be
z rather than NaN. */
if (w.ieee.exponent == 0x7fff
&& u.ieee.exponent != 0x7fff
&& v.ieee.exponent != 0x7fff)
return (z + x) + y;
/* If x or y or z is Inf/NaN, or if fma will certainly overflow,
or if x * y is less than half of LDBL_DENORM_MIN,
compute as x * y + z. */
if (u.ieee.exponent == 0x7fff
|| v.ieee.exponent == 0x7fff
|| w.ieee.exponent == 0x7fff
|| u.ieee.exponent + v.ieee.exponent
> 0x7fff + IEEE854_LONG_DOUBLE_BIAS
|| u.ieee.exponent + v.ieee.exponent
< IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2)
return x * y + z;
if (u.ieee.exponent + v.ieee.exponent
>= 0x7fff + IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG)
{
/* Compute 1p-64 times smaller result and multiply
at the end. */
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent -= LDBL_MANT_DIG;
else
v.ieee.exponent -= LDBL_MANT_DIG;
/* If x + y exponent is very large and z exponent is very small,
it doesn't matter if we don't adjust it. */
if (w.ieee.exponent > LDBL_MANT_DIG)
w.ieee.exponent -= LDBL_MANT_DIG;
adjust = 1;
}
else if (w.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
/* Similarly.
If z exponent is very large and x and y exponents are
very small, it doesn't matter if we don't adjust it. */
if (u.ieee.exponent > v.ieee.exponent)
{
if (u.ieee.exponent > LDBL_MANT_DIG)
u.ieee.exponent -= LDBL_MANT_DIG;
}
else if (v.ieee.exponent > LDBL_MANT_DIG)
v.ieee.exponent -= LDBL_MANT_DIG;
w.ieee.exponent -= LDBL_MANT_DIG;
adjust = 1;
}
else if (u.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
u.ieee.exponent -= LDBL_MANT_DIG;
if (v.ieee.exponent)
v.ieee.exponent += LDBL_MANT_DIG;
else
v.d *= 0x1p64L;
}
else if (v.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
{
v.ieee.exponent -= LDBL_MANT_DIG;
if (u.ieee.exponent)
u.ieee.exponent += LDBL_MANT_DIG;
else
u.d *= 0x1p64L;
}
else /* if (u.ieee.exponent + v.ieee.exponent
<= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) */
{
if (u.ieee.exponent > v.ieee.exponent)
u.ieee.exponent += 2 * LDBL_MANT_DIG;
else
v.ieee.exponent += 2 * LDBL_MANT_DIG;
if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 4)
{
if (w.ieee.exponent)
w.ieee.exponent += 2 * LDBL_MANT_DIG;
else
w.d *= 0x1p128L;
adjust = -1;
}
/* Otherwise x * y should just affect inexact
and nothing else. */
}
x = u.d;
y = v.d;
z = w.d;
}
/* Multiplication m1 + m2 = x * y using Dekker's algorithm. */
#define C ((1LL << (LDBL_MANT_DIG + 1) / 2) + 1)
long double x1 = x * C;
long double y1 = y * C;
long double m1 = x * y;
x1 = (x - x1) + x1;
y1 = (y - y1) + y1;
long double x2 = x - x1;
long double y2 = y - y1;
long double m2 = (((x1 * y1 - m1) + x1 * y2) + x2 * y1) + x2 * y2;
/* Addition a1 + a2 = z + m1 using Knuth's algorithm. */
long double a1 = z + m1;
long double t1 = a1 - z;
long double t2 = a1 - t1;
t1 = m1 - t1;
t2 = z - t2;
long double a2 = t1 + t2;
fenv_t env;
feholdexcept (&env);
fesetround (FE_TOWARDZERO);
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
if (__builtin_expect (adjust == 0, 1))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d. */
return a1 + u.d;
}
else if (__builtin_expect (adjust > 0, 1))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Result is a1 + u.d, scaled up. */
return (a1 + u.d) * 0x1p64L;
}
else
{
if ((u.ieee.mantissa1 & 1) == 0)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
v.d = a1 + u.d;
int j = fetestexcept (FE_INEXACT) != 0;
feupdateenv (&env);
/* Ensure the following computations are performed in default rounding
mode instead of just reusing the round to zero computation. */
asm volatile ("" : "=m" (u) : "m" (u));
/* If a1 + u.d is exact, the only rounding happens during
scaling down. */
if (j == 0)
return v.d * 0x1p-128L;
/* If result rounded to zero is not subnormal, no double
rounding will occur. */
if (v.ieee.exponent > 128)
return (a1 + u.d) * 0x1p-128L;
/* If v.d * 0x1p-128L with round to zero is a subnormal above
or equal to LDBL_MIN / 2, then v.d * 0x1p-128L shifts mantissa
down just by 1 bit, which means v.ieee.mantissa1 |= j would
change the round bit, not sticky or guard bit.
v.d * 0x1p-128L never normalizes by shifting up,
so round bit plus sticky bit should be already enough
for proper rounding. */
if (v.ieee.exponent == 128)
{
/* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding,
v.ieee.mantissa1 & 1 is the round bit and j is our sticky
bit. In round-to-nearest 001 rounds down like 00,
011 rounds up, even though 01 rounds down (thus we need
to adjust), 101 rounds down like 10 and 111 rounds up
like 11. */
if ((v.ieee.mantissa1 & 3) == 1)
{
v.d *= 0x1p-128L;
if (v.ieee.negative)
return v.d - 0x1p-16445L /* __LDBL_DENORM_MIN__ */;
else
return v.d + 0x1p-16445L /* __LDBL_DENORM_MIN__ */;
}
else
return v.d * 0x1p-128L;
}
v.ieee.mantissa1 |= j;
return v.d * 0x1p-128L;
}
}
weak_alias (__fmal, fmal)
+1 -1
View File
@@ -1,5 +1,5 @@
#include <math_ldbl_opt.h>
#include <math/s_fma.c>
#include <sysdeps/ieee754/dbl-64/s_fma.c>
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
compat_symbol (libm, __fma, fmal, GLIBC_2_1);
#endif
+2 -4
View File
@@ -2,10 +2,6 @@
# machine.
+cflags += -mnew-mnemonics
ifeq ($(subdir),gmon)
sysdep_routines += ppc-mcount
endif
ifeq ($(subdir),string)
CFLAGS-memcmp.c += -Wno-uninitialized
endif
@@ -27,4 +23,6 @@ endif
ifeq ($(subdir),csu)
# get offset to rtld_global._dl_hwcap
gen-as-const-headers += rtld-global-offsets.sym
# get offset to __locale_struct.__ctype_tolower
gen-as-const-headers += locale-defines.sym
endif
+4
View File
@@ -61,4 +61,8 @@ typedef double double_t;
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
/* The powerpc has a combined multiply/add instruction. */
# define FP_FAST_FMA 1
# define FP_FAST_FMAF 1
#endif /* ISO C99 */
+3 -2
View File
@@ -68,7 +68,7 @@ PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10]
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_platforms
#else
PROCINFO_CLASS const char _dl_powerpc_platforms[8][12]
PROCINFO_CLASS const char _dl_powerpc_platforms[9][12]
#endif
#ifndef PROCINFO_DECL
= {
@@ -79,7 +79,8 @@ PROCINFO_CLASS const char _dl_powerpc_platforms[8][12]
[PPC_PLATFORM_POWER6] = "power6",
[PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
[PPC_PLATFORM_POWER6X] = "power6x",
[PPC_PLATFORM_POWER7] = "power7"
[PPC_PLATFORM_POWER7] = "power7",
[PPC_PLATFORM_PPCA2] = "ppca2"
}
#endif
#if !defined SHARED || defined PROCINFO_DECL
+6 -1
View File
@@ -31,7 +31,7 @@
#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
+ PPC_FEATURE_HAS_DFP)
#define _DL_PLATFORMS_COUNT 8
#define _DL_PLATFORMS_COUNT 9
#define _DL_FIRST_PLATFORM 32
/* Mask to filter out platforms. */
@@ -47,6 +47,7 @@
#define PPC_PLATFORM_CELL_BE 5
#define PPC_PLATFORM_POWER6X 6
#define PPC_PLATFORM_POWER7 7
#define PPC_PLATFORM_PPCA2 8
static inline const char *
__attribute__ ((unused))
@@ -123,6 +124,10 @@ _dl_string_platform (const char *str)
GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
== 0)
return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
else if (strcmp (str + 3,
GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPCA2] + 3)
== 0)
return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPCA2;
}
return -1;
+118
View File
@@ -0,0 +1,118 @@
/* Pythagorean addition using doubles
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "math.h"
#include "math_private.h"
static const double two60 = 1.152921504606847e+18;
static const double two500 = 3.2733906078961419e+150;
static const double two600 = 4.149515568880993e+180;
static const double two1022 = 4.49423283715579e+307;
static const double twoM500 = 3.054936363499605e-151;
static const double twoM600 = 2.4099198651028841e-181;
static const double pdnum = 2.225073858507201e-308;
/* __ieee754_hypot(x,y)
*
* This a FP only version without any FP->INT conversion.
* It is similar to default C version, making appropriates
* overflow and underflows checks as well scaling when it
* is needed.
*/
#ifdef _ARCH_PWR7
/* POWER7 isinf and isnan optimization are fast. */
# define TEST_INF_NAN(x, y) \
if (isinf(x) || isinf(y)) \
return INFINITY; \
if (isnan(x) || isnan(y)) \
return NAN;
# else
/* For POWER6 and below isinf/isnan triggers LHS and PLT calls are
* costly (especially for POWER6). */
# define GET_TW0_HIGH_WORD(d1,d2,i1,i2) \
do { \
ieee_double_shape_type gh_u1; \
ieee_double_shape_type gh_u2; \
gh_u1.value = (d1); \
gh_u2.value = (d2); \
(i1) = gh_u1.parts.msw; \
(i2) = gh_u2.parts.msw; \
} while (0)
# define TEST_INF_NAN(x, y) \
do { \
int32_t hx, hy; \
GET_TW0_HIGH_WORD(x, y, hx, hy); \
if (hy > hx) { \
uint32_t ht = hx; hx = hy; hy = ht; \
} \
if (hx >= 0x7ff00000) { \
if (hx == 0x7ff00000 || hy == 0x7ff00000) \
return INFINITY; \
return NAN; \
} \
} while (0)
#endif
double
__ieee754_hypot (double x, double y)
{
x = fabs (x);
y = fabs (y);
TEST_INF_NAN (x, y);
if (y > x)
{
double t = x;
x = y;
y = t;
}
if (y == 0.0 || (x / y) > two60)
{
return x + y;
}
if (x > two500)
{
x *= twoM600;
y *= twoM600;
return __ieee754_sqrt (x * x + y * y) / twoM600;
}
if (y < twoM500)
{
if (y <= pdnum)
{
x *= two1022;
y *= two1022;
return __ieee754_sqrt (x * x + y * y) / two1022;
}
else
{
x *= two600;
y *= two600;
return __ieee754_sqrt (x * x + y * y) / two600;
}
}
return __ieee754_sqrt (x * x + y * y);
}
strong_alias (__ieee754_hypot, __hypot_finite)
+119
View File
@@ -0,0 +1,119 @@
/* Pythagorean addition using floats
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "math.h"
#include "math_private.h"
static const float two30 = 1.0737418e09;
static const float two50 = 1.1259000e15;
static const float two60 = 1.1529221e18;
static const float two126 = 8.5070592e+37;
static const float twoM50 = 8.8817842e-16;
static const float twoM60 = 6.7762644e-21;
static const float pdnum = 1.1754939e-38;
/* __ieee754_hypotf(x,y)
*
* This a FP only version without any FP->INT conversion.
* It is similar to default C version, making appropriates
* overflow and underflows checks as well scaling when it
* is needed.
*/
#ifdef _ARCH_PWR7
/* POWER7 isinf and isnan optimizations are fast. */
# define TEST_INF_NAN(x, y) \
if (isinff(x) || isinff(y)) \
return INFINITY; \
if (isnanf(x) || isnanf(y)) \
return NAN;
# else
/* For POWER6 and below isinf/isnan triggers LHS and PLT calls are
* costly (especially for POWER6). */
# define GET_TWO_FLOAT_WORD(f1,f2,i1,i2) \
do { \
ieee_float_shape_type gf_u1; \
ieee_float_shape_type gf_u2; \
gf_u1.value = (f1); \
gf_u2.value = (f2); \
(i1) = gf_u1.word; \
(i2) = gf_u2.word; \
} while (0)
# define TEST_INF_NAN(x, y) \
do { \
int32_t hx, hy; \
GET_TWO_FLOAT_WORD(x, y, hx, hy); \
if (hy > hx) { \
uint32_t ht = hx; hx = hy; hy = ht; \
} \
if (hx >= 0x7f800000) { \
if (hx == 0x7f800000 || hy == 0x7f800000) \
return INFINITY; \
return NAN; \
} \
} while (0)
#endif
float
__ieee754_hypotf (float x, float y)
{
x = fabsf (x);
y = fabsf (y);
TEST_INF_NAN (x, y);
if (y > x)
{
float t = y;
y = x;
x = t;
}
if (y == 0.0 || (x / y) > two30)
{
return x + y;
}
if (x > two50)
{
x *= twoM60;
y *= twoM60;
return __ieee754_sqrtf (x * x + y * y) / twoM60;
}
if (y < twoM50)
{
if (y <= pdnum)
{
x *= two126;
y *= two126;
return __ieee754_sqrtf (x * x + y * y) / two126;
}
else
{
x *= two60;
y *= two60;
return __ieee754_sqrtf (x * x + y * y) / two60;
}
}
return __ieee754_sqrtf (x * x + y * y);
}
strong_alias (__ieee754_hypotf, __hypotf_finite)
+189
View File
@@ -0,0 +1,189 @@
/* e_rem_pio2f.c -- float version of e_rem_pio2.c
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <math.h>
#include "math_private.h"
#include "s_float_bitwise.h"
/* defined in sysdeps/powerpc/fpu/k_rem_pio2f.c */
int __fp_kernel_rem_pio2f (float *x, float *y, float e0, int32_t nx);
/* __ieee754_rem_pio2f(x,y)
*
* return the remainder of x rem pi/2 in y[0]+y[1]
*/
static const float npio2_hw[] = {
1.57077026e+00, 3.14154053e+00, 4.71228027e+00, 6.28308105e+00,
7.85388184e+00, 9.42456055e+00, 1.09953613e+01, 1.25661621e+01,
1.41369629e+01, 1.57077637e+01, 1.72783203e+01, 1.88491211e+01,
2.04199219e+01, 2.19907227e+01, 2.35615234e+01, 2.51323242e+01,
2.67031250e+01, 2.82739258e+01, 2.98447266e+01, 3.14155273e+01,
3.29863281e+01, 3.45566406e+01, 3.61279297e+01, 3.76982422e+01,
3.92695312e+01, 4.08398438e+01, 4.24111328e+01, 4.39814453e+01,
4.55527344e+01, 4.71230469e+01, 4.86943359e+01, 5.02646484e+01
};
static const float zero = 0.0000000000e+00;
static const float two8 = 2.5600000000e+02;
static const float half = 5.0000000000e-01;
static const float invpio2 = 6.3661980629e-01;
static const float pio2_1 = 1.5707855225e+00;
static const float pio2_1t = 1.0804334124e-05;
static const float pio2_2 = 1.0804273188e-05;
static const float pio2_2t = 6.0770999344e-11;
static const float pio2_3 = 6.0770943833e-11;
static const float pio2_3t = 6.1232342629e-17;
static const float pio4 = 7.8539801e-01;
static const float pio3_4 = 2.3561945e+00;
static const float pio2_24b = 1.5707951e+00;
static const float pio2_2e7 = 2.0106054e+02;
int32_t
__ieee754_rem_pio2f (float x, float *y)
{
float ax, z, n, r, w, t, e0;
float tx[3];
int32_t i, nx;
ax = __builtin_fabsf (x);
if (ax <= pio4)
{
y[0] = x;
y[1] = 0;
return 0;
}
if (ax < pio3_4)
{
if (x > 0)
{
z = x - pio2_1;
if (!__float_and_test28 (ax, pio2_24b))
{
y[0] = z - pio2_1t;
y[1] = (z - y[0]) - pio2_1t;
}
else
{
z -= pio2_2;
y[0] = z - pio2_2t;
y[1] = (z - y[0]) - pio2_2t;
}
return 1;
}
else
{
z = x + pio2_1;
if (!__float_and_test28 (ax, pio2_24b))
{
y[0] = z + pio2_1t;
y[1] = (z - y[0]) + pio2_1t;
}
else
{
z += pio2_2;
y[0] = z + pio2_2t;
y[1] = (z - y[0]) + pio2_2t;
}
return -1;
}
}
if (ax <= pio2_2e7)
{
n = __floorf (ax * invpio2 + half);
i = (int32_t) n;
r = ax - n * pio2_1;
w = n * pio2_1t; /* 1st round good to 40 bit */
if (i < 32 && !__float_and_test24 (ax, npio2_hw[i - 1]))
{
y[0] = r - w;
}
else
{
float i, j;
j = __float_and8 (ax);
y[0] = r - w;
i = __float_and8 (y[0]);
if (j / i > 256.0 || j / i < 3.9062500e-3)
{ /* 2nd iterations needed, good to 57 */
t = r;
w = n * pio2_2;
r = t - w;
w = n * pio2_2t - ((t - r) - w);
y[0] = r - w;
i = __float_and8 (y[0]);
if (j / i > 33554432 || j / i < 2.9802322e-8)
{ /* 3rd iteration needed, 74 bits acc */
t = r;
w = n * pio2_3;
r = t - w;
w = n * pio2_3t - ((t - r) - w);
y[0] = r - w;
}
}
}
y[1] = (r - y[0]) - w;
if (x < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -i;
}
else
{
return i;
}
}
/* all other (large) arguments */
if (isnanf (x) || isinff (x))
{
y[0] = y[1] = x - x;
return 0;
}
/* set z = scalbn(|x|,ilogb(x)-7) */
e0 = __float_and8 (ax / 128.0);
z = ax / e0;
tx[0] = __floorf (z);
z = (z - tx[0]) * two8;
tx[1] = __floorf (z);
z = (z - tx[1]) * two8;
tx[2] = __floorf (z);
nx = 3;
while (tx[nx - 1] == zero)
nx--;
i = __fp_kernel_rem_pio2f (tx, y, e0, nx);
if (x < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -i;
}
return i;
}
+6 -16
View File
@@ -1,5 +1,5 @@
/* Double-precision floating point square root.
Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
Copyright (C) 1997, 2002-2004, 2008, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,21 +46,15 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
#ifdef __STDC__
double
__slow_ieee754_sqrt (double x)
#else
double
__slow_ieee754_sqrt (x)
double x;
#endif
{
const float inf = a_inf.value;
if (x > 0)
{
/* schedule the EXTRACT_WORDS to get separation between the store
and the load. */
and the load. */
ieee_double_shape_type ew_u;
ieee_double_shape_type iw_u;
ew_u.value = (x);
@@ -147,7 +141,7 @@ __slow_ieee754_sqrt (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
FE_INVALID_SQRT. */
FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -160,14 +154,9 @@ __slow_ieee754_sqrt (x)
return f_wash (x);
}
#ifdef __STDC__
#undef __ieee754_sqrt
double
__ieee754_sqrt (double x)
#else
double
__ieee754_sqrt (x)
double x;
#endif
{
double z;
@@ -175,7 +164,7 @@ __ieee754_sqrt (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
fsqrt instruction above the branch. */
fsqrt instruction above the branch. */
__asm __volatile (" fsqrt %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -184,3 +173,4 @@ __ieee754_sqrt (x)
return z;
}
strong_alias (__ieee754_sqrt, __sqrt_finite)
+5 -16
View File
@@ -1,5 +1,5 @@
/* Single-precision floating point square root.
Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc.
Copyright (C) 1997, 2003, 2004, 2008, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,14 +46,8 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
#ifdef __STDC__
float
__slow_ieee754_sqrtf (float x)
#else
float
__slow_ieee754_sqrtf (x)
float x;
#endif
{
const float inf = a_inf.value;
@@ -123,7 +117,7 @@ __slow_ieee754_sqrtf (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
FE_INVALID_SQRT. */
FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -136,15 +130,9 @@ __slow_ieee754_sqrtf (x)
return f_washf (x);
}
#ifdef __STDC__
#undef __ieee754_sqrtf
float
__ieee754_sqrtf (float x)
#else
float
__ieee754_sqrtf (x)
float x;
#endif
{
double z;
@@ -152,7 +140,7 @@ __ieee754_sqrtf (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
fsqrt instruction above the branch. */
fsqrt instruction above the branch. */
__asm __volatile (" fsqrts %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -161,3 +149,4 @@ __ieee754_sqrtf (x)
return z;
}
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+2 -1
View File
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 1997, 1999, 2000, 2001, 2007, 2008
Copyright (C) 1997, 1999, 2000, 2001, 2007, 2008, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -66,4 +66,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
#endif
libm_hidden_ver (__feupdateenv, feupdateenv)
versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
+2 -1
View File
@@ -1,5 +1,5 @@
/* Test exception in current environment.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,3 +31,4 @@ fetestexcept (int excepts)
just: */
return u.l[1] & excepts;
}
libm_hidden_def (fetestexcept)
+65
View File
@@ -0,0 +1,65 @@
/* k_cosf.c -- float version of k_cos.c
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "math.h"
#include "math_private.h"
static const float twom27 = 7.4505806e-09;
static const float dot3 = 3.0000001e-01;
static const float dot78125 = 7.8125000e-01;
static const float one = 1.0000000000e+00;
static const float C1 = 4.1666667908e-02;
static const float C2 = -1.3888889225e-03;
static const float C3 = 2.4801587642e-05;
static const float C4 = -2.7557314297e-07;
static const float C5 = 2.0875723372e-09;
static const float C6 = -1.1359647598e-11;
float
__kernel_cosf (float x, float y)
{
float a, hz, z, r, qx;
float ix;
ix = __builtin_fabsf (x);
if (ix < twom27)
{ /* |x| < 2**-27 */
if (x == 0.0)
return one;
}
z = x * x;
r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
if (ix < dot3) /* if |x| < 0.3 */
return one - ((float) 0.5 * z - (z * r - x * y));
else
{
if (ix > dot78125)
{ /* x > 0.78125 */
qx = (float) 0.28125;
}
else
{
qx = ix / 4.0;
}
hz = (float) 0.5 *z - qx;
a = one - qx;
return a - (hz - (z * r - x * y));
}
}
+274
View File
@@ -0,0 +1,274 @@
/* k_rem_pio2f.c -- float version of e_rem_pio2.c
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <math.h>
#include "math_private.h"
#include "s_float_bitwise.h"
static const float two_over_pi[] = {
1.62000000e+02, 2.49000000e+02, 1.31000000e+02, 1.10000000e+02,
7.80000000e+01, 6.80000000e+01, 2.10000000e+01, 4.10000000e+01,
2.52000000e+02, 3.90000000e+01, 8.70000000e+01, 2.09000000e+02,
2.45000000e+02, 5.20000000e+01, 2.21000000e+02, 1.92000000e+02,
2.19000000e+02, 9.80000000e+01, 1.49000000e+02, 1.53000000e+02,
6.00000000e+01, 6.70000000e+01, 1.44000000e+02, 6.50000000e+01,
2.54000000e+02, 8.10000000e+01, 9.90000000e+01, 1.71000000e+02,
2.22000000e+02, 1.87000000e+02, 1.97000000e+02, 9.70000000e+01,
1.83000000e+02, 3.60000000e+01, 1.10000000e+02, 5.80000000e+01,
6.60000000e+01, 7.70000000e+01, 2.10000000e+02, 2.24000000e+02,
6.00000000e+00, 7.30000000e+01, 4.60000000e+01, 2.34000000e+02,
9.00000000e+00, 2.09000000e+02, 1.46000000e+02, 2.80000000e+01,
2.54000000e+02, 2.90000000e+01, 2.35000000e+02, 2.80000000e+01,
1.77000000e+02, 4.10000000e+01, 1.67000000e+02, 6.20000000e+01,
2.32000000e+02, 1.30000000e+02, 5.30000000e+01, 2.45000000e+02,
4.60000000e+01, 1.87000000e+02, 6.80000000e+01, 1.32000000e+02,
2.33000000e+02, 1.56000000e+02, 1.12000000e+02, 3.80000000e+01,
1.80000000e+02, 9.50000000e+01, 1.26000000e+02, 6.50000000e+01,
5.70000000e+01, 1.45000000e+02, 2.14000000e+02, 5.70000000e+01,
1.31000000e+02, 8.30000000e+01, 5.70000000e+01, 2.44000000e+02,
1.56000000e+02, 1.32000000e+02, 9.50000000e+01, 1.39000000e+02,
1.89000000e+02, 2.49000000e+02, 4.00000000e+01, 5.90000000e+01,
3.10000000e+01, 2.48000000e+02, 1.51000000e+02, 2.55000000e+02,
2.22000000e+02, 5.00000000e+00, 1.52000000e+02, 1.50000000e+01,
2.39000000e+02, 4.70000000e+01, 1.70000000e+01, 1.39000000e+02,
9.00000000e+01, 1.00000000e+01, 1.09000000e+02, 3.10000000e+01,
1.09000000e+02, 5.40000000e+01, 1.26000000e+02, 2.07000000e+02,
3.90000000e+01, 2.03000000e+02, 9.00000000e+00, 1.83000000e+02,
7.90000000e+01, 7.00000000e+01, 6.30000000e+01, 1.02000000e+02,
1.58000000e+02, 9.50000000e+01, 2.34000000e+02, 4.50000000e+01,
1.17000000e+02, 3.90000000e+01, 1.86000000e+02, 1.99000000e+02,
2.35000000e+02, 2.29000000e+02, 2.41000000e+02, 1.23000000e+02,
6.10000000e+01, 7.00000000e+00, 5.70000000e+01, 2.47000000e+02,
1.38000000e+02, 8.20000000e+01, 1.46000000e+02, 2.34000000e+02,
1.07000000e+02, 2.51000000e+02, 9.50000000e+01, 1.77000000e+02,
3.10000000e+01, 1.41000000e+02, 9.30000000e+01, 8.00000000e+00,
8.60000000e+01, 3.00000000e+00, 4.80000000e+01, 7.00000000e+01,
2.52000000e+02, 1.23000000e+02, 1.07000000e+02, 1.71000000e+02,
2.40000000e+02, 2.07000000e+02, 1.88000000e+02, 3.20000000e+01,
1.54000000e+02, 2.44000000e+02, 5.40000000e+01, 2.90000000e+01,
1.69000000e+02, 2.27000000e+02, 1.45000000e+02, 9.70000000e+01,
9.40000000e+01, 2.30000000e+02, 2.70000000e+01, 8.00000000e+00,
1.01000000e+02, 1.53000000e+02, 1.33000000e+02, 9.50000000e+01,
2.00000000e+01, 1.60000000e+02, 1.04000000e+02, 6.40000000e+01,
1.41000000e+02, 2.55000000e+02, 2.16000000e+02, 1.28000000e+02,
7.70000000e+01, 1.15000000e+02, 3.90000000e+01, 4.90000000e+01,
6.00000000e+00, 6.00000000e+00, 2.10000000e+01, 8.60000000e+01,
2.02000000e+02, 1.15000000e+02, 1.68000000e+02, 2.01000000e+02,
9.60000000e+01, 2.26000000e+02, 1.23000000e+02, 1.92000000e+02,
1.40000000e+02, 1.07000000e+02
};
static const float PIo2[] = {
1.5703125000e+00, /* 0x3fc90000 */
4.5776367188e-04, /* 0x39f00000 */
2.5987625122e-05, /* 0x37da0000 */
7.5437128544e-08, /* 0x33a20000 */
6.0026650317e-11, /* 0x2e840000 */
7.3896444519e-13, /* 0x2b500000 */
5.3845816694e-15, /* 0x27c20000 */
5.6378512969e-18, /* 0x22d00000 */
8.3009228831e-20, /* 0x1fc40000 */
3.2756352257e-22, /* 0x1bc60000 */
6.3331015649e-25, /* 0x17440000 */
};
static const float zero = 0.0000000000e+00;
static const float one = 1.0000000000;
static const float twon8 = 3.9062500000e-03;
static const float two8 = 2.5600000000e+02;
int32_t
__fp_kernel_rem_pio2f (float *x, float *y, float e0, int32_t nx)
{
int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih, exp;
float z, fw, f[20], fq[20], q[20];
/* initialize jk */
jp = jk = 9;
/* determine jx,jv,q0, note that 3>q0 */
jx = nx - 1;
exp = __float_get_exp (e0) - 127;
jv = (exp - 3) / 8;
if (jv < 0)
jv = 0;
q0 = exp - 8 * (jv + 1);
/* set up f[0] to f[jx+jk] where f[jx+jk] = two_over_pi[jv+jk] */
j = jv - jx;
m = jx + jk;
for (i = 0; i <= m; i++, j++)
f[i] = (j < 0) ? zero : two_over_pi[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;
}
jz = jk;
recompute:
/* distill q[] into iq[] reversingly */
for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)
{
fw = __truncf (twon8 * z);
iq[i] = (int32_t) (z - two8 * fw);
z = q[j - 1] + fw;
}
/* compute n */
z = __scalbnf (z, q0); /* actual value of z */
z -= 8.0 * __floorf (z * 0.125); /* trim off integer >= 8 */
n = (int32_t) z;
z -= __truncf (z);
ih = 0;
if (q0 > 0)
{ /* need iq[jz-1] to determine n */
i = (iq[jz - 1] >> (8 - q0));
n += i;
iq[jz - 1] -= i << (8 - q0);
ih = iq[jz - 1] >> (7 - q0);
}
else if (q0 == 0)
ih = iq[jz - 1] >> 8;
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] = 0x100 - j;
}
}
else
iq[i] = 0xff - j;
}
if (q0 > 0)
{ /* rare case: chance is 1 in 12 */
switch (q0)
{
case 1:
iq[jz - 1] &= 0x7f;
break;
case 2:
iq[jz - 1] &= 0x3f;
break;
}
}
if (ih == 2)
{
z = one - z;
if (carry != 0)
z -= __scalbnf (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 */
for (i = jz + 1; i <= jz + k; i++)
{ /* add q[jz+1] to q[jz+k] */
f[jx + i] = two_over_pi[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 -= 8;
while (iq[jz] == 0)
{
jz--;
q0 -= 8;
}
}
else
{ /* break z into 8-bit if necessary */
z = __scalbnf (z, -q0);
if (z >= two8)
{
fw = __truncf (twon8 * z);
iq[jz] = (int32_t) (z - two8 * fw);
jz += 1;
q0 += 8;
iq[jz] = (int32_t) fw;
}
else
iq[jz] = (int32_t) z;
}
/* convert integer "bit" chunk to floating-point value */
fw = __scalbnf (one, q0);
for (i = jz; i >= 0; i--)
{
q[i] = fw * (float) iq[i];
fw *= twon8;
}
/* 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[] */
fw = 0.0;
for (i = jz; i >= 0; i--)
fw += fq[i];
y[0] = (ih == 0) ? fw : -fw;
fw = fq[0] - fw;
for (i = 1; i <= jz; i++)
fw += fq[i];
y[1] = (ih == 0) ? fw : -fw;
return n & 7;
}
+53
View File
@@ -0,0 +1,53 @@
/* k_sinf.c -- float version of k_sin.c
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "math.h"
#include "math_private.h"
static const float twom27 = 7.4505806000e-09;
static const float half = 5.0000000000e-01;
static const float S1 = -1.6666667163e-01;
static const float S2 = 8.3333337680e-03;
static const float S3 = -1.9841270114e-04;
static const float S4 = 2.7557314297e-06;
static const float S5 = -2.5050759689e-08;
static const float S6 = 1.5896910177e-10;
float
__kernel_sinf (float x, float y, int iy)
{
float z, r, v;
float ix;
ix = __builtin_fabsf (x);
if (ix < twom27)
{ /* |x| < 2**-27 */
if (x == 0.0)
return x;
}
z = x * x;
v = z * x;
r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));
if (iy == 0)
return x + v * (S1 + z * r);
else
return x - ((z * (half * y - v * r) - y) - v * S1);
}
+134 -3
View File
@@ -1,5 +1,5 @@
/* Private inline math functions for powerpc.
Copyright (C) 2006
Copyright (C) 2006, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,11 +25,144 @@
#include <ldsodefs.h>
#include <dl-procinfo.h>
#include <math/math_private.h>
# if __WORDSIZE == 64 || defined _ARCH_PWR4
# define __CPU_HAS_FSQRT 1
#ifndef __ieee754_sqrt
# define __ieee754_sqrt(x) \
({ double __z; \
__asm __volatile ( \
" fsqrt %0,%1\n" \
: "=f" (__z) \
: "f"(x)); \
__z; })
#endif
#ifndef __ieee754_sqrtf
# define __ieee754_sqrtf(x) \
({ float __z; \
__asm __volatile ( \
" fsqrts %0,%1\n" \
: "=f" (__z) \
: "f"(x)); \
__z; })
#endif
# else
# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
# endif // __WORDSIZE == 64 || defined _ARCH_PWR4
#if defined _ARCH_PWR5X
# ifndef __round
# define __round(x) \
({ double __z; \
__asm __volatile ( \
" frin %0,%1\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __roundf
# define __roundf(x) \
({ float __z; \
__asm __volatile ( \
" frin %0,%1\n" \
" frsp %0,%0\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __trunc
# define __trunc(x) \
({ double __z; \
__asm __volatile ( \
" friz %0,%1\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __truncf
# define __truncf(x) \
({ float __z; \
__asm __volatile ( \
" friz %0,%1\n" \
" frsp %0,%0\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __ceil
# define __ceil(x) \
({ double __z; \
__asm __volatile ( \
" frip %0,%1\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __ceilf
# define __ceilf(x) \
({ float __z; \
__asm __volatile ( \
" frip %0,%1\n" \
" frsp %0,%0\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __floor
# define __floor(x) \
({ double __z; \
__asm __volatile ( \
" frim %0,%1\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
# ifndef __floorf
# define __floorf(x) \
({ float __z; \
__asm __volatile ( \
" frim %0,%1\n" \
" frsp %0,%0\n" \
: "=f" (__z) \
: "f" (x)); \
__z; })
# endif
#endif /* defined _ARCH_PWR5X */
#if defined _ARCH_PWR6
# ifndef __copysign
# define __copysign(x, y) \
({ double __z; \
__asm __volatile ( \
" fcpsgn %0,%1,%2\n" \
: "=f" (__z) \
: "f" (y), "f" (x)); \
__z; })
# endif
# ifndef __copysignf
# define __copysignf(x, y) \
({ float __z; \
__asm __volatile ( \
" fcpsgn %0,%1,%2\n" \
" frsp %0,%0\n" \
: "=f" (__z) \
: "f" (y), "f" (x)); \
__z; })
# endif
#endif /* defined _ARCH_PWR6 */
# ifndef __LIBC_INTERNAL_MATH_INLINES
extern double __slow_ieee754_sqrt (double);
@@ -78,6 +211,4 @@ __ieee754_sqrtf (float __x)
}
#endif /* __LIBC_INTERNAL_MATH_INLINES */
#include <math/math_private.h>
#endif /* _PPC_MATH_PRIVATE_H_ */
+71
View File
@@ -0,0 +1,71 @@
/* s_cosf.c -- float version of s_cos.c.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <errno.h>
#include "math.h"
#include "math_private.h"
static const float one = 1.0;
static const float pio4 = 7.8539801e-1;
float
__cosf (float x)
{
float y[2], z = 0.0;
float ix;
int32_t n;
ix = __builtin_fabsf (x);
/* |x| ~< pi/4 */
if (ix <= pio4)
{
return __kernel_cosf (x, z);
/* cos(Inf or NaN) is NaN */
}
else if (isnanf (ix))
{
return x - x;
}
else if (isinff (ix))
{
__set_errno (EDOM);
return x - x;
}
/* argument reduction needed */
else
{
n = __ieee754_rem_pio2f (x, y);
switch (n & 3)
{
case 0:
return __kernel_cosf (y[0], y[1]);
case 1:
return -__kernel_sinf (y[0], y[1], 1);
case 2:
return -__kernel_cosf (y[0], y[1]);
default:
return __kernel_sinf (y[0], y[1], 1);
}
}
}
weak_alias (__cosf, cosf)
+112
View File
@@ -0,0 +1,112 @@
/* Bitwise manipulation over float. Function prototypes.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _FLOAT_BITWISE_
#define _FLOAT_BITWISE_ 1
#include "math_private.h"
/* Returns (int)(num & 0x7FFFFFF0 == 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
};
__asm__ (
/* the 'f' constrain is use on mask because we just need
* to compare floats, not full vector */
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
);
#else
int32_t inum;
GET_FLOAT_WORD(inum, num);
inum = (inum & 0x7ffffff0);
SET_FLOAT_WORD(ret, inum);
#endif
return (ret == value);
}
/* Returns (int)(num & 0x7FFFFF00 == 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
};
__asm__ (
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
);
#else
int32_t inum;
GET_FLOAT_WORD(inum, num);
inum = (inum & 0x7fffff00);
SET_FLOAT_WORD(ret, inum);
#endif
return (ret == value);
}
/* Returns (float)(num & 0x7F800000) */
static inline
float __float_and8 (float num)
{
float ret;
#ifdef _ARCH_PWR7
vector int mask = (vector int) {
0x7ff00000, 0x00000000, 0x00000000, 0x00000000
};
__asm__ (
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
);
#else
int32_t inum;
GET_FLOAT_WORD(inum, num);
inum = (inum & 0x7f800000);
SET_FLOAT_WORD(ret, inum);
#endif
return ret;
}
/* Returns ((int32_t)(num & 0x7F800000) >> 23) */
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
};
__asm__ (
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
);
GET_FLOAT_WORD(inum, ret);
#else
GET_FLOAT_WORD(inum, num);
inum = inum & 0x7f800000;
#endif
return inum >> 23;
}
#endif /* s_float_bitwise.h */
@@ -1,7 +1,6 @@
/* Compute (X * Y) + Z as ternary operation.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
/* Compute x * y + z as ternary operation. PowerPC version.
Copyright (C) 2010 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
@@ -20,12 +19,15 @@
#include <sysdep.h>
.text
ENTRY(__fma)
fldl 4(%esp) // x
fmull 12(%esp) // x * y
fldl 20(%esp) // z : x * y
faddp // (x * y) + z
ret
/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */
fmadd fp1,fp1,fp2,fp3
blr
END(__fma)
weak_alias (__fma, fma)
weak_alias (__fma,fma)
#ifdef NO_LONG_DOUBLE
weak_alias (__fma,__fmal)
weak_alias (__fma,fmal)
#endif
@@ -1,7 +1,6 @@
/* Compute (X * Y) + Z as ternary operation.
Copyright (C) 1997 Free Software Foundation, Inc.
/* Compute x * y + z as ternary operation. PowerPC version.
Copyright (C) 2010 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
@@ -20,12 +19,10 @@
#include <sysdep.h>
.text
ENTRY(__fmaf)
flds 4(%esp) // x
fmuls 8(%esp) // x * y
flds 12(%esp) // z : x * y
faddp // (x * y) + z
ret
/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */
fmadds fp1,fp1,fp2,fp3
blr
END(__fmaf)
weak_alias (__fmaf, fmaf)
weak_alias (__fmaf,fmaf)
+70
View File
@@ -0,0 +1,70 @@
/* s_sinf.c -- float version of s_sin.c.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <errno.h>
#include "math.h"
#include "math_private.h"
static const float pio4 = 7.8539801e-1;
float
__sinf (float x)
{
float y[2], z = 0.0;
float ix;
int32_t n;
ix = __builtin_fabsf (x);
/* |x| ~< pi/4 */
if (ix <= pio4)
{
return __kernel_sinf (x, z, 0);
/* sin(Inf or NaN) is NaN */
}
else if (isnanf (ix))
{
return x - x;
}
else if (isinff (ix))
{
__set_errno (EDOM);
return x - x;
}
/* argument reduction needed */
else
{
n = __ieee754_rem_pio2f (x, y);
switch (n & 3)
{
case 0:
return __kernel_sinf (y[0], y[1], 1);
case 1:
return __kernel_cosf (y[0], y[1]);
case 2:
return -__kernel_sinf (y[0], y[1], 1);
default:
return -__kernel_cosf (y[0], y[1]);
}
}
}
weak_alias (__sinf, sinf)
+5
View File
@@ -0,0 +1,5 @@
#include <locale/localeinfo.h>
--
LOCALE_CTYPE_TOLOWER offsetof (struct __locale_struct, __ctype_tolower)
+1
View File
@@ -1 +1,2 @@
powerpc/powerpc32/power4/fpu
powerpc/powerpc32/power4
@@ -1 +0,0 @@
powerpc/powerpc32/power4/fpu
+5
View File
@@ -5,6 +5,11 @@ ifeq ($(with-fp),no)
sysdep-LDFLAGS += -msoft-float
endif
ifeq ($(subdir),gmon)
sysdep_routines += ppc-mcount
static-only-routines += ppc-mcount
endif
ifeq ($(subdir),misc)
sysdep_routines += gprsave0 gprrest0 gprsave1 gprrest1
endif
+3
View File
@@ -8,6 +8,9 @@ libc {
__fixsfdi; __fixunssfdi;
__floatdidf; __floatdisf;
}
GLIBC_PRIVATE {
__mcount_internal;
}
}
libm {
+511
View File
@@ -0,0 +1,511 @@
/* Optimized memcpy implementation for PowerPC A2.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by Michael Brutman <brutman@us.ibm.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <bp-sym.h>
#include <bp-asm.h>
#define PREFETCH_AHEAD 4 /* no cache lines SRC prefetching ahead */
#define ZERO_AHEAD 2 /* no cache lines DST zeroing ahead */
.machine a2
EALIGN (BP_SYM (memcpy), 5, 0)
CALL_MCOUNT
dcbt 0,r4 /* Prefetch ONE SRC cacheline */
cmplwi cr1,r5,16 /* is size < 16 ? */
mr r6,r3 /* Copy dest reg to r6; */
blt+ cr1,L(shortcopy)
/* Big copy (16 bytes or more)
Figure out how far to the nearest quadword boundary, or if we are
on one already.
r3 - return value (always)
r4 - current source addr
r5 - copy length
r6 - current dest addr
*/
neg r8,r3 /* LS 4 bits = # bytes to 8-byte dest bdry */
clrlwi r8,r8,32-4 /* align to 16byte boundary */
sub r7,r4,r3 /* compute offset to src from dest */
cmplwi cr0,r8,0 /* Were we aligned on a 16 byte bdy? */
beq+ L(dst_aligned)
/* Destination is not aligned on quadword boundary. Get us to one.
r3 - return value (always)
r4 - current source addr
r5 - copy length
r6 - current dest addr
r7 - offset to src from dest
r8 - number of bytes to quadword boundary
*/
mtcrf 0x01,r8 /* put #bytes to boundary into cr7 */
subf r5,r8,r5 /* adjust remaining len */
bf cr7*4+3,1f
lbzx r0,r7,r6 /* copy 1 byte addr */
stb r0,0(r6)
addi r6,r6,1
1:
bf cr7*4+2,2f
lhzx r0,r7,r6 /* copy 2 byte addr */
sth r0,0(r6)
addi r6,r6,2
2:
bf cr7*4+1,4f
lwzx r0,r7,r6 /* copy 4 byte addr */
stw r0,0(r6)
addi r6,r6,4
4:
bf cr7*4+0,8f
lfdx r0,r7,r6 /* copy 8 byte addr */
stfd r0,0(r6)
addi r6,r6,8
8:
add r4,r7,r6 /* update src addr */
/* Dest is quadword aligned now.
Lots of decisions to make. If we are copying less than a cache
line we won't be here long. If we are not on a cache line
boundary we need to get there. And then we need to figure out
how many cache lines ahead to pre-touch.
r3 - return value (always)
r4 - current source addr
r5 - copy length
r6 - current dest addr
*/
.align 4
L(dst_aligned):
#ifdef SHARED
mflr r0
/* Establishes GOT addressability so we can load __cache_line_size
from static. This value was set from the aux vector during startup. */
bcl 20,31,1f
1:
mflr r9
addis r9,r9,__cache_line_size-1b@ha
lwz r9,__cache_line_size-1b@l(r9)
mtlr r0
#else
/* Load __cache_line_size from static. This value was set from the
aux vector during startup. */
lis r9,__cache_line_size@ha
lwz r9,__cache_line_size@l(r9)
#endif
cmplwi cr5, r9, 0
bne+ cr5,L(cachelineset)
li r9,64
L(cachelineset):
addi r10,r9,-1
cmpw cr5,r5,r10 /* Less than a cacheline to go? */
neg r7,r6 /* How far to next cacheline bdy? */
addi r6,r6,-8 /* prepare for stdu */
cmpwi cr0,r9,128
addi r4,r4,-8 /* prepare for ldu */
ble+ cr5,L(lessthancacheline)
beq- cr0,L(big_lines) /* 128 byte line code */
/* More than a cacheline left to go, and using 64 byte cachelines */
clrlwi r7,r7,32-6 /* How far to next cacheline bdy? */
cmplwi cr6,r7,0 /* Are we on a cacheline bdy already? */
/* Reduce total len by what it takes to get to the next cache line */
subf r5,r7,r5
srwi r7,r7,4 /* How many qws to get to the line bdy? */
/* How many full cache lines to copy after getting to a line bdy? */
srwi r10,r5,6
cmplwi r10,0 /* If no full cache lines to copy ... */
li r11,0 /* number cachelines to copy with prefetch */
beq L(nocacheprefetch)
/* We are here because we have at least one full cache line to copy,
and therefore some pre-touching to do. */
cmplwi r10,PREFETCH_AHEAD
li r12,64+8 /* prefetch distance */
ble L(lessthanmaxprefetch)
/* We can only do so much pre-fetching. R11 will have the count of
lines left to prefetch after the initial batch of prefetches
are executed. */
subi r11,r10,PREFETCH_AHEAD
li r10,PREFETCH_AHEAD
L(lessthanmaxprefetch):
mtctr r10
/* At this point r10/ctr hold the number of lines to prefetch in this
initial batch, and r11 holds any remainder. */
L(prefetchSRC):
dcbt r12,r4
addi r12,r12,64
bdnz L(prefetchSRC)
/* Prefetching is done, or was not needed.
cr6 - are we on a cacheline boundary already?
r7 - number of quadwords to the next cacheline boundary
*/
L(nocacheprefetch):
mtctr r7
cmplwi cr1,r5,64 /* Less than a cache line to copy? */
/* How many bytes are left after we copy whatever full
cache lines we can get? */
clrlwi r5,r5,32-6
beq cr6,L(cachelinealigned)
/* Copy quadwords up to the next cacheline boundary */
L(aligntocacheline):
lfd fp9,0x08(r4)
lfdu fp10,0x10(r4)
stfd fp9,0x08(r6)
stfdu fp10,0x10(r6)
bdnz L(aligntocacheline)
.align 4
L(cachelinealigned): /* copy while cache lines */
blt- cr1,L(lessthancacheline) /* size <64 */
L(outerloop):
cmpwi r11,0
mtctr r11
beq- L(endloop)
li r11,64*ZERO_AHEAD +8 /* DCBZ dist */
.align 4
/* Copy whole cachelines, optimized by prefetching SRC cacheline */
L(loop): /* Copy aligned body */
dcbt r12,r4 /* PREFETCH SOURCE some cache lines ahead */
lfd fp9, 0x08(r4)
dcbz r11,r6
lfd fp10, 0x10(r4)
lfd fp11, 0x18(r4)
lfd fp12, 0x20(r4)
stfd fp9, 0x08(r6)
stfd fp10, 0x10(r6)
stfd fp11, 0x18(r6)
stfd fp12, 0x20(r6)
lfd fp9, 0x28(r4)
lfd fp10, 0x30(r4)
lfd fp11, 0x38(r4)
lfdu fp12, 0x40(r4)
stfd fp9, 0x28(r6)
stfd fp10, 0x30(r6)
stfd fp11, 0x38(r6)
stfdu fp12, 0x40(r6)
bdnz L(loop)
L(endloop):
cmpwi r10,0
beq- L(endloop2)
mtctr r10
L(loop2): /* Copy aligned body */
lfd fp9, 0x08(r4)
lfd fp10, 0x10(r4)
lfd fp11, 0x18(r4)
lfd fp12, 0x20(r4)
stfd fp9, 0x08(r6)
stfd fp10, 0x10(r6)
stfd fp11, 0x18(r6)
stfd fp12, 0x20(r6)
lfd fp9, 0x28(r4)
lfd fp10, 0x30(r4)
lfd fp11, 0x38(r4)
lfdu fp12, 0x40(r4)
stfd fp9, 0x28(r6)
stfd fp10, 0x30(r6)
stfd fp11, 0x38(r6)
stfdu fp12, 0x40(r6)
bdnz L(loop2)
L(endloop2):
.align 4
L(lessthancacheline): /* Was there less than cache to do ? */
cmplwi cr0,r5,16
srwi r7,r5,4 /* divide size by 16 */
blt- L(do_lt16)
mtctr r7
L(copy_remaining):
lfd fp9, 0x08(r4)
lfdu fp10, 0x10(r4)
stfd fp9, 0x08(r6)
stfdu fp10, 0x10(r6)
bdnz L(copy_remaining)
L(do_lt16): /* less than 16 ? */
cmplwi cr0,r5,0 /* copy remaining bytes (0-15) */
beqlr+ /* no rest to copy */
addi r4,r4,8
addi r6,r6,8
L(shortcopy): /* SIMPLE COPY to handle size =< 15 bytes */
mtcrf 0x01,r5
sub r7,r4,r6
bf- cr7*4+0,8f
lfdx fp9,r7,r6 /* copy 8 byte */
stfd fp9,0(r6)
addi r6,r6,8
8:
bf cr7*4+1,4f
lwzx r0,r7,r6 /* copy 4 byte */
stw r0,0(r6)
addi r6,r6,4
4:
bf cr7*4+2,2f
lhzx r0,r7,r6 /* copy 2 byte */
sth r0,0(r6)
addi r6,r6,2
2:
bf cr7*4+3,1f
lbzx r0,r7,r6 /* copy 1 byte */
stb r0,0(r6)
1:
blr
/* Similar to above, but for use with 128 byte lines. */
L(big_lines):
clrlwi r7,r7,32-7 /* How far to next cacheline bdy? */
cmplwi cr6,r7,0 /* Are we on a cacheline bdy already? */
/* Reduce total len by what it takes to get to the next cache line */
subf r5,r7,r5
srwi r7,r7,4 /* How many qw to get to the line bdy? */
/* How many full cache lines to copy after getting to a line bdy? */
srwi r10,r5,7
cmplwi r10,0 /* If no full cache lines to copy ... */
li r11,0 /* number cachelines to copy with prefetch */
beq L(nocacheprefetch_128)
/* We are here because we have at least one full cache line to copy,
and therefore some pre-touching to do. */
cmplwi r10,PREFETCH_AHEAD
li r12,128+8 /* prefetch distance */
ble L(lessthanmaxprefetch_128)
/* We can only do so much pre-fetching. R11 will have the count of
lines left to prefetch after the initial batch of prefetches
are executed. */
subi r11,r10,PREFETCH_AHEAD
li r10,PREFETCH_AHEAD
L(lessthanmaxprefetch_128):
mtctr r10
/* At this point r10/ctr hold the number of lines to prefetch in this
initial batch, and r11 holds any remainder. */
L(prefetchSRC_128):
dcbt r12,r4
addi r12,r12,128
bdnz L(prefetchSRC_128)
/* Prefetching is done, or was not needed.
cr6 - are we on a cacheline boundary already?
r7 - number of quadwords to the next cacheline boundary
*/
L(nocacheprefetch_128):
mtctr r7
cmplwi cr1,r5,128 /* Less than a cache line to copy? */
/* How many bytes are left after we copy whatever full
cache lines we can get? */
clrlwi r5,r5,32-7
beq cr6,L(cachelinealigned_128)
/* Copy quadwords up to the next cacheline boundary */
L(aligntocacheline_128):
lfd fp9,0x08(r4)
lfdu fp10,0x10(r4)
stfd fp9,0x08(r6)
stfdu fp10,0x10(r6)
bdnz L(aligntocacheline_128)
L(cachelinealigned_128): /* copy while cache lines */
blt- cr1,L(lessthancacheline) /* size <128 */
L(outerloop_128):
cmpwi r11,0
mtctr r11
beq- L(endloop_128)
li r11,128*ZERO_AHEAD +8 /* DCBZ dist */
.align 4
/* Copy whole cachelines, optimized by prefetching SRC cacheline */
L(loop_128): /* Copy aligned body */
dcbt r12,r4 /* PREFETCH SOURCE some cache lines ahead */
lfd fp9, 0x08(r4)
dcbz r11,r6
lfd fp10, 0x10(r4)
lfd fp11, 0x18(r4)
lfd fp12, 0x20(r4)
stfd fp9, 0x08(r6)
stfd fp10, 0x10(r6)
stfd fp11, 0x18(r6)
stfd fp12, 0x20(r6)
lfd fp9, 0x28(r4)
lfd fp10, 0x30(r4)
lfd fp11, 0x38(r4)
lfd fp12, 0x40(r4)
stfd fp9, 0x28(r6)
stfd fp10, 0x30(r6)
stfd fp11, 0x38(r6)
stfd fp12, 0x40(r6)
lfd fp9, 0x48(r4)
lfd fp10, 0x50(r4)
lfd fp11, 0x58(r4)
lfd fp12, 0x60(r4)
stfd fp9, 0x48(r6)
stfd fp10, 0x50(r6)
stfd fp11, 0x58(r6)
stfd fp12, 0x60(r6)
lfd fp9, 0x68(r4)
lfd fp10, 0x70(r4)
lfd fp11, 0x78(r4)
lfdu fp12, 0x80(r4)
stfd fp9, 0x68(r6)
stfd fp10, 0x70(r6)
stfd fp11, 0x78(r6)
stfdu fp12, 0x80(r6)
bdnz L(loop_128)
L(endloop_128):
cmpwi r10,0
beq- L(endloop2_128)
mtctr r10
L(loop2_128): /* Copy aligned body */
lfd fp9, 0x08(r4)
lfd fp10, 0x10(r4)
lfd fp11, 0x18(r4)
lfd fp12, 0x20(r4)
stfd fp9, 0x08(r6)
stfd fp10, 0x10(r6)
stfd fp11, 0x18(r6)
stfd fp12, 0x20(r6)
lfd fp9, 0x28(r4)
lfd fp10, 0x30(r4)
lfd fp11, 0x38(r4)
lfd fp12, 0x40(r4)
stfd fp9, 0x28(r6)
stfd fp10, 0x30(r6)
stfd fp11, 0x38(r6)
stfd fp12, 0x40(r6)
lfd fp9, 0x48(r4)
lfd fp10, 0x50(r4)
lfd fp11, 0x58(r4)
lfd fp12, 0x60(r4)
stfd fp9, 0x48(r6)
stfd fp10, 0x50(r6)
stfd fp11, 0x58(r6)
stfd fp12, 0x60(r6)
lfd fp9, 0x68(r4)
lfd fp10, 0x70(r4)
lfd fp11, 0x78(r4)
lfdu fp12, 0x80(r4)
stfd fp9, 0x68(r6)
stfd fp10, 0x70(r6)
stfd fp11, 0x78(r6)
stfdu fp12, 0x80(r6)
bdnz L(loop2_128)
L(endloop2_128):
b L(lessthancacheline)
END (BP_SYM (memcpy))
libc_hidden_builtin_def (memcpy)
+5
View File
@@ -0,0 +1,5 @@
#include <math_ldbl_opt.h>
#include <sysdeps/powerpc/fpu/s_fma.S>
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
compat_symbol (libm, __fma, fmal, GLIBC_2_1)
#endif
@@ -0,0 +1,80 @@
/* Round to int floating-point values. PowerPC32 version.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
02110-1301 USA. */
/* This has been coded in assembler because GCC makes such a mess of it
when it's coded in C. */
#include <sysdep.h>
#include <math_ldbl_opt.h>
/* double [fp1] nearbyint(double [fp1] x) */
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0: /* 2**52 */
.long 0x59800000 /* TWO52: 2**52 */
.section ".text"
ENTRY (__nearbyint)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
bcl 20,31,1f
1: mflr r9
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
cfi_same_value (lr)
#else
lis r9,.LC0@ha
lfs fp13,.LC0@l(r9)
#endif
fabs fp0,fp1
fsub fp12,fp13,fp13 /* generate 0.0 */
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */
bgelr cr7
fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
ble cr7,L(lessthanzero)
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
fadd fp0,fp1,fp13 /* x += TWO52 */
fsub fp1,fp0,fp13 /* x -= TWO52 */
fabs fp1,fp1 /* if (x == 0.0 */
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
blr
L(lessthanzero):
bgelr cr7
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
fsub fp0,fp13,fp1 /* x -= TWO52 */
fsub fp0,fp0,fp13 /* x += TWO52 */
fneg fp1,fp0 /* if (x == 0.0) */
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
blr
END (__nearbyint)
weak_alias (__nearbyint, nearbyint)
#ifdef NO_LONG_DOUBLE
weak_alias (__nearbyint, nearbyintl)
strong_alias (__nearbyint, __nearbyintl)
#endif
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0)
#endif
@@ -0,0 +1,70 @@
/* Round to int floating-point values. PowerPC32 version.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
02110-1301 USA. */
/* This has been coded in assembler because GCC makes such a mess of it
when it's coded in C. */
#include <sysdep.h>
/* float [fp1] nearbyintf(float [fp1] x) */
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0:
.long 0x4B000000 /* TWO23: 2**23 */
.section ".text"
ENTRY (__nearbyintf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
bcl 20,31,1f
1: mflr r9
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
cfi_same_value (lr)
#else
lis r9,.LC0@ha
lfs fp13,.LC0@l(r9)
#endif
fabs fp0,fp1
fsub fp12,fp13,fp13 /* generate 0.0 */
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */
bgelr cr7
fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
ble cr7,L(lessthanzero)
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
fadds fp0,fp1,fp13 /* x += TWO23 */
fsubs fp1,fp0,fp13 /* x -= TWO23 */
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
blr
L(lessthanzero):
bgelr cr7
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
fsubs fp0,fp13,fp1 /* x -= TWO23 */
fsubs fp0,fp0,fp13 /* x += TWO23 */
fneg fp1,fp0 /* if (x == 0.0) */
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
blr
END (__nearbyintf)
weak_alias (__nearbyintf, nearbyintf)
+1 -1
View File
@@ -646,7 +646,7 @@ L(Wunaligned):
cfi_offset(r25,(24-64))
andi. rBITDIF, rN, 12 /* Get the W remainder */
stw r24,20(r1)
cfi_offset(r24,(24-64))
cfi_offset(r24,(20-64))
slwi rSHL, rSHL, 3
lwz rWORD6, 0(rSTR2)
lwzu rWORD8, 4(rSTR2)
+6 -5
View File
@@ -1,5 +1,5 @@
/* Optimized strcmp implementation for PowerPC32.
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -139,30 +139,31 @@ L(u1):
bdz L(u4)
cmpw rWORD1, rWORD2
beq- cr1, L(u4)
bne- L(u4)
lbzu rWORD3, 1(rSTR1)
lbzu rWORD4, 1(rSTR2)
bne- L(u4)
cmpwi cr1, rWORD3, 0
bdz L(u3)
cmpw rWORD3, rWORD4
beq- cr1, L(u3)
bne- L(u3)
lbzu rWORD1, 1(rSTR1)
lbzu rWORD2, 1(rSTR2)
bne- L(u3)
cmpwi cr1, rWORD1, 0
bdz L(u4)
cmpw rWORD1, rWORD2
beq- cr1, L(u4)
bne- L(u4)
lbzu rWORD3, 1(rSTR1)
lbzu rWORD4, 1(rSTR2)
bne- L(u4)
cmpwi cr1, rWORD3, 0
bdz L(u3)
cmpw rWORD3, rWORD4
beq- cr1, L(u3)
bne- L(u3)
lbzu rWORD1, 1(rSTR1)
lbzu rWORD2, 1(rSTR2)
beq+ L(u1)
b L(u1)
L(u3): sub rRTN, rWORD3, rWORD4
blr
+2 -1
View File
@@ -1 +1,2 @@
powerpc/powerpc32/power4
powerpc/powerpc32/power5/fpu
powerpc/powerpc32/power5
+1
View File
@@ -1 +1,2 @@
powerpc/powerpc32/power4/fpu
powerpc/powerpc32/power4
@@ -1 +0,0 @@
powerpc/powerpc32/power4/fpu
+1 -1
View File
@@ -1,2 +1,2 @@
powerpc/powerpc32/power5+/fpu
powerpc/powerpc32/power5+
powerpc/powerpc32/power4
@@ -0,0 +1,56 @@
/* copysign(). PowerPC32/POWER6 version.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <math_ldbl_opt.h>
/* double [f1] copysign (double [f1] x, double [f2] y);
copysign(x,y) returns a value with the magnitude of x and
with the sign bit of y. */
.section ".text"
.type __copysign, @function
.machine power6
EALIGN (__copysign, 4, 0)
CALL_MCOUNT
fcpsgn fp1,fp2,fp1
blr
END (__copysign)
hidden_def (__copysign)
weak_alias (__copysign, copysign)
/* It turns out that the 'double' version will also always work for
single-precision. */
strong_alias (__copysign, __copysignf)
hidden_def (__copysignf)
weak_alias (__copysignf, copysignf)
#ifdef NO_LONG_DOUBLE
strong_alias (__copysign, __copysignl)
weak_alias (__copysign, copysignl)
#endif
#ifndef IS_IN_libm
# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
compat_symbol (libc, __copysign, __copysignl, GLIBC_2_0);
compat_symbol (libc, copysign, copysignl, GLIBC_2_0);
# endif
#endif

Some files were not shown because too many files have changed in this diff Show More