diff options
Diffstat (limited to 'sysdeps')
33 files changed, 532 insertions, 121 deletions
diff --git a/sysdeps/generic/sigset.h b/sysdeps/generic/sigset.h index 6f4ea0e5a8..9fad4538d7 100644 --- a/sysdeps/generic/sigset.h +++ b/sysdeps/generic/sigset.h @@ -51,9 +51,9 @@ typedef unsigned long int __sigset_t; #ifdef _GNU_SOURCE # define __sigisemptyset(set) (*(set) == (__sigset_t) 0) # define __sigandset(dest, left, right) \ - ((*(set) = (*(left) & *(right))), 0) + ((*(dest) = (*(left) & *(right))), 0) # define __sigorset(dest, left, right) \ - ((*(set) = (*(left) | *(right))), 0) + ((*(dest) = (*(left) | *(right))), 0) #endif /* These functions needn't check for a bogus signal number -- error diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index f6b28444a3..7b3336588d 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -55,14 +55,14 @@ static inline Elf32_Addr __attribute__ ((unused)) elf_machine_load_address (void) { Elf32_Addr addr; - asm (" call here\n" - "here: popl %0\n" - " subl $here, %0" + asm (" call .Lhere\n" + ".Lhere: popl %0\n" + " subl $.Lhere, %0" : "=r" (addr)); return addr; } /* The `subl' insn above will contain an R_386_32 relocation entry - intended to insert the run-time address of the label `here'. + intended to insert the run-time address of the label `.Lhere'. This will be the first relocation in the text of the dynamic linker; we skip it to avoid trying to modify read-only text in this early stage. */ #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ diff --git a/sysdeps/libm-i387/e_pow.S b/sysdeps/libm-i387/e_pow.S index e665326438..45c41b48ab 100644 --- a/sysdeps/libm-i387/e_pow.S +++ b/sysdeps/libm-i387/e_pow.S @@ -48,9 +48,6 @@ one: .double 1.0 ASM_TYPE_DIRECTIVE(limit,@object) limit: .double 0.29 ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(nan,@object) -nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - ASM_SIZE_DIRECTIVE(nan) #ifdef PIC #define MO(op) op##@GOTOFF(%ecx) @@ -191,8 +188,8 @@ ENTRY(__ieee754_pow) ret .align ALIGNARG(4) -14: fldl MO(nan) - faddl MO(zero) // raise invalid exception +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception ret .align ALIGNARG(4) diff --git a/sysdeps/libm-i387/e_powf.S b/sysdeps/libm-i387/e_powf.S index 102cd4e3af..d7342bf56f 100644 --- a/sysdeps/libm-i387/e_powf.S +++ b/sysdeps/libm-i387/e_powf.S @@ -48,9 +48,6 @@ one: .double 1.0 ASM_TYPE_DIRECTIVE(limit,@object) limit: .double 0.29 ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(nan,@object) -nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - ASM_SIZE_DIRECTIVE(nan) #ifdef PIC #define MO(op) op##@GOTOFF(%ecx) @@ -187,8 +184,8 @@ ENTRY(__ieee754_powf) ret .align ALIGNARG(4) -14: fldl MO(nan) - faddl MO(zero) // raise invalid exception +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception ret .align ALIGNARG(4) diff --git a/sysdeps/libm-i387/e_powl.S b/sysdeps/libm-i387/e_powl.S index dba725aa77..0ea4829822 100644 --- a/sysdeps/libm-i387/e_powl.S +++ b/sysdeps/libm-i387/e_powl.S @@ -48,9 +48,6 @@ one: .double 1.0 ASM_TYPE_DIRECTIVE(limit,@object) limit: .double 0.29 ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(nan,@object) -nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - ASM_SIZE_DIRECTIVE(nan) #ifdef PIC #define MO(op) op##@GOTOFF(%ecx) @@ -191,8 +188,8 @@ ENTRY(__ieee754_powl) ret .align ALIGNARG(4) -14: fldl MO(nan) - faddl MO(zero) // raise invalid exception +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception ret .align ALIGNARG(4) diff --git a/sysdeps/libm-i387/s_cexp.S b/sysdeps/libm-i387/s_cexp.S index 48e002b2f6..5630d3cb65 100644 --- a/sysdeps/libm-i387/s_cexp.S +++ b/sysdeps/libm-i387/s_cexp.S @@ -31,7 +31,8 @@ huge_nan_null_null: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f .double 0.0 - .double 0.0 +zero: .double 0.0 +infinity: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f .double 0.0 @@ -90,7 +91,7 @@ ENTRY(__cexp) Check your FPU manual for more information. */ andb $0x01, %ah cmpb $0x01, %ah - je 2f + je 20f /* We have finite numbers in the real and imaginary part. Do the real work now. */ @@ -139,9 +140,8 @@ ENTRY(__cexp) 1: fxam /* y : x */ fnstsw movb %ah, %dl - andb $0x01, %ah /* See above why 0x01 is usable here. */ - cmpb $0x01, %ah - je 3f + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f /* The real part is +-Inf and the imaginary part is finite. */ @@ -220,7 +220,14 @@ ENTRY(__cexp) .align ALIGNARG(4) 3: fstp %st(0) fstp %st(0) /* <empty> */ - movl %edx, %eax + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +30: movl %edx, %eax shrl $5, %edx shll $4, %eax andl $16, %edx @@ -236,6 +243,9 @@ ENTRY(__cexp) /* The real part is NaN. */ .align ALIGNARG(4) +20: fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) 2: fstp %st(0) fstp %st(0) movl 4(%esp), %eax /* Pointer to memory for result. */ diff --git a/sysdeps/libm-i387/s_cexpf.S b/sysdeps/libm-i387/s_cexpf.S index 6fd414b045..d6dcebcb23 100644 --- a/sysdeps/libm-i387/s_cexpf.S +++ b/sysdeps/libm-i387/s_cexpf.S @@ -31,7 +31,8 @@ huge_nan_null_null: .byte 0, 0, 0x80, 0x7f .byte 0, 0, 0xc0, 0x7f .float 0.0 - .float 0.0 +zero: .float 0.0 +infinity: .byte 0, 0, 0x80, 0x7f .byte 0, 0, 0xc0, 0x7f .float 0.0 @@ -90,7 +91,7 @@ ENTRY(__cexpf) Check your FPU manual for more information. */ andb $0x01, %ah cmpb $0x01, %ah - je 2f + je 20f /* We have finite numbers in the real and imaginary part. Do the real work now. */ @@ -143,9 +144,8 @@ ENTRY(__cexpf) 1: fxam /* y : x */ fnstsw movb %ah, %dl - andb $0x01, %ah /* See above why 0x01 is usable here. */ - cmpb $0x01, %ah - je 3f + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f /* The real part is +-Inf and the imaginary part is finite. */ @@ -222,7 +222,14 @@ ENTRY(__cexpf) .align ALIGNARG(4) 3: fstp %st(0) fstp %st(0) /* <empty> */ - movl %edx, %eax + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + flds MO(infinity) /* Raise invalid exception. */ + fmuls MO(zero) + fstp %st(0) +30: movl %edx, %eax shrl $6, %edx shll $3, %eax andl $8, %edx @@ -235,6 +242,9 @@ ENTRY(__cexpf) /* The real part is NaN. */ .align ALIGNARG(4) +20: flds MO(infinity) /* Raise invalid exception. */ + fmuls MO(zero) + fstp %st(0) 2: fstp %st(0) fstp %st(0) movl MO(huge_nan_null_null+4), %eax diff --git a/sysdeps/libm-i387/s_cexpl.S b/sysdeps/libm-i387/s_cexpl.S index fa31e74162..11c05c52e6 100644 --- a/sysdeps/libm-i387/s_cexpl.S +++ b/sysdeps/libm-i387/s_cexpl.S @@ -31,7 +31,8 @@ huge_nan_null_null: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f .double 0.0 - .double 0.0 +zero: .double 0.0 +infinity: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f .double 0.0 @@ -90,7 +91,7 @@ ENTRY(__cexpl) Check your FPU manual for more information. */ andb $0x01, %ah cmpb $0x01, %ah - je 2f + je 20f /* We have finite numbers in the real and imaginary part. Do the real work now. */ @@ -139,9 +140,8 @@ ENTRY(__cexpl) 1: fxam /* y : x */ fnstsw movb %ah, %dl - andb $0x01, %ah /* See above why 0x01 is usable here. */ - cmpb $0x01, %ah - je 3f + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f /* The real part is +-Inf and the imaginary part is finite. */ @@ -220,7 +220,14 @@ ENTRY(__cexpl) .align ALIGNARG(4) 3: fstp %st(0) fstp %st(0) /* <empty> */ - movl %edx, %eax + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +30: movl %edx, %eax shrl $5, %edx shll $4, %eax andl $16, %edx @@ -236,6 +243,9 @@ ENTRY(__cexpl) /* The real part is NaN. */ .align ALIGNARG(4) +20: fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) 2: fstp %st(0) fstp %st(0) movl 4(%esp), %eax /* Pointer to memory for result. */ diff --git a/sysdeps/libm-ieee754/s_ccos.c b/sysdeps/libm-ieee754/s_ccos.c index 8a4b55dd99..f8dfcc8af6 100644 --- a/sysdeps/libm-ieee754/s_ccos.c +++ b/sysdeps/libm-ieee754/s_ccos.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> @@ -33,16 +34,31 @@ __ccos (__complex__ double x) { __real__ res = __nan (""); __imag__ res = 0.0; + +#ifdef FE_INVALID + if (__isinf (__real__ x)) + feraiseexcept (FE_INVALID); +#endif } else if (__isinf (__imag__ x)) { __real__ res = HUGE_VAL; __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (__isinf (__real__ x)) + feraiseexcept (FE_INVALID); +#endif } else { __real__ res = __nan (""); __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (isfinite (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif } } else diff --git a/sysdeps/libm-ieee754/s_ccosf.c b/sysdeps/libm-ieee754/s_ccosf.c index 9d1a97239c..b090ae5747 100644 --- a/sysdeps/libm-ieee754/s_ccosf.c +++ b/sysdeps/libm-ieee754/s_ccosf.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> @@ -33,16 +34,31 @@ __ccosf (__complex__ float x) { __real__ res = __nanf (""); __imag__ res = 0.0; + +#ifdef FE_INVALID + if (__isinff (__real__ x)) + feraiseexcept (FE_INVALID); +#endif } else if (__isinff (__imag__ x)) { __real__ res = HUGE_VALF; __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (__isinff (__real__ x)) + feraiseexcept (FE_INVALID); +#endif } else { __real__ res = __nanf (""); __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (isfinite (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif } } else diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c index fa958f491b..1e92f03771 100644 --- a/sysdeps/libm-ieee754/s_ccosh.c +++ b/sysdeps/libm-ieee754/s_ccosh.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> #include "math_private.h" @@ -39,18 +40,24 @@ __ccosh (__complex__ double x) if (icls >= FP_ZERO) { /* Imaginary part is finite. */ + double sinh_val = __ieee754_sinh (__real__ x); double cosh_val = __ieee754_cosh (__real__ x); double sinix, cosix; __sincos (__imag__ x, &sinix, &cosix); __real__ retval = cosh_val * cosix; - __imag__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * sinix; } else { __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); __real__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else if (rcls == FP_INFINITE) @@ -77,6 +84,11 @@ __ccosh (__complex__ double x) /* The addition raises the invalid exception. */ __real__ retval = HUGE_VAL; __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c index aeeacbaed0..573a63367b 100644 --- a/sysdeps/libm-ieee754/s_ccoshf.c +++ b/sysdeps/libm-ieee754/s_ccoshf.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> #include "math_private.h" @@ -39,18 +40,24 @@ __ccoshf (__complex__ float x) if (icls >= FP_ZERO) { /* Imaginary part is finite. */ + float sinh_val = __ieee754_sinhf (__real__ x); float cosh_val = __ieee754_coshf (__real__ x); float sinix, cosix; __sincosf (__imag__ x, &sinix, &cosix); __real__ retval = cosh_val * cosix; - __imag__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * sinix; } else { __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf (""); - __real__ retval = __nanf ("") + __nanf (""); + __real__ retval = __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else if (rcls == FP_INFINITE) @@ -77,6 +84,11 @@ __ccoshf (__complex__ float x) /* The addition raises the invalid exception. */ __real__ retval = HUGE_VALF; __imag__ retval = __nanf ("") + __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c index 9937ba1904..feb1351917 100644 --- a/sysdeps/libm-ieee754/s_ccoshl.c +++ b/sysdeps/libm-ieee754/s_ccoshl.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> #include "math_private.h" @@ -39,18 +40,24 @@ __ccoshl (__complex__ long double x) if (icls >= FP_ZERO) { /* Imaginary part is finite. */ + long double sinh_val = __ieee754_sinhl (__real__ x); long double cosh_val = __ieee754_coshl (__real__ x); long double sinix, cosix; __sincosl (__imag__ x, &sinix, &cosix); __real__ retval = cosh_val * cosix; - __imag__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * sinix; } else { __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl (""); __real__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else if (rcls == FP_INFINITE) @@ -77,6 +84,11 @@ __ccoshl (__complex__ long double x) /* The addition raises the invalid exception. */ __real__ retval = HUGE_VALL; __imag__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } |
