From 8c0247db324000ab1281b3091ab4cdfd167a1c52 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 15 Mar 2012 17:23:43 +0100 Subject: [BZ #13852] * sysdeps/i386/fpu/e_rem_pio2f.c: Delete so that i386 uses the ieee754/flt-32 implementation. * sysdeps/i386/fpu/k_rem_pio2f.c: Likewise. * sysdeps/i386/fpu/s_cosf.S: Likewise. * sysdeps/i386/fpu/s_sincosf.S: Likewise. * sysdeps/i386/fpu/s_sinf.S: Likewise. * math/libm-test.inc (cos_test): Enable some large input tests for float as well (sin_test): Likewise. (sincos_test): Likewise. * sysdeps/i386/fpu/libm-test-ulps: Update. --- math/libm-test.inc | 24 ++++++++++++---- sysdeps/i386/fpu/e_rem_pio2f.c | 3 -- sysdeps/i386/fpu/k_rem_pio2f.c | 3 -- sysdeps/i386/fpu/libm-test-ulps | 49 +++++++++++++++++++++++++++++-- sysdeps/i386/fpu/s_cosf.S | 54 ---------------------------------- sysdeps/i386/fpu/s_sincosf.S | 64 ----------------------------------------- sysdeps/i386/fpu/s_sinf.S | 54 ---------------------------------- 7 files changed, 65 insertions(+), 186 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_rem_pio2f.c delete mode 100644 sysdeps/i386/fpu/k_rem_pio2f.c delete mode 100644 sysdeps/i386/fpu/s_cosf.S delete mode 100644 sysdeps/i386/fpu/s_sincosf.S delete mode 100644 sysdeps/i386/fpu/s_sinf.S diff --git a/math/libm-test.inc b/math/libm-test.inc index 0337b60d65..760ec6b7ef 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -2112,11 +2112,15 @@ cos_test (void) TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L); +#ifndef TEST_LDOUBLE + /* Enable for long double once x86 and x86-64 implementation is fixed. */ + TEST_f_f (cos, 0x1p65, 0.998886220660580136106421721793L); + TEST_f_f (cos, -0x1p65, 0.998886220660580136106421721793L); +#endif + #ifdef TEST_DOUBLE TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473); TEST_f_f (cos, 1e22, 0.5232147853951389454975944733847); - TEST_f_f (cos, 0x1p65, 0.998886220660580136106421721793); - TEST_f_f (cos, -0x1p65, 0.998886220660580136106421721793); TEST_f_f (cos, 0x1p1023, -0.8263698346141479945007856808117); #endif @@ -6391,12 +6395,16 @@ sin_test (void) TEST_f_f (sin, -M_PI_2l, -1); TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L); +#ifndef TEST_LDOUBLE + /* Enable for long double once x86 and x86-64 implementation is fixed. */ + TEST_f_f (sin, 0x1p65, -0.0471838762123546738051061498057L); + TEST_f_f (sin, -0x1p65, 0.0471838762123546738051061498057L); +#endif + #ifdef TEST_DOUBLE TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868); TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1); TEST_f_f (sin, 1e22, -0.8522008497671888017727058937530); - TEST_f_f (sin, 0x1p65, -0.0471838762123546738051061498057); - TEST_f_f (sin, -0x1p65, 0.0471838762123546738051061498057); TEST_f_f (sin, 0x1p1023, 0.5631277798508840248814522055909); #endif @@ -6567,11 +6575,15 @@ sincos_test (void) TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5); TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L); +#ifndef TEST_LDOUBLE + /* Enable for long double once x86 and x86-64 implementation is fixed. */ + TEST_extra (sincos, 0x1p65, -0.0471838762123546738051061498057L, 0.998886220660580136106421721793L); + TEST_extra (sincos, -0x1p65, 0.0471838762123546738051061498057L, 0.998886220660580136106421721793L); +#endif + #ifdef TEST_DOUBLE TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473); TEST_extra (sincos, 1e22, -0.8522008497671888017727058937530, 0.5232147853951389454975944733847); - TEST_extra (sincos, 0x1p65, -0.0471838762123546738051061498057, 0.998886220660580136106421721793); - TEST_extra (sincos, -0x1p65, 0.0471838762123546738051061498057, 0.998886220660580136106421721793); TEST_extra (sincos, 0x1p1023, 0.5631277798508840248814522055909, -0.8263698346141479945007856808117); #endif diff --git a/sysdeps/i386/fpu/e_rem_pio2f.c b/sysdeps/i386/fpu/e_rem_pio2f.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/i386/fpu/e_rem_pio2f.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/k_rem_pio2f.c b/sysdeps/i386/fpu/k_rem_pio2f.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/i386/fpu/k_rem_pio2f.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 0d25d75c07..46caf8b6a1 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -559,7 +559,9 @@ ldouble: 1 # cos_downward Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": double: 1 +float: 2 idouble: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": @@ -567,6 +569,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "cos_downward (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": double: 1 idouble: 1 @@ -584,6 +589,8 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Test "cos_downward (9) == -0.9111302618846769883682947111811653112463": @@ -595,6 +602,9 @@ ildouble: 1 ldouble: 1 # cos_tonearest +Test "cos_tonearest (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 Test "cos_tonearest (8) == -0.1455000338086135258688413818311946826093": ildouble: 1 ldouble: 1 @@ -774,6 +784,9 @@ ildouble: 1 ldouble: 1 # csin +Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i": +float: 1 +ifloat: 1 Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": float: 1 ifloat: 1 @@ -1268,19 +1281,31 @@ idouble: 1 ildouble: 1 ldouble: 1 +# sin +Test "sin (-0x1p65) == 0.0471838762123546738051061498057": +float: 1 +ifloat: 1 +Test "sin (0x1p65) == -0.0471838762123546738051061498057": +float: 1 +ifloat: 1 + # sin_downward Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": ildouble: 1 ldouble: 1 Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Test "sin_downward (2) == 0.9092974268256816953960198659117448427023": double: 1 idouble: 1 Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": @@ -1315,6 +1340,9 @@ ildouble: 1 ldouble: 1 # sin_tonearest +Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 Test "sin_tonearest (10) == -0.5440211108893698134047476618513772816836": ildouble: 1 ldouble: 1 @@ -1399,8 +1427,17 @@ ifloat: 1 Test "sin_upward (8) == 0.9893582466233817778081235982452886721164": float: 1 ifloat: 1 +Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 # sincos +Test "sincos (-0x1p65, &sin_res, &cos_res) puts 0.0471838762123546738051061498057 in sin_res": +float: 1 +ifloat: 1 +Test "sincos (0x1p65, &sin_res, &cos_res) puts -0.0471838762123546738051061498057 in sin_res": +float: 1 +ifloat: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 float: 1 @@ -1986,13 +2023,15 @@ ldouble: 1 Function: "cos_downward": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Function: "cos_tonearest": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -2225,6 +2264,10 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "sin": +float: 1 +ifloat: 1 + Function: "sin_downward": double: 1 float: 1 @@ -2234,6 +2277,8 @@ ildouble: 1 ldouble: 1 Function: "sin_tonearest": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 diff --git a/sysdeps/i386/fpu/s_cosf.S b/sysdeps/i386/fpu/s_cosf.S deleted file mode 100644 index 578967ad3c..0000000000 --- a/sysdeps/i386/fpu/s_cosf.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Written by J.T. Conklin . - * Fixed errno handling by Ulrich Drepper . - * Public domain. - */ - -#define __need_Emath -#include -#include - -RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $") - -ENTRY(__cosf) - flds 4(%esp) - fxam - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 3f -4: fcos - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos - ret -3: -#ifdef PIC - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) - LOAD_PIC_REG (bx) - call __errno_location@PLT - movl $EDOM, (%eax) - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#else - call __errno_location@PLT - movl $EDOM, (%eax) -#endif - jmp 4b -END (__cosf) -weak_alias (__cosf, cosf) diff --git a/sysdeps/i386/fpu/s_sincosf.S b/sysdeps/i386/fpu/s_sincosf.S deleted file mode 100644 index 677c7c41f9..0000000000 --- a/sysdeps/i386/fpu/s_sincosf.S +++ /dev/null @@ -1,64 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define ANGLE PARMS -#define SINP ANGLE+4 -#define COSP SINP+PTR_SIZE - - .text -ENTRY (BP_SYM (__sincosf)) - ENTER - - flds ANGLE(%esp) - fsincos - movl SINP(%esp), %ecx - CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $4) - movl COSP(%esp), %edx - CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $4) - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstps (%edx) - fstps (%ecx) - - LEAVE - ret - - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstps (%edx) - fstps (%ecx) - - LEAVE - ret -END (BP_SYM (__sincosf)) -weak_alias (BP_SYM (__sincosf), BP_SYM (sincosf)) diff --git a/sysdeps/i386/fpu/s_sinf.S b/sysdeps/i386/fpu/s_sinf.S deleted file mode 100644 index 67621f70f2..0000000000 --- a/sysdeps/i386/fpu/s_sinf.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Written by J.T. Conklin . - * Fixed errno handling by Ulrich Drepper . - * Public domain. - */ - -#define __need_Emath -#include -#include - -RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $") - -ENTRY(__sinf) - flds 4(%esp) - fxam - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 3f -4: fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - ret -3: -#ifdef PIC - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) - LOAD_PIC_REG (bx) - call __errno_location@PLT - movl $EDOM, (%eax) - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#else - call __errno_location@PLT - movl $EDOM, (%eax) -#endif - jmp 4b -END (__sinf) -weak_alias (__sinf, sinf) -- cgit v1.2.3