Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2004-12-22  Steven Munroe  <sjmunroe@us.ibm.com>

	* math/libm-test.inc (rint_test_tonearest): New test.
	(rint_test_towardzero): New test.
	(rint_test_downward): New test.
	(rint_test_upward): New test.
	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Fix -0.0 case.
	Remove redundant const values.
	* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Fix -0.0 case.
	Remove redundant const values.  Use float const.
	* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Fix -0.0 case.
	* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Fix -0.0 case.
	Use float const.
	* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Fix -0.0 case.
	* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Fix -0.0 case.
	Use float const.
	* sysdeps/powerpc/powerpc32/fpu/s_round.S: Fix -0.0 case.
	Remove redundant const values.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Fix -0.0 case.
	Remove redundant const values.  Use float const.
	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Fix -0.0 case.
	Remove redundant const values.
	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Fix -0.0 case.
	Remove redundant const values.  Use float const.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Remove redundant const values.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Remove redundant const values.
	Use float const.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Use float const.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Use float const.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Remove redundant const values.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Remove redundant const values.
	Use float const.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Use EALIGN for Quadword
	alignment.  Fix -0.0 case.  Remove redundant const values.
	Use float const.
  • Loading branch information
Ulrich Drepper committed Jan 6, 2005
1 parent 0476597 commit 4d37c8a
Show file tree
Hide file tree
Showing 24 changed files with 351 additions and 268 deletions.
48 changes: 48 additions & 0 deletions ChangeLog
@@ -1,3 +1,51 @@
2004-12-22 Steven Munroe <sjmunroe@us.ibm.com>

* math/libm-test.inc (rint_test_tonearest): New test.
(rint_test_towardzero): New test.
(rint_test_downward): New test.
(rint_test_upward): New test.
* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Fix -0.0 case.
Remove redundant const values.
* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Fix -0.0 case.
Remove redundant const values. Use float const.
* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Fix -0.0 case.
* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Fix -0.0 case.
Use float const.
* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Fix -0.0 case.
* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Fix -0.0 case.
Use float const.
* sysdeps/powerpc/powerpc32/fpu/s_round.S: Fix -0.0 case.
Remove redundant const values.
* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Fix -0.0 case.
Remove redundant const values. Use float const.
* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Fix -0.0 case.
Remove redundant const values.
* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Fix -0.0 case.
Remove redundant const values. Use float const.
* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Remove redundant const values.
* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Remove redundant const values.
Use float const.
* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Use EALIGN for Quadword
alignment. Fix -0.0 case.
* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Use float const.
* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Use EALIGN for Quadword
alignment. Fix -0.0 case.
* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Use float const.
* sysdeps/powerpc/powerpc64/fpu/s_round.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Remove redundant const values.
* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Remove redundant const values.
Use float const.
* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Use EALIGN for Quadword
alignment. Fix -0.0 case.
* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Use EALIGN for Quadword
alignment. Fix -0.0 case. Remove redundant const values.
Use float const.

2005-01-06 Ulrich Drepper <drepper@redhat.com>

* misc/sys/cdefs.h: Define __wur.
Expand Down
20 changes: 20 additions & 0 deletions WUR-REPORT
Expand Up @@ -23,3 +23,23 @@ fseek: see lseek
fseeko: likewise
fgetpos: similarly
fsetpos: likewise


<stdlib.h>:

atext: it is guaranteed that a certain number of handlers can be
registered, so some calls might need not be checked
on_exit: same
random functions: one might want to discard a number of results. In any
case, no security problem


putenv: probably SHOULD be marked, but we'll wait a bit.
setenv: likewise
unsetenv: likewise
clearenv: likewise

mbstowcs: probably SHOULD be marked
wcstombs: likewise

ptsname_r: probably SHOULD be marked
112 changes: 112 additions & 0 deletions math/libm-test.inc
Expand Up @@ -3794,6 +3794,114 @@ rint_test (void)
END (rint);
}

static void
rint_test_tonearest (void)
{
int save_round_mode;
START (rint_tonearest);

save_round_mode = fegetround();

if (!fesetround (FE_TONEAREST))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 2.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -2.0);
TEST_f_f (rint, -2.0, -2.0);
}

fesetround(save_round_mode);

END (rint_tonearest);
}

static void
rint_test_towardzero (void)
{
int save_round_mode;
START (rint_towardzero);

save_round_mode = fegetround();

if (!fesetround (FE_TOWARDZERO))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 1.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -1.0);
TEST_f_f (rint, -2.0, -2.0);
}

fesetround(save_round_mode);

END (rint_towardzero);
}

static void
rint_test_downward (void)
{
int save_round_mode;
START (rint_downward);

save_round_mode = fegetround();

if (!fesetround (FE_DOWNWARD))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 1.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -1.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -2.0);
TEST_f_f (rint, -2.0, -2.0);
}

fesetround(save_round_mode);

END (rint_downward);
}

static void
rint_test_upward (void)
{
int save_round_mode;
START (rint_upward);

save_round_mode = fegetround();

if (!fesetround (FE_UPWARD))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 2.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 1.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -1.0);
TEST_f_f (rint, -2.0, -2.0);
}

fesetround(save_round_mode);

END (rint_upward);
}

static void
round_test (void)
{
Expand Down Expand Up @@ -4557,6 +4665,10 @@ main (int argc, char **argv)
floor_test ();
nearbyint_test ();
rint_test ();
rint_test_tonearest ();
rint_test_towardzero ();
rint_test_downward ();
rint_test_upward ();
lrint_test ();
llrint_test ();
round_test ();
Expand Down
1 change: 0 additions & 1 deletion posix/unistd.h
Expand Up @@ -283,7 +283,6 @@ extern int euidaccess (__const char *__name, int __type)
the current position (if WHENCE is SEEK_CUR),
or the end of the file (if WHENCE is SEEK_END).
Return the new file position. */
// XXX Probably should be __wur but lseek(fd,
#ifndef __USE_FILE_OFFSET64
extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
#else
Expand Down
27 changes: 5 additions & 22 deletions sysdeps/powerpc/powerpc32/fpu/s_ceil.S
Expand Up @@ -26,20 +26,12 @@
TWO52.0:
.long 0x43300000
.long 0
.type NEGZERO.0,@object
.size NEGZERO.0,8
NEGZERO.0:
.long 0x80000000
.long 0

.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC0: /* 2**52 */
.long 0x43300000
.long 0
.LC1: /* -0.0 */
.long 0x80000000
.long 0

.section ".text"
ENTRY (__ceil)
Expand All @@ -64,27 +56,18 @@ ENTRY (__ceil)
ble- cr6,.L4
fadd fp1,fp1,fp13 /* x+= TWO52; */
fsub fp1,fp1,fp13 /* x-= TWO52; */
.L9:
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
fsub fp1,fp1,fp13 /* x-= TWO52; */
fadd fp1,fp1,fp13 /* x+= TWO52; */
fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
fnabs fp1,fp1 /* if (x == 0.0) */
/* x = -0.0; */
.L9:
mtfsf 0x01,fp11 /* restore previous rounding mode. */
bnelr+ cr5
#ifdef SHARED
mflr r11
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r10
lwz r9,.LC1@got(10)
mtlr r11
lfd fp1,0(r9)
#else
lis r9,.LC1@ha
lfd fp1,.LC1@l(r9)
#endif
blr
END (__ceil)

Expand Down
49 changes: 15 additions & 34 deletions sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
Expand Up @@ -20,26 +20,16 @@
#include <sysdep.h>

.section .rodata
.align 3
.type TWO52.0,@object
.size TWO52.0,8
TWO52.0:
.long 0x43300000
.long 0
.type NEGZERO.0,@object
.size NEGZERO.0,8
NEGZERO.0:
.long 0x80000000
.long 0
.align 2
.type TWO23.0,@object
.size TWO23.0,4
TWO23.0:
.long 0x4b000000

.section .rodata.cst8,"aM",@progbits,8
.align 3
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0: /* 2**23 */
.long 0x41600000
.long 0
.LC1: /* -0.0 */
.long 0x80000000
.long 0
.long 0x4b000000

.section ".text"
ENTRY (__ceilf)
Expand All @@ -50,10 +40,10 @@ ENTRY (__ceilf)
mflr r10
lwz r9,.LC0@got(10)
mtlr r11
lfd fp13,0(r9)
lfs fp13,0(r9)
#else
lis r9,.LC0@ha
lfd fp13,.LC0@l(r9)
lfs fp13,.LC0@l(r9)
#endif
fabs fp0,fp1
fsubs fp12,fp13,fp13 /* generate 0.0 */
Expand All @@ -64,27 +54,18 @@ ENTRY (__ceilf)
ble- cr6,.L4
fadds fp1,fp1,fp13 /* x+= TWO23; */
fsubs fp1,fp1,fp13 /* x-= TWO23; */
.L9:
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
fsubs fp1,fp1,fp13 /* x-= TWO23; */
fadds fp1,fp1,fp13 /* x+= TWO23; */
fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
fnabs fp1,fp1 /* if (x == 0.0) */
/* x = -0.0; */
.L9:
mtfsf 0x01,fp11 /* restore previous rounding mode. */
bnelr+ cr5
#ifdef SHARED
mflr r11
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r10
lwz r9,.LC1@got(10)
mtlr r11
lfd fp1,0(r9)
#else
lis r9,.LC1@ha
lfd fp1,.LC1@l(r9)
#endif
blr
END (__ceilf)

Expand Down
7 changes: 4 additions & 3 deletions sysdeps/powerpc/powerpc32/fpu/s_floor.S
Expand Up @@ -56,15 +56,16 @@ ENTRY (__floor)
ble- cr6,.L4
fadd fp1,fp1,fp13 /* x+= TWO52; */
fsub fp1,fp1,fp13 /* x-= TWO52; */
fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
mtfsf 0x01,fp11 /* restore previous rounding mode. */
bnelr+ cr5
fmr fp1,fp12 /* x must be +0.0 for the 0.0 case. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
fsub fp1,fp1,fp13 /* x-= TWO52; */
fadd fp1,fp1,fp13 /* x+= TWO52; */
fnabs fp1,fp1 /* if (x == 0.0) */
/* x = -0.0; */
.L9:
mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
Expand Down

0 comments on commit 4d37c8a

Please sign in to comment.