about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2018-08-03 13:43:31 -0400
committerAurelien Jarno <aurelien@aurel32.net>2018-08-22 18:55:30 +0200
commitb0aa03dfffc20ec7a00db73a3dedecb2130ca6ab (patch)
tree84ed86edee39ae35ceee9fc42ecf21ae63ec09ad
parent2f498f3d140ab5152bd784df2be7af7d9c5e63ed (diff)
downloadglibc-b0aa03dfffc20ec7a00db73a3dedecb2130ca6ab.tar.gz
glibc-b0aa03dfffc20ec7a00db73a3dedecb2130ca6ab.tar.xz
glibc-b0aa03dfffc20ec7a00db73a3dedecb2130ca6ab.zip
RISC-V: Fix rounding save/restore bug.
* 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.

(cherry picked from commit bf4181878780be9b53e37a3b0fbabc40cdd07649)
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/riscv/rvf/math_private.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d900e1eba1..b1cba70bc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-03  DJ Delorie  <dj@redhat.com>
+
+	* sysdeps/riscv/rvf/math_private.h (libc_feholdexcept_setround_riscv):
+	Fix rounding save-restore bug.
+
 2018-08-14  Florian Weimer  <fweimer@redhat.com>
 
 	[BZ #23521]
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