public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42587]  New: bswap not recognized for union
@ 2010-01-03  6:15 andi-gcc at firstfloor dot org
  2010-01-03 10:58 ` [Bug tree-optimization/42587] bswap not recognized for memory rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-01-03  6:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-10 12:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42587-4@http.gcc.gnu.org/bugzilla/>
2012-02-22 13:51 ` [Bug tree-optimization/42587] bswap not recognized for memory xiaoyuanbo at yeah dot net
2021-05-08 13:17 ` peter at cordes dot ca
2021-05-09 21:02 ` andi at firstfloor dot org
2021-05-10 12:21 ` cvs-commit at gcc dot gnu.org
2021-05-10 12:22 ` hjl.tools at gmail dot com
2010-01-03  6:15 [Bug tree-optimization/42587] New: bswap not recognized for union andi-gcc at firstfloor dot org
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

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).