public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca> To: dje@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: target/10465: [AIX] allow -mnatural-align option for AIX as well Date: Fri, 25 Apr 2003 21:06:00 -0000 [thread overview] Message-ID: <20030425210601.12383.qmail@sources.redhat.com> (raw) The following reply was made to PR target/10465; it has been noted by GNATS. From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca> To: dje@gcc.gnu.org, dje@gcc.gnu.org, foskey@optushome.com.au, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.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@gcc.gnu.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--
next reply other threads:[~2003-04-25 21:06 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-25 21:06 Kevin B. Hendricks [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-05-19 21:34 dje 2003-04-25 20:11 dje
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030425210601.12383.qmail@sources.redhat.com \ --to=kevin.hendricks@sympatico.ca \ --cc=dje@gcc.gnu.org \ --cc=gcc-prs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).