bca718
commit 693096cc7b397a709f075865993027c14c06d3e5
bca718
Author: Wilco <wdijkstr@arm.com>
bca718
Date:   Tue Jun 3 08:10:39 2014 +0000
bca718
bca718
    [AArch64] Switch from FE_TOWARDZERO to _FPU_FPCR_RM_MASK
bca718
bca718
diff --git a/ports/sysdeps/aarch64/fpu/get-rounding-mode.h b/ports/sysdeps/aarch64/fpu/get-rounding-mode.h
bca718
index 5c1615d..425b50e 100644
bca718
--- a/ports/sysdeps/aarch64/fpu/get-rounding-mode.h
bca718
+++ b/ports/sysdeps/aarch64/fpu/get-rounding-mode.h
bca718
@@ -32,7 +32,7 @@ get_rounding_mode (void)
bca718
   fpu_control_t fpcr;
bca718
 
bca718
   _FPU_GETCW (fpcr);
bca718
-  return fpcr & FE_TOWARDZERO;
bca718
+  return fpcr & _FPU_FPCR_RM_MASK;
bca718
 }
bca718
 
bca718
 #endif /* get-rounding-mode.h */
bca718
diff --git a/ports/sysdeps/aarch64/fpu/math_private.h b/ports/sysdeps/aarch64/fpu/math_private.h
bca718
index a3f466b..023c9d0 100644
bca718
--- a/ports/sysdeps/aarch64/fpu/math_private.h
bca718
+++ b/ports/sysdeps/aarch64/fpu/math_private.h
bca718
@@ -58,7 +58,7 @@ libc_fesetround_aarch64 (int round)
bca718
   _FPU_GETCW (fpcr);
bca718
 
bca718
   /* Check whether rounding modes are different.  */
bca718
-  round = (fpcr ^ round) & FE_TOWARDZERO;
bca718
+  round = (fpcr ^ round) & _FPU_FPCR_RM_MASK;
bca718
 
bca718
   /* Set new rounding mode if different.  */
bca718
   if (__glibc_unlikely (round != 0))
bca718
@@ -84,7 +84,7 @@ libc_feholdexcept_setround_aarch64 (fenv_t *envp, int round)
bca718
 
bca718
   /* Clear exception flags, set all exceptions to non-stop,
bca718
      and set new rounding mode.  */
bca718
-  new_fpcr = fpcr & ~((FE_ALL_EXCEPT << FE_EXCEPT_SHIFT) | FE_TOWARDZERO);
bca718
+  new_fpcr = fpcr & ~((FE_ALL_EXCEPT << FE_EXCEPT_SHIFT) | _FPU_FPCR_RM_MASK);
bca718
   new_fpcr |= round;
bca718
   new_fpsr = fpsr & ~FE_ALL_EXCEPT;
bca718
 
bca718
@@ -190,7 +190,7 @@ libc_feholdsetround_aarch64 (fenv_t *envp, int round)
bca718
   envp->__fpsr = fpsr;
bca718
 
bca718
   /* Check whether rounding modes are different.  */
bca718
-  round = (fpcr ^ round) & FE_TOWARDZERO;
bca718
+  round = (fpcr ^ round) & _FPU_FPCR_RM_MASK;
bca718
 
bca718
   /* Set new rounding mode if different.  */
bca718
   if (__glibc_unlikely (round != 0))
bca718
@@ -210,7 +210,7 @@ libc_feresetround_aarch64 (fenv_t *envp)
bca718
   _FPU_GETCW (fpcr);
bca718
 
bca718
   /* Check whether rounding modes are different.  */
bca718
-  round = (envp->__fpcr ^ fpcr) & FE_TOWARDZERO;
bca718
+  round = (envp->__fpcr ^ fpcr) & _FPU_FPCR_RM_MASK;
bca718
 
bca718
   /* Restore the rounding mode if it was changed.  */
bca718
   if (__glibc_unlikely (round != 0))
bca718
@@ -236,7 +236,7 @@ libc_feholdsetround_aarch64_ctx (struct rm_ctx *ctx, int r)
bca718
   ctx->env.__fpsr = fpsr;
bca718
 
bca718
   /* Check whether rounding modes are different.  */
bca718
-  round = (fpcr ^ r) & FE_TOWARDZERO;
bca718
+  round = (fpcr ^ r) & _FPU_FPCR_RM_MASK;
bca718
   ctx->updated_status = round != 0;
bca718
 
bca718
   /* Set the rounding mode if changed.  */