public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/49127] New: -Os generates constant mov instead of instruction xor and mov when zeroing
@ 2011-05-23 15:44 msharov at users dot sourceforge.net
  2021-07-26 18:54 ` [Bug target/49127] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: msharov at users dot sourceforge.net @ 2011-05-23 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: -Os generates constant mov instead of instruction xor
                    and mov when zeroing
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: msharov@users.sourceforge.net


void zero (void* p) { *reinterpret_cast<ulong*>(p) = 0; }

Generates:

48 c7 07 00 00 00 00    movq   $0x0,(%rdi)

This is shorter by 2 bytes:

31 c0                   xor    %eax,%eax
48 89 07                mov    %rax,(%rdi)

And can be reused in further assignments of zero for more savings:

31 c0                   xor    %eax,%eax
48 89 07                mov    %rax,(%rdi)
48 89 47 04             mov    %rax,0x4(%rdi)


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

* [Bug target/49127] -Os generates constant mov instead of instruction xor and mov when zeroing
  2011-05-23 15:44 [Bug rtl-optimization/49127] New: -Os generates constant mov instead of instruction xor and mov when zeroing msharov at users dot sourceforge.net
@ 2021-07-26 18:54 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 11877 and is fixed on the trunk.

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

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

end of thread, other threads:[~2021-07-26 18:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 15:44 [Bug rtl-optimization/49127] New: -Os generates constant mov instead of instruction xor and mov when zeroing msharov at users dot sourceforge.net
2021-07-26 18:54 ` [Bug target/49127] " 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).