This is the mail archive of the gcc-prs@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: target/10465: [AIX] allow -mnatural-align option for AIX as well


The following reply was made to PR target/10465; it has been noted by GNATS.

From: "Kevin B. Hendricks" <kevin dot hendricks at sympatico dot ca>
To: dje at gcc dot gnu dot org,
 dje at gcc dot gnu dot org,
 foskey at optushome dot com dot au,
 gcc-bugs at gcc dot gnu dot org,
 gcc-prs at gcc dot gnu dot org,
 nobody at gcc dot gnu dot org,
 gcc-gnats at gcc dot gnu dot org
Cc:  
Subject: Re: target/10465: [AIX] allow -mnatural-align option for AIX as well
Date: Fri, 25 Apr 2003 17:03:33 -0400

 --Boundary-00=_lKaq+cYdvu3uje6
 Content-Type: text/plain;
   charset="iso-8859-1"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Hi David,
 
 I have preliminary patches for darwin.h (tested) and aix.h (untested)
 that I will send to Ken for further testing.
 
 I am unsure as to what target_flags mask values are safe to use for aix.
 
 If they work, I still need to track down what changes need to be made in 
 documentation to explain what this does. 
 
 Both preliminary patches are attached (against gcc 3.3 checked out today).
 
 With the darwin patch in place and using gnu g++ 3.3 with -malign-natural
 the gnu darwin build now passes all of the OpenOffice.org alignment tests 
 with flying colors.
 
 So the same approach should work fine for AIX  (I hope!)
 
 Take care,
 
 Kevin
 
 
 
 
 On April 25, 2003 04:11 pm, dje at gcc dot gnu dot org wrote:
 > Synopsis: [AIX] allow -mnatural-align option for AIX as well
 > 
 > Responsible-Changed-From-To: unassigned->dje
 > Responsible-Changed-By: dje
 > Responsible-Changed-When: Fri Apr 25 20:11:57 2003
 > Responsible-Changed-Why:
 >     AIX
 > State-Changed-From-To: open->suspended
 > State-Changed-By: dje
 > State-Changed-When: Fri Apr 25 20:11:57 2003
 > State-Changed-Why:
 >     Kevin Hendricks is working on this.
 > 
 > 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10465
 > 
 > 
 
 --Boundary-00=_lKaq+cYdvu3uje6
 Content-Type: text/x-diff;
   charset="iso-8859-1";
   name="darwin_final_align.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename="darwin_final_align.patch"
 
 --- darwin.h.~1.30.2.1.~	Thu Dec 19 20:49:57 2002
 +++ darwin.h	Fri Apr 25 16:41:29 2003
 @@ -210,12 +210,14 @@
  /* Fix for emit_group_load (): force large constants to be pushed via regs.  */
  #define ALWAYS_PUSH_CONSTS_USING_REGS_P		1
  
 +/* This now supports a natural alignment mode */
  /* Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints.  */
  #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
 +  (TARGET_ALIGN_NATURAL ? (COMPUTED) : \
    (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
  	      ? get_inner_array_type (FIELD) \
 -	      : TREE_TYPE (FIELD)) == DFmode \
 -   ? MIN ((COMPUTED), 32) : (COMPUTED))
 +	      :  TREE_TYPE (FIELD)) == DFmode \
 +               ? MIN ((COMPUTED), 32) : (COMPUTED)))
  
  /* Darwin increases natural record alignment to doubleword if the first
     field is an FP double while the FP fields remain word aligned.  */
 @@ -224,11 +226,24 @@
      || TREE_CODE (STRUCT) == UNION_TYPE			\
      || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)		\
     && TYPE_FIELDS (STRUCT) != 0				\
 +   && TARGET_ALIGN_NATURAL == 0                         \
     && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode	\
     ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64)		\
     : (TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \
     ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128)           \
     : MAX ((COMPUTED), (SPECIFIED)))
 +
 +
 +/* Macros related to the switches that specify the alignment of fields within structs.  */
 +#define MASK_ALIGN_NATURAL      0x08000000 
 +#define TARGET_ALIGN_NATURAL    (target_flags & MASK_ALIGN_NATURAL) 
 +
 +#undef SUBTARGET_SWITCHES 
 +#define SUBTARGET_SWITCHES                                             \
 +  {"align-natural",     MASK_ALIGN_NATURAL,                            \
 +       N_("Align structs and unions according to natural rules")},
 +/* end natural alignment */
 +
  
  /* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
     support 64 bit PowerPC either, so this just keeps things happy.  */
 
 --Boundary-00=_lKaq+cYdvu3uje6
 Content-Type: text/x-diff;
   charset="iso-8859-1";
   name="aix_final_align.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename="aix_final_align.patch"
 
 --- aix.h.~1.34.~	Mon Nov 25 23:54:49 2002
 +++ aix.h	Fri Apr 25 16:52:43 2003
 @@ -129,11 +129,14 @@
  %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
  
  /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints.  */
 +/* This now supports a natural alignment mode */
  #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
 +  (TARGET_ALIGN_NATURAL ? (COMPUTED) : \
    (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
 -	      ? get_inner_array_type (FIELD) \
 -	      : TREE_TYPE (FIELD)) == DFmode \
 -   ? MIN ((COMPUTED), 32) : (COMPUTED))
 +              ? get_inner_array_type (FIELD) \
 +	      :  TREE_TYPE (FIELD)) == DFmode \
 +   ? MIN ((COMPUTED), 32) : (COMPUTED)))
 +
  
  /* AIX increases natural record alignment to doubleword if the first
     field is an FP double while the FP fields remain word aligned.  */
 @@ -142,6 +145,7 @@
      || TREE_CODE (STRUCT) == UNION_TYPE			\
      || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)		\
     && TYPE_FIELDS (STRUCT) != 0				\
 +   && TARGET_ALIGN_NATURAL == 0                         \
     && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode	\
     ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64)		\
     : MAX ((COMPUTED), (SPECIFIED)))
 @@ -154,12 +158,19 @@
  #undef TARGET_XL_CALL
  #define MASK_XL_CALL		0x40000000
  #define	TARGET_XL_CALL		(target_flags & MASK_XL_CALL)
 +
 +/* Enable natural alignment of fields within structs.  */
 +#undef TARGET_ALIGN_NATURAL
 +#define MASK_ALIGN_NATURAL      0x80000000 
 +#define TARGET_ALIGN_NATURAL    (target_flags & MASK_ALIGN_NATURAL) 
  #undef  SUBTARGET_SWITCHES
  #define SUBTARGET_SWITCHES		\
    {"xl-call", 		MASK_XL_CALL,					\
     N_("Always pass floating-point arguments in memory") },		\
    {"no-xl-call",	- MASK_XL_CALL,					\
     N_("Don't always pass floating-point arguments in memory") },	\
 +  {"align-natural",     MASK_ALIGN_NATURAL,                             \
 +   N_("Align structs and unions according to natural rules")},          \
    SUBSUBTARGET_SWITCHES
  #define SUBSUBTARGET_SWITCHES 
  
 
 --Boundary-00=_lKaq+cYdvu3uje6--
 


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