[PATCH 1/2] soft-fp: Fix overwritten issue for division in op-4.h
Zong Li
zongbox@gmail.com
Mon Oct 15 11:54:00 GMT 2018
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
More information about the Libc-alpha
mailing list