From 8db3cdefefe39e9d42b05b1610a63190e9f7fba4 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 18 Jun 2015 23:27:41 +0000 Subject: Fix asinh missing underflows (bug 16350). Similar to various other bugs in this area, some asinh implementations do not raise the underflow exception for subnormal arguments, when the result is tiny and inexact. This patch forces the exception in a similar way to previous fixes. Tested for x86_64, x86 and mips64. [BZ #16350] * sysdeps/i386/fpu/s_asinh.S (__asinh): Force underflow exception for arguments with small absolute value. * sysdeps/i386/fpu/s_asinhf.S (__asinhf): Likewise. * sysdeps/i386/fpu/s_asinhl.S (__asinhl): Likewise. * sysdeps/ieee754/dbl-64/s_asinh.c: Include . (__asinh): Force underflow exception for arguments with small absolute value. * sysdeps/ieee754/flt-32/s_asinhf.c: Include . (__asinhf): Force underflow exception for arguments with small absolute value. * sysdeps/ieee754/ldbl-128/s_asinhl.c: Include . (__asinhl): Force underflow exception for arguments with small absolute value. * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: Include . (__asinhl): Force underflow exception for arguments with small absolute value. * sysdeps/ieee754/ldbl-96/s_asinhl.c: Include . (__asinhl): Force underflow exception for arguments with small absolute value. * math/auto-libm-test-in: Do not mark underflow exceptions as possibly missing for bug 16350. * math/auto-libm-test-out: Regenerated. --- sysdeps/i386/fpu/s_asinh.S | 11 ++++++++++- sysdeps/i386/fpu/s_asinhf.S | 11 ++++++++++- sysdeps/i386/fpu/s_asinhl.S | 7 ++++++- 3 files changed, 26 insertions(+), 3 deletions(-) (limited to 'sysdeps/i386') diff --git a/sysdeps/i386/fpu/s_asinh.S b/sysdeps/i386/fpu/s_asinh.S index e4c0c676a6..7123772dee 100644 --- a/sysdeps/i386/fpu/s_asinh.S +++ b/sysdeps/i386/fpu/s_asinh.S @@ -100,7 +100,16 @@ ENTRY(__asinh) 4: fld %st // x : x faddl MO(huge) // huge+x : x fstp %st(0) // x - ret + cmpl $0x00100000, %eax + jae 8f + subl $8, %esp + cfi_adjust_cfa_offset (8) + fld %st(0) + fmul %st(0) + fstpl (%esp) + addl $8, %esp + cfi_adjust_cfa_offset (-8) +8: ret // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2)) .align ALIGNARG(4) diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S index b1a28e7ac1..77ebae46ec 100644 --- a/sysdeps/i386/fpu/s_asinhf.S +++ b/sysdeps/i386/fpu/s_asinhf.S @@ -100,7 +100,16 @@ ENTRY(__asinhf) 4: fld %st // x : x faddl MO(huge) // huge+x : x fstp %st(0) // x - ret + cmpl $0x00800000, %eax + jae 8f + subl $4, %esp + cfi_adjust_cfa_offset (4) + fld %st(0) + fmul %st(0) + fstps (%esp) + addl $4, %esp + cfi_adjust_cfa_offset (-4) +8: ret // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2)) .align ALIGNARG(4) diff --git a/sysdeps/i386/fpu/s_asinhl.S b/sysdeps/i386/fpu/s_asinhl.S index 6a5defed38..8799da6e53 100644 --- a/sysdeps/i386/fpu/s_asinhl.S +++ b/sysdeps/i386/fpu/s_asinhl.S @@ -108,7 +108,12 @@ ENTRY(__asinhl) fldt MO(huge) // huge : x : x faddp // huge+x : x fstp %st(0) // x - ret + cmpl $0x0001, %eax + jae 8f + fld %st(0) + fmul %st(0) + fstp %st(0) +8: ret // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2)) .align ALIGNARG(4) -- cgit 1.4.1