This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
On Tue, 29 May 2012 13:13:05 +0000, "Joseph S. Myers" <joseph@codesourcery.com> wrote:
> On Tue, 29 May 2012, Thomas Schwinge wrote:
>
> > As far as I can tell, glibc is currently prepared to handle either no
> > rounding modes, or all four -- but SH-4A apparently only supports two.
> > Or am I missing some information?
>
> It should support arbitrary subsets, though you may need to define
> __FE_UNDEFINED to an invalid mode as done on Tile for libm-test.inc to
> work.
Right. That one is very new and had not yet been present in the tree I
was testing in.
Does this look reasonable (please test):
diff --git a/sysdeps/sh/sh4/fpu/bits/fenv.h b/sysdeps/sh/sh4/fpu/bits/fenv.h
index 38c303f..25e6567 100644
--- a/sysdeps/sh/sh4/fpu/bits/fenv.h
+++ b/sysdeps/sh/sh4/fpu/bits/fenv.h
@@ -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
};
diff --git a/sysdeps/sh/sh4/fpu/fegetround.c b/sysdeps/sh/sh4/fpu/fegetround.c
index 7368383..adaeb8a 100644
--- a/sysdeps/sh/sh4/fpu/fegetround.c
+++ b/sysdeps/sh/sh4/fpu/fegetround.c
@@ -28,5 +28,5 @@ fegetround (void)
/* Get control word. */
_FPU_GETCW (cw);
- return cw & 0x3;
+ return cw & 0x1;
}
diff --git a/sysdeps/sh/sh4/fpu/fesetround.c b/sysdeps/sh/sh4/fpu/fesetround.c
index 4edf9c5..1dbc339 100644
--- a/sysdeps/sh/sh4/fpu/fesetround.c
+++ b/sysdeps/sh/sh4/fpu/fesetround.c
@@ -25,7 +25,7 @@ fesetround (int round)
{
fpu_control_t cw;
- if ((round & ~0x3) != 0)
+ if ((round & ~0x1) != 0)
/* ROUND is no valid rounding mode. */
return 1;
@@ -33,7 +33,7 @@ fesetround (int round)
_FPU_GETCW (cw);
/* Set rounding bits. */
- cw &= ~0x3;
+ cw &= ~0x1;
cw |= round;
/* Set new state. */
_FPU_SETCW (cw);
GrÃÃe,
Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |