public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andi-gcc at firstfloor dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/42587]  New: bswap not recognized for union
Date: Sun, 03 Jan 2010 06:15:00 -0000	[thread overview]
Message-ID: <bug-42587-7834@http.gcc.gnu.org/bugzilla/> (raw)

From
http://embed.cs.utah.edu/embarrassing/dec_09/harvest/gcc-head_llvm-gcc-head/

typedef unsigned char u8;
typedef unsigned int u32;
#pragma pack(1)
#pragma pack()
#pragma pack(1)
#pragma pack()
#pragma pack(1)
#pragma pack()
#pragma pack(4)
#pragma pack()
union __anonunion_out_195
{
  u32 value;
  u8 bytes[4];
};
union __anonunion_in_196
{
  u32 value;
  u8 bytes[4];
};
extern void acpi_ut_track_stack_ptr (void);
u32 acpi_ut_dword_byte_swap (u32 value);
u32
acpi_ut_dword_byte_swap (u32 value)
{
  union __anonunion_out_195 out;
  union __anonunion_in_196 in;

  {
    acpi_ut_track_stack_ptr ();
    in.value = value;
    out.bytes[0] = in.bytes[3];
    out.bytes[1] = in.bytes[2];
    out.bytes[2] = in.bytes[1];
    out.bytes[3] = in.bytes[0];
    return (out.value);
  }
}

/* Checksum = 1251E213 */


does not turn into bswap, while llvm does that.

There's bswap detection code in tree-ssa-math-ops.c, but it doesn't
seem to work for this union pattern. Perhaps it should?


-- 
           Summary: bswap not recognized for union
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andi-gcc at firstfloor dot org
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux


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


             reply	other threads:[~2010-01-03  6:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03  6:15 andi-gcc at firstfloor dot org [this message]
2010-01-03 10:58 ` [Bug tree-optimization/42587] bswap not recognized for memory rguenth at gcc dot gnu dot org
2010-01-03 16:01 ` rguenth at gcc dot gnu dot org
2010-01-03 16:26 ` rguenth at gcc dot gnu dot org
2010-01-06 14:07 ` jamborm at gcc dot gnu dot org
2010-02-27 20:04 ` 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=bug-42587-7834@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).