[committed] RISC-V: Fix rounding save/restore bug.

Message ID xnsh3vl4xi.fsf@greed.delorie.com
State Committed
Headers

Commit Message

DJ Delorie Aug. 3, 2018, 5:45 p.m. UTC
  * sysdeps/riscv/rvf/math_private.h (libc_feholdexcept_setround_riscv):
Fix rounding save-restore bug.

Fixes about a hundred off-by-ULP failures in the math testsuite.
  

Comments

Andreas Schwab Aug. 3, 2018, 10:13 p.m. UTC | #1
On Aug 03 2018, DJ Delorie <dj@redhat.com> wrote:

> * sysdeps/riscv/rvf/math_private.h (libc_feholdexcept_setround_riscv):
> Fix rounding save-restore bug.

  Move libc_fesetround_riscv after libc_feholdexcept_riscv.

Andreas.
  

Patch

diff --git a/sysdeps/riscv/rvf/math_private.h b/sysdeps/riscv/rvf/math_private.h
index cdb7858fc8..ca587620cb 100644
--- a/sysdeps/riscv/rvf/math_private.h
+++ b/sysdeps/riscv/rvf/math_private.h
@@ -72,8 +72,8 @@  libc_fesetround_riscv (int round)
 static __always_inline void
 libc_feholdexcept_setround_riscv (fenv_t *envp, int round)
 {
-  libc_fesetround_riscv (round);
   libc_feholdexcept_riscv (envp);
+  libc_fesetround_riscv (round);
 }
 
 #define libc_feholdexcept_setround  libc_feholdexcept_setround_riscv