This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 1/2] soft-fp: Fix overwritten issue for division in op-4.h
- From: Zong Li <zongbox at gmail dot com>
- To: joseph at codesourcery dot com, palmer at dabbelt dot com, darius at bluespec dot com, andrew at sifive dot com, dj at redhat dot com, libc-alpha at sourceware dot org
- Cc: jimw at sifive dot com, kito at andestech dot com, greentime at andestech dot com, zongbox at gmail dot com
- Date: Mon, 15 Oct 2018 19:52:30 +0800
- Subject: [PATCH 1/2] soft-fp: Fix overwritten issue for division in op-4.h
- References: <cover.1539595555.git.zongbox@gmail.com>
The original value of X##_f[0] is overwritten before the calculatation.
After this modification, we can pass the soft floating testing of glibc
testsuites on RV32.
* soft-fp/op-4.h: Fix wrong calculation of division.
---
ChangeLog | 4 ++++
soft-fp/op-4.h | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 2601765..bb30093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-15 Zong Li <zongbox@gmail.com>
+
+ * soft-fp/op-4.h: Fix wrong calculation of division.
+
2018-10-14 Paul Eggert <eggert@cs.ucla.edu>
regex: simplify by using intprops.h
diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h
index 01b87d0..a407168 100644
--- a/soft-fp/op-4.h
+++ b/soft-fp/op-4.h
@@ -517,10 +517,15 @@
R##_f[_FP_DIV_MEAT_4_udiv_i] = -1; \
if (!_FP_DIV_MEAT_4_udiv_i) \
break; \
- __FP_FRAC_SUB_4 (X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ UWtype __FP_FRAC_tmp; \
+ __FP_FRAC_SUB_4 (X##_f[2], X##_f[1], X##_f[0], __FP_FRAC_tmp, \
Y##_f[2], Y##_f[1], Y##_f[0], 0, \
X##_f[2], X##_f[1], X##_f[0], \
_FP_DIV_MEAT_4_udiv_n_f[_FP_DIV_MEAT_4_udiv_i]); \
+ X##_f[3] = X##_f[2]; \
+ X##_f[2] = X##_f[1]; \
+ X##_f[1] = X##_f[0]; \
+ X##_f[0] = __FP_FRAC_tmp; \
_FP_FRAC_SUB_4 (X, Y, X); \
if (X##_f[3] > Y##_f[3]) \
{ \
--
2.7.4