Skip to content

Commit

Permalink
SH: No FE_UPWARD, FE_DOWNWARD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schwinge committed Jun 9, 2012
1 parent 366af02 commit 99ff6e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2012-06-09 Thomas Schwinge <thomas@codesourcery.com>

* sysdeps/sh/sh4/fpu/bits/fenv.h (__FE_UNDEFINED): Define.
(FE_UPWARD, FE_DOWNWARD): Don't define.
* sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Adapt to that.
* sysdeps/sh/sh4/fpu/fesetround.c (fesetround): Likewise.

* sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Do not re-write fpscr after
reading it.
* sysdeps/sh/sh4/fpu/fegetexcept.c (fegetexcept): Likewise.
Expand Down
14 changes: 6 additions & 8 deletions sysdeps/sh/sh4/fpu/bits/fenv.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1999-2012 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
Expand Down Expand Up @@ -39,19 +39,17 @@ enum
#define FE_ALL_EXCEPT \
(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)

/* The SH FPU supports all of the four defined rounding modes. We
use again the bit positions in the FPU control word as the values
for the appropriate macros. */
/* The SH FPU supports two of the four defined rounding modes: round to nearest
and round to zero. We use again the bit positions in the FPU control word
as the values for the appropriate macros. */
enum
{
__FE_UNDEFINED = -1,

FE_TONEAREST = 0x0,
#define FE_TONEAREST FE_TONEAREST
FE_TOWARDZERO = 0x1,
#define FE_TOWARDZERO FE_TOWARDZERO
FE_UPWARD = 0x2,
#define FE_UPWARD FE_UPWARD
FE_DOWNWARD = 0x3
#define FE_DOWNWARD FE_DOWNWARD
};


Expand Down
2 changes: 1 addition & 1 deletion sysdeps/sh/sh4/fpu/fegetround.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ fegetround (void)
/* Get control word. */
_FPU_GETCW (cw);

return cw & 0x3;
return cw & 0x1;
}
4 changes: 2 additions & 2 deletions sysdeps/sh/sh4/fpu/fesetround.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ fesetround (int round)
{
fpu_control_t cw;

if ((round & ~0x3) != 0)
if ((round & ~0x1) != 0)
/* ROUND is no valid rounding mode. */
return 1;

/* Get current state. */
_FPU_GETCW (cw);

/* Set rounding bits. */
cw &= ~0x3;
cw &= ~0x1;
cw |= round;
/* Set new state. */
_FPU_SETCW (cw);
Expand Down

0 comments on commit 99ff6e5

Please sign in to comment.