public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: Bernd Schmidt <bernds_cb1@t-online.de>
Cc: Roman Zippel <zippel@linux-m68k.org>,
	Daniel Berlin <dberlin@dberlin.org>,
	        GCC Patches <gcc-patches@gcc.gnu.org>,
	        Diego Novillo <dnovillo@redhat.com>,
	Andrew Pinski <pinskia@gmail.com>
Subject: Re: Reload bug & SRA oddness
Date: Sun, 06 May 2007 23:44:00 -0000	[thread overview]
Message-ID: <orejltcyau.fsf@free.oliva.athome.lsd.ic.unicamp.br> (raw)
In-Reply-To: <orfy6agfog.fsf@free.oliva.athome.lsd.ic.unicamp.br> (Alexandre Oliva's message of "Sun\, 06 May 2007 12\:00\:47 -0300")

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

On May  6, 2007, Alexandre Oliva <aoliva@redhat.com> wrote:

> struct a { unsigned long long x : 16, y : 15, z : 33; };
> struct a fa(struct a v) { return v; }
> struct b { unsigned long long x : 16, y : 16, z : 32; };
> struct b fb(struct b v) { return v; }

Err...  This one (quilt-refreshed) should even compile ;-)

It has actually passed bootstrap and regression testing on
a i686-linux-gnu native built on a x86_64-linux-gnu OS.  Ok to install
along with the other previous patches?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-sra-bit-field-ref-word-grow.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

for gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-sra.c (try_instantiate_multiple_fields): Grow alignment
	to fit wider fields that start within the same word.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c.orig	2007-05-06 11:53:04.000000000 -0300
+++ gcc/tree-sra.c	2007-05-06 11:53:49.000000000 -0300
@@ -1521,13 +1521,38 @@ try_instantiate_multiple_fields (struct 
       if (bit + size == nbit)
 	{
 	  if ((bit & alchk) != ((nbit + nsize - 1) & alchk))
-	    break;
+	    {
+	      /* If we're at an alignment boundary, don't bother
+		 growing alignment such that we can include this next
+		 field.  */
+	      if ((nbit & alchk)
+		  || GET_MODE_BITSIZE (DECL_MODE (f)) <= align)
+		break;
+
+	      align = GET_MODE_BITSIZE (DECL_MODE (f));
+	      alchk = align - 1;
+	      alchk = ~alchk;
+
+	      if ((bit & alchk) != ((nbit + nsize - 1) & alchk))
+		break;
+	    }
 	  size += nsize;
 	}
       else if (nbit + nsize == bit)
 	{
 	  if ((nbit & alchk) != ((bit + size - 1) & alchk))
-	    break;
+	    {
+	      if ((bit & alchk)
+		  || GET_MODE_BITSIZE (DECL_MODE (f)) <= align)
+		break;
+
+	      align = GET_MODE_BITSIZE (DECL_MODE (f));
+	      alchk = align - 1;
+	      alchk = ~alchk;
+
+	      if ((nbit & alchk) != ((bit + size - 1) & alchk))
+		break;
+	    }
 	  bit = nbit;
 	  size += nsize;
 	}

[-- Attachment #3: Type: text/plain, Size: 249 bytes --]


-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

  reply	other threads:[~2007-05-06 23:44 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  0:29 Bernd Schmidt
2007-04-20  3:19 ` Andrew Pinski
2007-04-20  3:53 ` Daniel Berlin
2007-04-20  4:30   ` Bernd Schmidt
2007-04-20  4:48     ` Andrew Pinski
2007-04-20  7:32     ` Alexandre Oliva
2007-04-20 12:57       ` Bernd Schmidt
2007-04-20 18:28         ` Alexandre Oliva
2007-04-20 18:40         ` Alexandre Oliva
2007-04-30 10:09           ` Bernd Schmidt
2007-04-30 19:04             ` Alexandre Oliva
2007-04-30 19:08               ` Alexandre Oliva
2007-05-01 15:38             ` Alexandre Oliva
2007-05-01 15:45               ` Eric Botcazou
2007-05-04  0:19                 ` Alexandre Oliva
2007-05-01 15:53               ` Diego Novillo
2007-05-01 16:03                 ` Eric Botcazou
2007-05-01 16:51                   ` Arnaud Charlet
2007-05-01 16:54                     ` Arnaud Charlet
2007-05-01 17:31                   ` Andreas Schwab
2007-05-01 16:24               ` Roman Zippel
2007-05-04  4:07                 ` Alexandre Oliva
2007-05-04  5:24                   ` Alexandre Oliva
2007-05-05 18:19                     ` Roman Zippel
2007-05-06  5:13                       ` Alexandre Oliva
2007-05-06 12:13                         ` Bernd Schmidt
2007-05-06 14:27                           ` Alexandre Oliva
2007-05-06 15:01                             ` Alexandre Oliva
2007-05-06 23:44                               ` Alexandre Oliva [this message]
2007-05-06 23:51                                 ` Diego Novillo
2007-05-07  0:14                                   ` Alexandre Oliva
2007-05-07  2:21                                     ` Andrew Pinski
2007-05-09 12:25                                     ` Bernd Schmidt
2007-05-10  7:47                                       ` Alexandre Oliva
2007-05-10 11:00                                         ` Bernd Schmidt
2007-05-22  7:09                                           ` Alexandre Oliva
2007-05-22 17:34                                             ` Roman Zippel
2007-05-22 20:49                                               ` Alexandre Oliva
2007-05-23 13:07                                                 ` Roman Zippel
2007-05-22 21:23                                             ` Alexandre Oliva
2007-05-09 18:32                                     ` Roman Zippel
2007-05-10  7:49                                       ` Alexandre Oliva
2007-05-15 17:39                                         ` Alexandre Oliva
2007-05-17 21:17                                           ` Andrew Pinski
2007-05-28 10:49                                           ` Bernd Schmidt
2007-05-31 20:57                                             ` Alexandre Oliva
2007-06-02 17:41                                               ` Bernd Schmidt
2007-06-06  3:18                                                 ` Alexandre Oliva
2007-06-25 18:48                                                   ` Alexandre Oliva
2007-06-26 23:01                                                   ` Bernd Schmidt
2007-06-28  4:50                                                     ` Alexandre Oliva
2007-07-03  0:52                                                       ` Roman Zippel
2007-07-06  9:21                                                         ` Alexandre Oliva
2007-08-24  7:28                                                           ` SRA bit-field optimization (was: Re: Reload bug & SRA oddness) Alexandre Oliva
2007-09-28  9:17                                                             ` SRA bit-field optimization Alexandre Oliva
2007-10-02 17:15                                                               ` Richard Guenther
2007-10-03  8:38                                                                 ` Richard Sandiford
2007-10-03 16:50                                                                   ` Alexandre Oliva
2007-10-03 18:23                                                                     ` Richard Sandiford
2007-10-04 19:56                                                                     ` Richard Sandiford
2007-10-05 17:43                                                                       ` Alexandre Oliva
2007-10-06  8:02                                                                         ` Richard Sandiford
2007-10-06 21:06                                                                           ` John David Anglin
2007-10-06 22:12                                                                             ` Richard Sandiford
2007-10-07 23:44                                                                               ` Alexandre Oliva
2007-10-08 21:14                                                                                 ` John David Anglin
2007-10-08 23:51                                                                                   ` Alexandre Oliva
2007-10-09  0:31                                                                                     ` John David Anglin
2007-10-09  4:41                                                                                       ` Alexandre Oliva
2007-10-09  4:45                                                                                 ` Alexandre Oliva
2007-10-06 16:01                                                                         ` David Daney
2007-10-03 14:37                                                                 ` Daniel Berlin
2007-10-03 14:44                                                                   ` Diego Novillo
2007-10-05 15:03                                                                 ` Richard Guenther
2007-10-05 16:20                                                                   ` Alexandre Oliva
2007-10-05 16:24                                                                     ` Richard Guenther
2007-10-05 16:26                                                                     ` Diego Novillo
2007-10-05 20:08                                                                       ` Alexandre Oliva
2007-10-09  4:55                                                                     ` Alexandre Oliva
2007-10-03  7:45                                                               ` Eric Botcazou
2007-10-03 21:36                                                                 ` Eric Botcazou
2007-10-08 20:28                                                                 ` Alexandre Oliva
2007-10-05  6:24                                                                   ` Eric Botcazou
2007-10-05 16:03                                                                     ` Alexandre Oliva
2007-10-07  9:01                                                                       ` Eric Botcazou
2007-10-07 23:58                                                                         ` Alexandre Oliva
2007-10-08  5:13                                                                           ` Eric Botcazou
2007-10-08 20:29                                                                             ` Alexandre Oliva
2007-10-08 21:00                                                                               ` Eric Botcazou
2007-10-08 23:56                                                                                 ` Alexandre Oliva
2007-09-29 17:52                                                           ` Reload bug & SRA oddness Diego Novillo
2007-04-20 17:07     ` Daniel Berlin
2007-04-28 20:48   ` Bernd Schmidt
2007-04-28 21:26     ` Richard Guenther
2007-04-28 21:49       ` Daniel Berlin
2007-04-29 10:04         ` Richard Guenther
2007-04-29 10:27           ` Richard Guenther
2007-04-29 10:31             ` Richard Guenther
2007-04-29 11:16               ` Richard Guenther
2007-04-20 14:01 ` Bernd Schmidt
2007-04-20 22:00   ` Eric Botcazou
2007-04-28 16:25     ` Bernd Schmidt
2007-04-28 17:46       ` Eric Botcazou
2007-04-29  6:42   ` Bernd Schmidt

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=orejltcyau.fsf@free.oliva.athome.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=bernds_cb1@t-online.de \
    --cc=dberlin@dberlin.org \
    --cc=dnovillo@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=zippel@linux-m68k.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: link
Be 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).