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]

[PATCH,committed] PPC AIX/Linux64 FP constants in anchors not TOC


	A long time ago in a company far, far away -mno-fp-in-toc was
disabled for TARGET_POWREPC64.

	When the rs6000 port originally was written, FP constants were
placed directly in the TOC.  Originally the processors were 32 bit and
double-precision floating point values occupied two TOC entries.  Because
too many values in the TOC could overflow it, -mno-fp-in-toc was provided
to place double-precision values in the constant section and referenced by
a pointer in the TOC.

	64-bit AIX and PPC64 Linux use 64 bit TOC entries.  Because each
64-bit TOC entry can hold a double-precision FP value, placing the value
in a constant pool and referencing the value with a 64-bit pointer does
not provide any net benefit.  During one of the large rewrites of the TOC
processing code, the macro that decides whether to place a value in the
TOC was modified so that double-precision FP values always are placed in
the TOC when GCC is operating in 64-bit mode.

	More recently, Section Anchor support was added to GCC, placing
constants and static variables in per-function pools referenced by offsets
from a single pointer to the pool anchor in the TOC.  For a constant to be
placed into the constant pool, it cannot be placed in the TOC.  The
section anchor code specifically disables placing FP values in the TOC and
the test for placing a constant in the section anchor pool uses the same
macro for TOC placement.

	Because of the very old code ignoring -mno-fp-in-toc and always
placing FP constants in the TOC in 64-bit mode, the section anchor
functionality for FP constants was inactive in 64-bit mode.

	This patch restores the effect of -mno-fp-in-toc flag in 64-bit
mode.

Bootstrapped and regression tested on powerpc-ibm-aix5.3.0.0

David


	* config/rs6000/xcoff.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Do not
	always place FP constants in the TOC for TARGET_POWERPC64.
	* config/rs6000/linux64.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Same.

Index: xcoff.h
===================================================================
--- xcoff.h	(revision 136422)
+++ xcoff.h	(working copy)
@@ -83,8 +83,7 @@
        || (GET_CODE (X) == CONST_INT 					\
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
        || (GET_CODE (X) == CONST_DOUBLE					\
-	   && (TARGET_POWERPC64						\
-	       || TARGET_MINIMAL_TOC					\
+	   && (TARGET_MINIMAL_TOC					\
 	       || (SCALAR_FLOAT_MODE_P (GET_MODE (X))			\
 		   && ! TARGET_NO_FP_IN_TOC)))))
 
Index: linux64.h
===================================================================
--- linux64.h	(revision 136422)
+++ linux64.h	(working copy)
@@ -477,8 +477,7 @@
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
        || (GET_CODE (X) == CONST_DOUBLE					\
 	   && ((TARGET_64BIT						\
-		&& (TARGET_POWERPC64					\
-		    || TARGET_MINIMAL_TOC				\
+		&& (TARGET_MINIMAL_TOC					\
 		    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
 			&& ! TARGET_NO_FP_IN_TOC)))			\
 	       || (!TARGET_64BIT					\


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