public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57302] New: Should merge zeroing multiple consecutive memory locations
@ 2013-05-16 15:24 msharov at users dot sourceforge.net
  2013-05-17  8:48 ` [Bug rtl-optimization/57302] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: msharov at users dot sourceforge.net @ 2013-05-16 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57302
           Summary: Should merge zeroing multiple consecutive memory
                    locations
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msharov at users dot sourceforge.net

struct A { short a,b; A (void); };
A::A (void) : a(0),b(0) {}
void MoveA (const A* a, A* b) { *b = *a; }

Generates:

_ZN1AC2Ev:
        movw    $0, (%rdi)
        movw    $0, 2(%rdi)
        ret
_Z5MoveAPK1APS_:
        movl    (%rdi), %eax
        movl    %eax, (%rsi)
        ret

The optimizer can see that a and b are consecutive in memory and can merge the
memory movs into a single 4-byte mov, but does not do the same for the zeroing
code in the constructor. Merging the zeroing to movl, movq, and mov[au]ps (when
SSE is available), would produce smaller code and fewer memory accesses.


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

* [Bug rtl-optimization/57302] Should merge zeroing multiple consecutive memory locations
  2013-05-16 15:24 [Bug rtl-optimization/57302] New: Should merge zeroing multiple consecutive memory locations msharov at users dot sourceforge.net
@ 2013-05-17  8:48 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-17  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There is a duplicate enhancement bugreport about this.

*** This bug has been marked as a duplicate of bug 23684 ***


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

end of thread, other threads:[~2013-05-17  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-16 15:24 [Bug rtl-optimization/57302] New: Should merge zeroing multiple consecutive memory locations msharov at users dot sourceforge.net
2013-05-17  8:48 ` [Bug rtl-optimization/57302] " rguenth 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).