This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove no-longer-needed fp-bit target macros


This patch removes some fp-bit target macros that are no longer
needed:

* __make_dp was not really designed as a target macro, but CRIS
  defined it in cris.h anyway for optimization purposes (so making it
  show up on lists of target macros).  Since CRIS no longer uses
  fp-bit, that definition is no longer needed.

* There were no non-default definitions of ROUND_TOWARDS_ZERO.

* There were no valid non-default definitions of
  LARGEST_EXPONENT_IS_NORMAL.  (One definition present for ARM to
  handle half-precision treated it as if it were a host-side macro,
  referring to definitions only present in host-side code, but this
  macro is only used in code built for the target, not the host.  In
  any case, fp-bit does not support half-precision, and as far as I
  can tell no ARM targets use fp-bit.)

The latter two macros are poisoned by this patch; it doesn't seem
worth poisoning the first given it wasn't intended as a target macro
anyway.

Note there is still plenty more dead code in fp-bit that's outside the
scope of the present patch series cleaning up uses of host-side target
macros in target-side code.  Specifically, all the TFmode support is
dead (both IEEE binary128 and IBM long double); fp-bit is only used
for SFmode and DFmode now.  (IBM long double support in fp-bit became
dead when the IRIX port was removed, binary128 support when MIPS
GNU/Linux moved to using soft-fp.)

Tested with no regressions with cross to powerpc-none-eabi.  OK to
commit?

gcc:
2014-09-05  Joseph Myers  <joseph@codesourcery.com>

	* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO):
	Remove.
	* doc/tm.texi.in (ROUND_TOWARDS_ZERO, LARGEST_EXPONENT_IS_NORMAL):
	Remove.
	* doc/tm.texi: Regenerate.
	* system.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO):
	Poison.
	* config/arm/arm.h (LARGEST_EXPONENT_IS_NORMAL): Remove.
	* config/cris/cris.h (__make_dp): Remove.

libgcc:
2014-09-05  Joseph Myers  <joseph@codesourcery.com>

	* fp-bit.c (pack_d, unpack_d): Remove LARGEST_EXPONENT_IS_NORMAL
	and ROUND_TOWARDS_ZERO conditionals.

Index: gcc/config/arm/arm.h
===================================================================
--- gcc/config/arm/arm.h	(revision 214954)
+++ gcc/config/arm/arm.h	(working copy)
@@ -440,9 +440,6 @@ extern int arm_fpu_attr;
 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
 #endif
 
-#define LARGEST_EXPONENT_IS_NORMAL(bits) \
-    ((bits) == 16 && arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE)
-
 #ifndef ARM_DEFAULT_ABI
 #define ARM_DEFAULT_ABI ARM_ABI_APCS
 #endif
Index: gcc/config/cris/cris.h
===================================================================
--- gcc/config/cris/cris.h	(revision 214954)
+++ gcc/config/cris/cris.h	(working copy)
@@ -80,15 +80,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Which CPU version this is.  The parsed and adjusted cris_cpu_str.  */
 extern int cris_cpu_version;
 
-/* Changing the order used to be necessary to put the fourth __make_dp
-   argument (a DImode parameter) in registers, to fit with the libfunc
-   parameter passing scheme used for intrinsic functions.  FIXME: Check
-   performance.  */
-#ifdef IN_LIBGCC2
-#define __make_dp(a,b,c,d) __cris_make_dp(d,a,b,c)
-#endif
 
-
 /* Node: Driver */
 
 /* Also provide canonical vN definitions when user specifies an alias.  */
Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 214954)
+++ gcc/defaults.h	(working copy)
@@ -926,14 +926,6 @@ see the files COPYING3 and COPYING.RUNTIME respect
 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
 #endif
 
-#ifndef LARGEST_EXPONENT_IS_NORMAL
-#define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0
-#endif
-
-#ifndef ROUND_TOWARDS_ZERO
-#define ROUND_TOWARDS_ZERO 0
-#endif
-
 #ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL
 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false
 #endif
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 214954)
+++ gcc/doc/tm.texi	(working copy)
@@ -1341,27 +1341,6 @@ Return machine mode to be used for @code{_Unwind_W
 The default is to use @code{word_mode}.
 @end deftypefn
 
-@defmac ROUND_TOWARDS_ZERO
-If defined, this macro should be true if the prevailing rounding
-mode is towards zero.
-
-Defining this macro only affects the way @file{libgcc.a} emulates
-floating-point arithmetic.
-
-Not defining this macro is equivalent to returning zero.
-@end defmac
-
-@defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})
-This macro should return true if floats with @var{size}
-bits do not have a NaN or infinity representation, but use the largest
-exponent for normal numbers instead.
-
-Defining this macro only affects the way @file{libgcc.a} emulates
-floating-point arithmetic.
-
-The default definition of this macro returns false for all sizes.
-@end defmac
-
 @deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (const_tree @var{record_type})
 This target hook returns @code{true} if bit-fields in the given
 @var{record_type} are to be laid out following the rules of Microsoft
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 214954)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -1255,27 +1255,6 @@ pattern needs to support both a 32- and a 64-bit m
 
 @hook TARGET_UNWIND_WORD_MODE
 
-@defmac ROUND_TOWARDS_ZERO
-If defined, this macro should be true if the prevailing rounding
-mode is towards zero.
-
-Defining this macro only affects the way @file{libgcc.a} emulates
-floating-point arithmetic.
-
-Not defining this macro is equivalent to returning zero.
-@end defmac
-
-@defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})
-This macro should return true if floats with @var{size}
-bits do not have a NaN or infinity representation, but use the largest
-exponent for normal numbers instead.
-
-Defining this macro only affects the way @file{libgcc.a} emulates
-floating-point arithmetic.
-
-The default definition of this macro returns false for all sizes.
-@end defmac
-
 @hook TARGET_MS_BITFIELD_LAYOUT_P
 
 @hook TARGET_DECIMAL_FLOAT_SUPPORTED_P
Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 214954)
+++ gcc/system.h	(working copy)
@@ -934,7 +934,8 @@ extern void fancy_abort (const char *, int, const
 	REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT		   \
 	EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT			   \
 	EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P	   \
-	CALLER_SAVE_PROFITABLE
+	CALLER_SAVE_PROFITABLE LARGEST_EXPONENT_IS_NORMAL		   \
+	ROUND_TOWARDS_ZERO
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
Index: libgcc/fp-bit.c
===================================================================
--- libgcc/fp-bit.c	(revision 214954)
+++ libgcc/fp-bit.c	(working copy)
@@ -202,17 +202,9 @@ pack_d (const fp_number_type *src)
   int sign = src->sign;
   int exp = 0;
 
-  if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src)))
+  if (isnan (src))
     {
-      /* We can't represent these values accurately.  By using the
-	 largest possible magnitude, we guarantee that the conversion
-	 of infinity is at least as big as any finite number.  */
       exp = EXPMAX;
-      fraction = ((fractype) 1 << FRACBITS) - 1;
-    }
-  else if (isnan (src))
-    {
-      exp = EXPMAX;
       /* Restore the NaN's payload.  */
       fraction >>= NGARDS;
       fraction &= QUIET_NAN - 1;
@@ -291,8 +283,7 @@ pack_d (const fp_number_type *src)
 	  fraction >>= NGARDS;
 #endif /* NO_DENORMALS */
 	}
-      else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
-	       && __builtin_expect (src->normal_exp > EXPBIAS, 0))
+      else if (__builtin_expect (src->normal_exp > EXPBIAS, 0))
 	{
 	  exp = EXPMAX;
 	  fraction = 0;
@@ -300,35 +291,25 @@ pack_d (const fp_number_type *src)
       else
 	{
 	  exp = src->normal_exp + EXPBIAS;
-	  if (!ROUND_TOWARDS_ZERO)
+	  /* IF the gard bits are the all zero, but the first, then we're
+	     half way between two numbers, choose the one which makes the
+	     lsb of the answer 0.  */
+	  if ((fraction & GARDMASK) == GARDMSB)
 	    {
-	      /* IF the gard bits are the all zero, but the first, then we're
-		 half way between two numbers, choose the one which makes the
-		 lsb of the answer 0.  */
-	      if ((fraction & GARDMASK) == GARDMSB)
-		{
-		  if (fraction & (1 << NGARDS))
-		    fraction += GARDROUND + 1;
-		}
-	      else
-		{
-		  /* Add a one to the guards to round up */
-		  fraction += GARDROUND;
-		}
-	      if (fraction >= IMPLICIT_2)
-		{
-		  fraction >>= 1;
-		  exp += 1;
-		}
+	      if (fraction & (1 << NGARDS))
+		fraction += GARDROUND + 1;
 	    }
-	  fraction >>= NGARDS;
-
-	  if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX)
+	  else
 	    {
-	      /* Saturate on overflow.  */
-	      exp = EXPMAX;
-	      fraction = ((fractype) 1 << FRACBITS) - 1;
+	      /* Add a one to the guards to round up */
+	      fraction += GARDROUND;
 	    }
+	  if (fraction >= IMPLICIT_2)
+	    {
+	      fraction >>= 1;
+	      exp += 1;
+	    }
+	  fraction >>= NGARDS;
 	}
     }
 
@@ -556,8 +537,7 @@ unpack_d (FLO_union_type * src, fp_number_type * d
 	  dst->fraction.ll = fraction;
 	}
     }
-  else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
-	   && __builtin_expect (exp == EXPMAX, 0))
+  else if (__builtin_expect (exp == EXPMAX, 0))
     {
       /* Huge exponent*/
       if (fraction == 0)
@@ -915,7 +895,7 @@ _fpmul_parts ( fp_number_type *  a,
       low <<= 1;
     }
 
-  if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB)
+  if ((high & GARDMASK) == GARDMSB)
     {
       if (high & (1 << NGARDS))
 	{
@@ -1035,7 +1015,7 @@ _fpdiv_parts (fp_number_type * a,
 	numerator *= 2;
       }
 
-    if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB)
+    if ((quotient & GARDMASK) == GARDMSB)
       {
 	if (quotient & (1 << NGARDS))
 	  {

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]