public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikpe at it dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/45813] [4.5 Regression] alias analysis problem with -mthumb
Date: Thu, 15 Mar 2012 08:45:00 -0000	[thread overview]
Message-ID: <bug-45813-4-J3gCrHlWOB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45813-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #15 from Mikael Pettersson <mikpe at it dot uu.se> 2012-03-15 08:10:55 UTC ---
-fno-strict-aliasing makes no difference to the code generated by 4.5-20120308.
 Replacing the type-punning with a union results in both correct-looking and
much tighter code:

unsigned short ReadLE16U_union( volatile unsigned char * ptr )
{
    union {
        unsigned short value;
        unsigned char bytes[2];
    } u;

    u.bytes[0] = ptr[0];
    u.bytes[1] = ptr[1];

    return u.value;
}

ReadLE16U_union:
        push    {r7, lr}
        ldrb    r3, [r0]
        ldrb    r0, [r0, #1]
        add     r7, sp, #0
        mov     sp, r7
        lsl     r0, r0, #8
        orr     r0, r0, r3
        @ sp needed for prologue
        pop     {r7, pc}
        .size   ReadLE16U_union, .-ReadLE16U_union
        .ident  "GCC: (GNU) 4.5.4 20120308 (prerelease)"


  parent reply	other threads:[~2012-03-15  8:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 12:34 [Bug rtl-optimization/45813] New: alias analysis problem ? darrenrjenkins at gmail dot com
2010-09-28 14:06 ` [Bug rtl-optimization/45813] " rguenth at gcc dot gnu.org
2010-09-28 15:09 ` mikpe at it dot uu.se
2010-09-29 11:04 ` darrenrjenkins at gmail dot com
2010-09-29 11:04 ` mikpe at it dot uu.se
2010-09-29 11:20 ` darrenrjenkins at gmail dot com
2010-09-29 11:21 ` darrenrjenkins at gmail dot com
2010-09-29 12:01 ` darrenrjenkins at gmail dot com
2010-09-29 12:48 ` rguenth at gcc dot gnu.org
2010-09-30  1:18 ` mikpe at it dot uu.se
2010-09-30  4:50 ` mikpe at it dot uu.se
2010-09-30 10:58 ` [Bug rtl-optimization/45813] [4.4/4.5 Regression] alias analysis problem with -mthumb rguenth at gcc dot gnu.org
2010-10-01 11:53 ` jakub at gcc dot gnu.org
2010-11-12 14:04 ` rguenth at gcc dot gnu.org
2011-04-16 10:15 ` jakub at gcc dot gnu.org
2011-04-19  9:06 ` rguenth at gcc dot gnu.org
2012-03-13 14:40 ` [Bug rtl-optimization/45813] [4.5 " jakub at gcc dot gnu.org
2012-03-13 17:06 ` bernds at gcc dot gnu.org
2012-03-15  8:45 ` mikpe at it dot uu.se [this message]
2012-07-02 10:46 ` rguenth at gcc dot gnu.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=bug-45813-4-J3gCrHlWOB@http.gcc.gnu.org/bugzilla/ \
    --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).