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]

HP-UX PA long double alignment change


I have been doing more mix and match testing of the HP compiler and the
GNU compiler on PA using the latest patch that Dave Anglin made and
everything looked good in 64 bit mode but I found one issue in 32 bit
mode.

It appears that the long double type is aligned on an 8 byte boundry,
not a 16 byte one, by the HP compiler when in 32 bit mode.  This
generally shouldn't matter to GCC but I did have a problem if I passed a
structure containing a char field followed by a long double field
between HP and GNU.  I would like to use ADJUST_FIELD_ALIGN to fix
this.  I think that field alignment in structures is the only place the
alignment difference matters for mixing objects from the two compilers.

Long doubles are 16 byte aligned when in 64 bit mode, so this only
affects 32 bit compilations.

Tested on HP-UX PA32 and PA64.

Steve Ellcey
sje@cup.hp.com


2002-12-03  Steve Ellcey  <sje@cup.hp.com>

	* config/pa/pa.h (ADJUST_FIELD_ALIGN): Align long doubles on
	8 byte boundries instead of 16 inside a structure.


*** gcc.orig/gcc/config/pa/pa.h	Tue Dec  3 10:51:34 2002
--- gcc/gcc/config/pa/pa.h	Tue Dec  3 10:53:12 2002
*************** do {								\
*** 488,493 ****
--- 488,501 ----
     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode	\
     && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
  
+ /* Make fields of long double 8 byte aligned.  */
+ #undef ADJUST_FIELD_ALIGN
+ #define ADJUST_FIELD_ALIGN(FIELD, ALIGN)			\
+    ((TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE	\
+               ? get_inner_array_type (TREE_TYPE (FIELD))	\
+               : TREE_TYPE (FIELD)) == TFmode)			\
+     && !TARGET_64BIT						\
+    ? 64 : (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]