public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers
@ 2015-03-14 18:16 fuz at fuz dot su
  2015-03-14 18:44 ` [Bug tree-optimization/65426] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fuz at fuz dot su @ 2015-03-14 18:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426

            Bug ID: 65426
           Summary: Recognize byte-swaps when writing to buffers
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fuz at fuz dot su

Created attachment 35036
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35036&action=edit
Various instances of the aforementioned pattern

It would be great if gcc could recognize code like this:

    static inline void
    wm32(uint8_t a[4], uint32_t x)
    {
        a[0] = x >> 24;
        a[1] = x >> 16;
        a[2] = x >>  8;
        a[3] = x >>  0;
    }

and turn it into a single unaligned write (and perhaps a byte swap on platforms
where this is supported). This kind of code appears when one tries to write
marshalling code in a portable fashion.

Attached is a file containing various instances of this pattern.


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

* [Bug tree-optimization/65426] Recognize byte-swaps when writing to buffers
  2015-03-14 18:16 [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers fuz at fuz dot su
@ 2015-03-14 18:44 ` pinskia at gcc dot gnu.org
  2015-03-14 19:33 ` fuz at fuz dot su
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-03-14 18:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This one was implemented or maybe only where the load and stores happen.


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

* [Bug tree-optimization/65426] Recognize byte-swaps when writing to buffers
  2015-03-14 18:16 [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers fuz at fuz dot su
  2015-03-14 18:44 ` [Bug tree-optimization/65426] " pinskia at gcc dot gnu.org
@ 2015-03-14 19:33 ` fuz at fuz dot su
  2015-03-18 11:38 ` rguenth at gcc dot gnu.org
  2021-12-28  6:41 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fuz at fuz dot su @ 2015-03-14 19:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426

--- Comment #2 from Robert Clausecker <fuz at fuz dot su> ---
I tried compiling this code (without static inline) on a trunk (r221432) gcc
and it didn't recognize the pattern. Is there a pattern with the same effect
that gets recognized?


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

* [Bug tree-optimization/65426] Recognize byte-swaps when writing to buffers
  2015-03-14 18:16 [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers fuz at fuz dot su
  2015-03-14 18:44 ` [Bug tree-optimization/65426] " pinskia at gcc dot gnu.org
  2015-03-14 19:33 ` fuz at fuz dot su
@ 2015-03-18 11:38 ` rguenth at gcc dot gnu.org
  2021-12-28  6:41 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-18 11:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-18
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
stores are not yet supported by the pass.  And I think this bug has a
duplicate.


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

* [Bug tree-optimization/65426] Recognize byte-swaps when writing to buffers
  2015-03-14 18:16 [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers fuz at fuz dot su
                   ` (2 preceding siblings ...)
  2015-03-18 11:38 ` rguenth at gcc dot gnu.org
@ 2021-12-28  6:41 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-28  6:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |10.0
      Known to fail|                            |7.1.0
      Known to work|                            |10.1.0, 12.0
         Resolution|---                         |FIXED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
All functions are detected and fixed in GCC 10+. A few were fixed in GCC 8 and
GCC 9 even.

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

end of thread, other threads:[~2021-12-28  6:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14 18:16 [Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers fuz at fuz dot su
2015-03-14 18:44 ` [Bug tree-optimization/65426] " pinskia at gcc dot gnu.org
2015-03-14 19:33 ` fuz at fuz dot su
2015-03-18 11:38 ` rguenth at gcc dot gnu.org
2021-12-28  6:41 ` pinskia at gcc dot gnu.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).