about summary refs log tree commit diff
path: root/soft-fp/op-8.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-06-30 17:37:10 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-06-30 17:37:10 +0000
commit3a6e988706d1ce2c88c933619d1f312098698ecd (patch)
tree90ec79e99524bb80b7948755a24273ccf824da78 /soft-fp/op-8.h
parent9c37ec0b8929c57ea83230507d7742ca9a8888bc (diff)
downloadglibc-3a6e988706d1ce2c88c933619d1f312098698ecd.tar.gz
glibc-3a6e988706d1ce2c88c933619d1f312098698ecd.tar.xz
glibc-3a6e988706d1ce2c88c933619d1f312098698ecd.zip
Rename soft-fp op-[1248].h variables to avoid risk of shadowing.
Continuing the soft-fp variable renaming from
<https://sourceware.org/ml/libc-alpha/2014-06/msg00434.html> to avoid
shadowing if two macros happen to use the same variable name and that
variable is involved in an argument one of those macros passes to
another, this patch renames variables in op-[1248].h.  (The two
patches are to different files and are independent of each other.)

Tested for powerpc32 (soft-float) and mips64 that this makes no change
to the disassembly of installed shared libraries.

	* soft-fp/op-1.h (_FP_UNPACK_RAW_1): Rename local variables to
	include macro name.
	(_FP_UNPACK_RAW_1_P): Likewise.
	(_FP_PACK_RAW_1): Likewise.
	(_FP_PACK_RAW_1_P): Likewise.
	(_FP_MUL_MEAT_1_wide): Likewise.
	(_FP_MUL_MEAT_DW_1_hard): Likewise.
	(_FP_MUL_MEAT_1_hard): Likewise.
	(_FP_DIV_MEAT_1_imm): Likewise.
	(_FP_DIV_MEAT_1_udiv_norm): Likewise.
	(_FP_DIV_MEAT_1_udiv): Likewise.
	* soft-fp/op-2.h (__FP_FRAC_DEC_2): Likewise.
	(_FP_UNPACK_RAW_2): Likewise.
	(_FP_UNPACK_RAW_2_P): Likewise.
	(_FP_PACK_RAW_2): Likewise.
	(_FP_PACK_RAW_2_P): Likewise.
	(_FP_MUL_MEAT_DW_2_wide): Likewise.
	(_FP_MUL_MEAT_2_wide): Likewise.
	(_FP_MUL_MEAT_DW_2_wide_3mul): Likewise.
	(_FP_MUL_MEAT_2_wide_3mul): Likewise.
	(_FP_MUL_MEAT_DW_2_gmp): Likewise.
	(_FP_MUL_MEAT_2_gmp): Likewise.
	(_FP_DIV_MEAT_2_udiv): Likewise.
	* soft-fp/op-4.h (_FP_FRAC_SLL_4): Likewise.
	(_FP_FRAC_SRL_4): Likewise.
	(_FP_FRAC_SRST_4): Likewise.
	(_FP_FRAC_SRS_4): Likewise.
	(_FP_UNPACK_RAW_4): Likewise.
	(_FP_UNPACK_RAW_4_P): Likewise.
	(_FP_PACK_RAW_4): Likewise.
	(_FP_PACK_RAW_4_P): Likewise.
	(_FP_MUL_MEAT_DW_4_wide): Likewise.
	(_FP_MUL_MEAT_4_wide): Likewise.
	(_FP_MUL_MEAT_4_gmp): Likewise.
	(umul_ppppmnnn): Likewise.
	(_FP_DIV_MEAT_4_udiv): Likewise.
	(__FP_FRAC_ADD_4): Likewise.
	(__FP_FRAC_SUB_3): Likewise.
	(__FP_FRAC_SUB_4): Likewise.
	(__FP_FRAC_DEC_3): Likewise.
	(__FP_FRAC_DEC_4): Likewise.
	(__FP_FRAC_ADDI_4): Likewise.
	* soft-fp/op-8.h (_FP_FRAC_SLL_8): Likewise.
	(_FP_FRAC_SRL_8): Likewise.
	(_FP_FRAC_SRS_8): Likewise.
Diffstat (limited to 'soft-fp/op-8.h')
-rw-r--r--soft-fp/op-8.h146
1 files changed, 88 insertions, 58 deletions
diff --git a/soft-fp/op-8.h b/soft-fp/op-8.h
index a50cd7b582..c966ee28d2 100644
--- a/soft-fp/op-8.h
+++ b/soft-fp/op-8.h
@@ -36,48 +36,66 @@
 #define _FP_FRAC_LOW_8(X)	(X##_f[0])
 #define _FP_FRAC_WORD_8(X, w)	(X##_f[w])
 
-#define _FP_FRAC_SLL_8(X, N)				\
-  do							\
-    {							\
-      _FP_I_TYPE _up, _down, _skip, _i;			\
-      _skip = (N) / _FP_W_TYPE_SIZE;			\
-      _up = (N) % _FP_W_TYPE_SIZE;			\
-      _down = _FP_W_TYPE_SIZE - _up;			\
-      if (!_up)						\
-	for (_i = 7; _i >= _skip; --_i)			\
-	  X##_f[_i] = X##_f[_i-_skip];			\
-      else						\
-	{						\
-	  for (_i = 7; _i > _skip; --_i)		\
-	    X##_f[_i] = (X##_f[_i-_skip] << _up		\
-			 | X##_f[_i-_skip-1] >> _down);	\
-	  X##_f[_i--] = X##_f[0] << _up;		\
-	}						\
-      for (; _i >= 0; --_i)				\
-	X##_f[_i] = 0;					\
-    }							\
+#define _FP_FRAC_SLL_8(X, N)						\
+  do									\
+    {									\
+      _FP_I_TYPE _FP_FRAC_SLL_8_up, _FP_FRAC_SLL_8_down;		\
+      _FP_I_TYPE _FP_FRAC_SLL_8_skip, _FP_FRAC_SLL_8_i;			\
+      _FP_FRAC_SLL_8_skip = (N) / _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SLL_8_up = (N) % _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SLL_8_down = _FP_W_TYPE_SIZE - _FP_FRAC_SLL_8_up;	\
+      if (!_FP_FRAC_SLL_8_up)						\
+	for (_FP_FRAC_SLL_8_i = 7;					\
+	     _FP_FRAC_SLL_8_i >= _FP_FRAC_SLL_8_skip;			\
+	     --_FP_FRAC_SLL_8_i)					\
+	  X##_f[_FP_FRAC_SLL_8_i]					\
+	    = X##_f[_FP_FRAC_SLL_8_i-_FP_FRAC_SLL_8_skip];		\
+      else								\
+	{								\
+	  for (_FP_FRAC_SLL_8_i = 7;					\
+	       _FP_FRAC_SLL_8_i > _FP_FRAC_SLL_8_skip;			\
+	       --_FP_FRAC_SLL_8_i)					\
+	    X##_f[_FP_FRAC_SLL_8_i]					\
+	      = ((X##_f[_FP_FRAC_SLL_8_i-_FP_FRAC_SLL_8_skip]		\
+		  << _FP_FRAC_SLL_8_up)					\
+		 | (X##_f[_FP_FRAC_SLL_8_i-_FP_FRAC_SLL_8_skip-1]	\
+		    >> _FP_FRAC_SLL_8_down));				\
+	  X##_f[_FP_FRAC_SLL_8_i--] = X##_f[0] << _FP_FRAC_SLL_8_up;	\
+	}								\
+      for (; _FP_FRAC_SLL_8_i >= 0; --_FP_FRAC_SLL_8_i)			\
+	X##_f[_FP_FRAC_SLL_8_i] = 0;					\
+    }									\
   while (0)
 
-#define _FP_FRAC_SRL_8(X, N)				\
-  do							\
-    {							\
-      _FP_I_TYPE _up, _down, _skip, _i;			\
-      _skip = (N) / _FP_W_TYPE_SIZE;			\
-      _down = (N) % _FP_W_TYPE_SIZE;			\
-      _up = _FP_W_TYPE_SIZE - _down;			\
-      if (!_down)					\
-	for (_i = 0; _i <= 7-_skip; ++_i)		\
-	  X##_f[_i] = X##_f[_i+_skip];			\
-      else						\
-	{						\
-	  for (_i = 0; _i < 7-_skip; ++_i)		\
-	    X##_f[_i] = (X##_f[_i+_skip] >> _down	\
-			 | X##_f[_i+_skip+1] << _up);	\
-	  X##_f[_i++] = X##_f[7] >> _down;		\
-	}						\
-      for (; _i < 8; ++_i)				\
-	X##_f[_i] = 0;					\
-    }							\
+#define _FP_FRAC_SRL_8(X, N)						\
+  do									\
+    {									\
+      _FP_I_TYPE _FP_FRAC_SRL_8_up, _FP_FRAC_SRL_8_down;		\
+      _FP_I_TYPE _FP_FRAC_SRL_8_skip, _FP_FRAC_SRL_8_i;			\
+      _FP_FRAC_SRL_8_skip = (N) / _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SRL_8_down = (N) % _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SRL_8_up = _FP_W_TYPE_SIZE - _FP_FRAC_SRL_8_down;	\
+      if (!_FP_FRAC_SRL_8_down)						\
+	for (_FP_FRAC_SRL_8_i = 0;					\
+	     _FP_FRAC_SRL_8_i <= 7-_FP_FRAC_SRL_8_skip;			\
+	     ++_FP_FRAC_SRL_8_i)					\
+	  X##_f[_FP_FRAC_SRL_8_i]					\
+	    = X##_f[_FP_FRAC_SRL_8_i+_FP_FRAC_SRL_8_skip];		\
+      else								\
+	{								\
+	  for (_FP_FRAC_SRL_8_i = 0;					\
+	       _FP_FRAC_SRL_8_i < 7-_FP_FRAC_SRL_8_skip;		\
+	       ++_FP_FRAC_SRL_8_i)					\
+	    X##_f[_FP_FRAC_SRL_8_i]					\
+	      = ((X##_f[_FP_FRAC_SRL_8_i+_FP_FRAC_SRL_8_skip]		\
+		  >> _FP_FRAC_SRL_8_down)				\
+		 | (X##_f[_FP_FRAC_SRL_8_i+_FP_FRAC_SRL_8_skip+1]	\
+		    << _FP_FRAC_SRL_8_up));				\
+	  X##_f[_FP_FRAC_SRL_8_i++] = X##_f[7] >> _FP_FRAC_SRL_8_down;	\
+	}								\
+      for (; _FP_FRAC_SRL_8_i < 8; ++_FP_FRAC_SRL_8_i)			\
+	X##_f[_FP_FRAC_SRL_8_i] = 0;					\
+    }									\
   while (0)
 
 
@@ -89,28 +107,40 @@
 #define _FP_FRAC_SRS_8(X, N, size)					\
   do									\
     {									\
-      _FP_I_TYPE _up, _down, _skip, _i;					\
-      _FP_W_TYPE _s;							\
-      _skip = (N) / _FP_W_TYPE_SIZE;					\
-      _down = (N) % _FP_W_TYPE_SIZE;					\
-      _up = _FP_W_TYPE_SIZE - _down;					\
-      for (_s = _i = 0; _i < _skip; ++_i)				\
-	_s |= X##_f[_i];						\
-      if (!_down)							\
-	for (_i = 0; _i <= 7-_skip; ++_i)				\
-	  X##_f[_i] = X##_f[_i+_skip];					\
+      _FP_I_TYPE _FP_FRAC_SRS_8_up, _FP_FRAC_SRS_8_down;		\
+      _FP_I_TYPE _FP_FRAC_SRS_8_skip, _FP_FRAC_SRS_8_i;			\
+      _FP_W_TYPE _FP_FRAC_SRS_8_s;					\
+      _FP_FRAC_SRS_8_skip = (N) / _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SRS_8_down = (N) % _FP_W_TYPE_SIZE;			\
+      _FP_FRAC_SRS_8_up = _FP_W_TYPE_SIZE - _FP_FRAC_SRS_8_down;	\
+      for (_FP_FRAC_SRS_8_s = _FP_FRAC_SRS_8_i = 0;			\
+	   _FP_FRAC_SRS_8_i < _FP_FRAC_SRS_8_skip;			\
+	   ++_FP_FRAC_SRS_8_i)						\
+	_FP_FRAC_SRS_8_s |= X##_f[_FP_FRAC_SRS_8_i];			\
+      if (!_FP_FRAC_SRS_8_down)						\
+	for (_FP_FRAC_SRS_8_i = 0;					\
+	     _FP_FRAC_SRS_8_i <= 7-_FP_FRAC_SRS_8_skip;			\
+	     ++_FP_FRAC_SRS_8_i)					\
+	  X##_f[_FP_FRAC_SRS_8_i]					\
+	    = X##_f[_FP_FRAC_SRS_8_i+_FP_FRAC_SRS_8_skip];		\
       else								\
 	{								\
-	  _s |= X##_f[_i] << _up;					\
-	  for (_i = 0; _i < 7-_skip; ++_i)				\
-	    X##_f[_i] = (X##_f[_i+_skip] >> _down			\
-			 | X##_f[_i+_skip+1] << _up);			\
-	  X##_f[_i++] = X##_f[7] >> _down;				\
+	  _FP_FRAC_SRS_8_s						\
+	    |= X##_f[_FP_FRAC_SRS_8_i] << _FP_FRAC_SRS_8_up;		\
+	  for (_FP_FRAC_SRS_8_i = 0;					\
+	       _FP_FRAC_SRS_8_i < 7-_FP_FRAC_SRS_8_skip;		\
+	       ++_FP_FRAC_SRS_8_i)					\
+	    X##_f[_FP_FRAC_SRS_8_i]					\
+	      = ((X##_f[_FP_FRAC_SRS_8_i+_FP_FRAC_SRS_8_skip]		\
+		  >> _FP_FRAC_SRS_8_down)				\
+		 | (X##_f[_FP_FRAC_SRS_8_i+_FP_FRAC_SRS_8_skip+1]	\
+		    << _FP_FRAC_SRS_8_up));				\
+	  X##_f[_FP_FRAC_SRS_8_i++] = X##_f[7] >> _FP_FRAC_SRS_8_down;	\
 	}								\
-      for (; _i < 8; ++_i)						\
-	X##_f[_i] = 0;							\
+      for (; _FP_FRAC_SRS_8_i < 8; ++_FP_FRAC_SRS_8_i)			\
+	X##_f[_FP_FRAC_SRS_8_i] = 0;					\
       /* don't fix the LSB until the very end when we're sure f[0] is	\
 	 stable */							\
-      X##_f[0] |= (_s != 0);						\
+      X##_f[0] |= (_FP_FRAC_SRS_8_s != 0);				\
     }									\
   while (0)