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]

Re: HP-UX PA long double alignment change


> On Tue, Dec 03, 2002 at 02:51:46PM -0500, John David Anglin wrote:
> > Oops, I see that I introduced this problem when I bumped BIGGEST_ALIGMENT
> > to 128 bits last February.  This was required to obtain 128-bit alignment
> > for the ldcw instruction.
> 
> I think this was a mistake.

After analyzing and testing alternative solutions to implement pthread
locking under hppa-linux, I have come to the conclusion that alternative
solutions are possible and that BIGGEST_ALIGMENT doesn't need to be set
to 128 bits.  The enclosed patch has been installed on the main.  A
similar patch will be installed on the 3.2 branch after testing as there
is currently an inconsistency between the HP and GCC with respect to the
the alignment of long doubles under hpux.  This is a regression relative
to 3.1 and earlier releases.

Tested on hppa2.0w-hp-hpux11.11, hppa53-hp-hpux11.11 and hppa-unknown-linux-gnu.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-12-11  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa.h (BIGGEST_ALIGNMENT): Change 32-bit value to 64 bits.
	(MAX_PARM_BOUNDARY, STACK_BOUNDARY): Express in terms of
	BIGGEST_ALIGNMENT.
	(PREFERRED_STACK_BOUNDARY): Express in terms of STACK_BOUNDARY.
	(FUNCTION_BOUNDARY): Express in terms of BITS_PER_WORD.

Index: config/pa/pa.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa.h,v
retrieving revision 1.177
diff -u -3 -p -r1.177 pa.h
--- config/pa/pa.h	6 Dec 2002 02:54:38 -0000	1.177
+++ config/pa/pa.h	6 Dec 2002 23:07:56 -0000
@@ -451,19 +451,19 @@ do {								\
 
 /* Largest alignment required for any stack parameter, in bits.
    Don't define this if it is equal to PARM_BOUNDARY */
-#define MAX_PARM_BOUNDARY (2 * PARM_BOUNDARY)
+#define MAX_PARM_BOUNDARY BIGGEST_ALIGNMENT
 
 /* Boundary (in *bits*) on which stack pointer is always aligned;
    certain optimizations in combine depend on this.
 
-   GCC for the PA always rounds its stacks to a 512bit boundary,
-   but that happens late in the compilation process.  */
-#define STACK_BOUNDARY (TARGET_64BIT ? 128 : 64)
+   GCC for the PA always rounds its stacks to a 8 * STACK_BOUNDARY
+   boundary, but that happens late in the compilation process.  */
+#define STACK_BOUNDARY BIGGEST_ALIGNMENT
 
-#define PREFERRED_STACK_BOUNDARY 512
+#define PREFERRED_STACK_BOUNDARY (8 * STACK_BOUNDARY)
 
 /* Allocation boundary (in *bits*) for the code of a function.  */
-#define FUNCTION_BOUNDARY (TARGET_64BIT ? 64 : 32)
+#define FUNCTION_BOUNDARY BITS_PER_WORD
 
 /* Alignment of field after `int : 0' in a structure.  */
 #define EMPTY_FIELD_BOUNDARY 32
@@ -474,9 +474,8 @@ do {								\
 /* A bit-field declared as `int' forces `int' alignment for the struct.  */
 #define PCC_BITFIELD_TYPE_MATTERS 1
 
-/* No data type wants to be aligned rounder than this.  This is set
-   to 128 bits to allow for lock semaphores in the stack frame.*/
-#define BIGGEST_ALIGNMENT 128
+/* No data type wants to be aligned rounder than this.  */
+#define BIGGEST_ALIGNMENT (2 * BITS_PER_WORD)
 
 /* Get around hp-ux assembler bug, and make strcpy of constants fast.  */
 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
@@ -487,7 +486,6 @@ do {								\
   (TREE_CODE (TYPE) == ARRAY_TYPE		\
    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode	\
    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
 
 /* Set this nonzero if move instructions will actually fail to work
    when given unaligned data.  */


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