SH: No FE_UPWARD, FE_DOWNWARD.
authorThomas Schwinge <thomas@codesourcery.com>
Sat, 9 Jun 2012 16:46:01 +0000 (18:46 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Sat, 9 Jun 2012 16:46:01 +0000 (18:46 +0200)
ChangeLog
sysdeps/sh/sh4/fpu/bits/fenv.h
sysdeps/sh/sh4/fpu/fegetround.c
sysdeps/sh/sh4/fpu/fesetround.c

index 5a6747480f657f3b0fa2e00b6ea90a8d5f1ab5f0..b384ae845b16959a4164b40b842441564c0c9b53 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 38c303ff2ec1c44f7ace95ea0825a87dbf8749cd..93159499d55c7fd8305456df9ce76a473cc1759b 100644 (file)
@@ -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
@@ -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
   };
 
 
index 73683831147ae8560e89d39c29892fa53cb97df2..adaeb8a8584b47433ad2d8850efebd040d0b9b7b 100644 (file)
@@ -28,5 +28,5 @@ fegetround (void)
   /* Get control word.  */
   _FPU_GETCW (cw);
 
-  return cw & 0x3;
+  return cw & 0x1;
 }
index 82e13b68ee6b253a853eefae508acbc247fabbc3..91c159b40beed226e6394bab9e87a331a4df2925 100644 (file)
@@ -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);