about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--soft-fp/op-4.h63
2 files changed, 40 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 83a28dbb2f..3bbd5628c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-01  Zong Li  <zong@andestech.com>
+
+	* soft-fp/op-4.h (_FP_FRAC_SUB_3, _FP_FRAC_SUB_4): Use temporary
+	variable to avoid overlap arguments.
+
 2018-11-01  Joseph Myers  <joseph@codesourcery.com>
 
 	* posix/bug-regex22.c (main): Use puts with distinct error
diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h
index 01b87d01a1..b429801687 100644
--- a/soft-fp/op-4.h
+++ b/soft-fp/op-4.h
@@ -696,39 +696,46 @@
 #endif
 
 #ifndef __FP_FRAC_SUB_3
-# define __FP_FRAC_SUB_3(r2, r1, r0, x2, x1, x0, y2, y1, y0)	\
-  do								\
-    {								\
-      _FP_W_TYPE __FP_FRAC_SUB_3_c1, __FP_FRAC_SUB_3_c2;	\
-      r0 = x0 - y0;						\
-      __FP_FRAC_SUB_3_c1 = r0 > x0;				\
-      r1 = x1 - y1;						\
-      __FP_FRAC_SUB_3_c2 = r1 > x1;				\
-      r1 -= __FP_FRAC_SUB_3_c1;					\
-      __FP_FRAC_SUB_3_c2 |= __FP_FRAC_SUB_3_c1 && (y1 == x1);	\
-      r2 = x2 - y2 - __FP_FRAC_SUB_3_c2;			\
-    }								\
+# define __FP_FRAC_SUB_3(r2, r1, r0, x2, x1, x0, y2, y1, y0)    \
+  do                                                            \
+    {                                                           \
+      _FP_W_TYPE __FP_FRAC_SUB_3_tmp[2];                        \
+      _FP_W_TYPE __FP_FRAC_SUB_3_c1, __FP_FRAC_SUB_3_c2;        \
+      __FP_FRAC_SUB_3_tmp[0] = x0 - y0;                         \
+      __FP_FRAC_SUB_3_c1 = __FP_FRAC_SUB_3_tmp[0] > x0;         \
+      __FP_FRAC_SUB_3_tmp[1] = x1 - y1;                         \
+      __FP_FRAC_SUB_3_c2 = __FP_FRAC_SUB_3_tmp[1] > x1;         \
+      __FP_FRAC_SUB_3_tmp[1] -= __FP_FRAC_SUB_3_c1;             \
+      __FP_FRAC_SUB_3_c2 |= __FP_FRAC_SUB_3_c1 && (y1 == x1);   \
+      r2 = x2 - y2 - __FP_FRAC_SUB_3_c2;                        \
+      r1 = __FP_FRAC_SUB_3_tmp[1];                              \
+      r0 = __FP_FRAC_SUB_3_tmp[0];                              \
+    }                                                           \
   while (0)
 #endif
 
 #ifndef __FP_FRAC_SUB_4
 # define __FP_FRAC_SUB_4(r3, r2, r1, r0, x3, x2, x1, x0, y3, y2, y1, y0) \
-  do									\
-    {									\
-      _FP_W_TYPE __FP_FRAC_SUB_4_c1, __FP_FRAC_SUB_4_c2;		\
-      _FP_W_TYPE __FP_FRAC_SUB_4_c3;					\
-      r0 = x0 - y0;							\
-      __FP_FRAC_SUB_4_c1 = r0 > x0;					\
-      r1 = x1 - y1;							\
-      __FP_FRAC_SUB_4_c2 = r1 > x1;					\
-      r1 -= __FP_FRAC_SUB_4_c1;						\
-      __FP_FRAC_SUB_4_c2 |= __FP_FRAC_SUB_4_c1 && (y1 == x1);		\
-      r2 = x2 - y2;							\
-      __FP_FRAC_SUB_4_c3 = r2 > x2;					\
-      r2 -= __FP_FRAC_SUB_4_c2;						\
-      __FP_FRAC_SUB_4_c3 |= __FP_FRAC_SUB_4_c2 && (y2 == x2);		\
-      r3 = x3 - y3 - __FP_FRAC_SUB_4_c3;				\
-    }									\
+  do                                                                     \
+    {                                                                    \
+      _FP_W_TYPE __FP_FRAC_SUB_4_tmp[3];                                 \
+      _FP_W_TYPE __FP_FRAC_SUB_4_c1, __FP_FRAC_SUB_4_c2;                 \
+      _FP_W_TYPE __FP_FRAC_SUB_4_c3;                                     \
+      __FP_FRAC_SUB_4_tmp[0] = x0 - y0;                                  \
+      __FP_FRAC_SUB_4_c1 = __FP_FRAC_SUB_4_tmp[0] > x0;                  \
+      __FP_FRAC_SUB_4_tmp[1] = x1 - y1;                                  \
+      __FP_FRAC_SUB_4_c2 = __FP_FRAC_SUB_4_tmp[1] > x1;                  \
+      __FP_FRAC_SUB_4_tmp[1] -= __FP_FRAC_SUB_4_c1;                      \
+      __FP_FRAC_SUB_4_c2 |= __FP_FRAC_SUB_4_c1 && (y1 == x1);            \
+      __FP_FRAC_SUB_4_tmp[2] = x2 - y2;                                  \
+      __FP_FRAC_SUB_4_c3 = __FP_FRAC_SUB_4_tmp[2] > x2;                  \
+      __FP_FRAC_SUB_4_tmp[2] -= __FP_FRAC_SUB_4_c2;                      \
+      __FP_FRAC_SUB_4_c3 |= __FP_FRAC_SUB_4_c2 && (y2 == x2);            \
+      r3 = x3 - y3 - __FP_FRAC_SUB_4_c3;                                 \
+      r2 = __FP_FRAC_SUB_4_tmp[2];                                       \
+      r1 = __FP_FRAC_SUB_4_tmp[1];                                       \
+      r0 = __FP_FRAC_SUB_4_tmp[0];                                       \
+    }                                                                    \
   while (0)
 #endif