public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anemo at mba dot ocn.ne.jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/45704] [4.5 Regression] load byte instruction is used for volatile int
Date: Mon, 27 Sep 2010 18:12:00 -0000	[thread overview]
Message-ID: <20100927181200.excTL1zPC2nMncLy84U05iXh-x6JbWEAqBSHj6umCng@z> (raw)
In-Reply-To: <bug-45704-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45704

--- Comment #5 from Atsushi Nemoto <anemo at mba dot ocn.ne.jp> 2010-09-27 15:48:32 UTC ---
Here is a similar test case with "packed" attribute, which still produces bad
result.
Four load-byte instructions are generated instead of one load-word.

struct st {
    int ptr;
} __attribute__ ((packed));

int foo(struct st *st)
{
    int v = *(volatile int *)&st->ptr;
    return v & 0xff;
}

gcc 4.4.4 works fine (same result with the first test case)

gcc 4.6.0 20100927 (or 4.5.2 20100927) generates:
    lbu    $2,0($4)
    lbu    $3,1($4)
    andi    $2,$2,0x00ff
    lbu    $3,2($4)
    lbu    $3,3($4)
    j    $31
    nop

I do not know this should be another PR or not.


       reply	other threads:[~2010-09-27 15:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45704-4@http.gcc.gnu.org/bugzilla/>
2010-09-27 18:12 ` anemo at mba dot ocn.ne.jp [this message]
2010-09-27 18:14 ` rguenther at suse dot de
2010-09-28 18:31 ` anemo at mba dot ocn.ne.jp
2010-09-30 18:47 ` anemo at mba dot ocn.ne.jp
2010-09-30 18:51 ` rguenther at suse dot de
2010-10-01 12:48 ` anemo at mba dot ocn.ne.jp
2011-02-03 18:28 ` tschwinge at gcc dot gnu.org
2010-09-17 14:49 [Bug tree-optimization/45704] New: " anemo at mba dot ocn dot ne dot jp
2010-09-17 15:45 ` [Bug tree-optimization/45704] " rguenth at gcc dot gnu dot org
2010-09-20 15:54 ` rguenth at gcc dot gnu dot org
2010-09-21 10:48 ` rguenth at gcc dot gnu dot org
2010-09-21 10:48 ` rguenth at gcc dot gnu dot org

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=20100927181200.excTL1zPC2nMncLy84U05iXh-x6JbWEAqBSHj6umCng@z \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: 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).