Skip to content

Commit

Permalink
[AArch64] Switch from FE_TOWARDZERO to _FPU_FPCR_RM_MASK
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilco authored and Marcus Shawcroft committed Jun 3, 2014
1 parent 0b4366b commit 693096c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2014-06-03 Wilco <wdijkstr@arm.com>

* sysdeps/aarch64/fpu/math_private.h (libc_fesetround_aarch64)
(libc_feholdexcept_setround_aarch64) (libc_feholdsetround_aarch64)
(libc_feresetround_aarch64) (libc_feholdsetround_aarch64_ctx):
Use _FPU_FPCR_RM_MASK for rounding mask rather than FE_TOWARDZERO.
* sysdeps/aarch64/fpu/get-rounding-mode.h (get_rounding_mode):
Likewise.

2014-06-03 Wilco <wdijkstr@arm.com>

* sysdeps/aarch64/fpu/math_private.h
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/aarch64/fpu/get-rounding-mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ get_rounding_mode (void)
fpu_control_t fpcr;

_FPU_GETCW (fpcr);
return fpcr & FE_TOWARDZERO;
return fpcr & _FPU_FPCR_RM_MASK;
}

#endif /* get-rounding-mode.h */
10 changes: 5 additions & 5 deletions sysdeps/aarch64/fpu/math_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ libc_fesetround_aarch64 (int round)
_FPU_GETCW (fpcr);

/* Check whether rounding modes are different. */
round = (fpcr ^ round) & FE_TOWARDZERO;
round = (fpcr ^ round) & _FPU_FPCR_RM_MASK;

/* Set new rounding mode if different. */
if (__glibc_unlikely (round != 0))
Expand All @@ -84,7 +84,7 @@ libc_feholdexcept_setround_aarch64 (fenv_t *envp, int round)

/* Clear exception flags, set all exceptions to non-stop,
and set new rounding mode. */
new_fpcr = fpcr & ~((FE_ALL_EXCEPT << FE_EXCEPT_SHIFT) | FE_TOWARDZERO);
new_fpcr = fpcr & ~((FE_ALL_EXCEPT << FE_EXCEPT_SHIFT) | _FPU_FPCR_RM_MASK);
new_fpcr |= round;
new_fpsr = fpsr & ~FE_ALL_EXCEPT;

Expand Down Expand Up @@ -190,7 +190,7 @@ libc_feholdsetround_aarch64 (fenv_t *envp, int round)
envp->__fpsr = fpsr;

/* Check whether rounding modes are different. */
round = (fpcr ^ round) & FE_TOWARDZERO;
round = (fpcr ^ round) & _FPU_FPCR_RM_MASK;

/* Set new rounding mode if different. */
if (__glibc_unlikely (round != 0))
Expand All @@ -210,7 +210,7 @@ libc_feresetround_aarch64 (fenv_t *envp)
_FPU_GETCW (fpcr);

/* Check whether rounding modes are different. */
round = (envp->__fpcr ^ fpcr) & FE_TOWARDZERO;
round = (envp->__fpcr ^ fpcr) & _FPU_FPCR_RM_MASK;

/* Restore the rounding mode if it was changed. */
if (__glibc_unlikely (round != 0))
Expand All @@ -236,7 +236,7 @@ libc_feholdsetround_aarch64_ctx (struct rm_ctx *ctx, int r)
ctx->env.__fpsr = fpsr;

/* Check whether rounding modes are different. */
round = (fpcr ^ r) & FE_TOWARDZERO;
round = (fpcr ^ r) & _FPU_FPCR_RM_MASK;
ctx->updated_status = round != 0;

/* Set the rounding mode if changed. */
Expand Down

0 comments on commit 693096c

Please sign in to comment.