This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/11877] New: gcc should use xor trick with -Os


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: gcc should use xor trick with -Os
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org,herbert at gondor dot
                    apana dot org dot au
 GCC build triplet: 386-linux
  GCC host triplet: i386-linux
GCC target triplet: 386-linux

[forwarded from http://bugs.debian.org/204687]

The program 
 
-- 
#include <linux/time.h> 
 
void foo(struct timespec *t, struct timespec *u) 
{ 
        struct timespec zero = {0, 0}; 
 
        *t = zero; 
        *u = zero; 
} 
-- 
 
produces the following code on i386 with -Os 
 
-- 
        .file   "b.c" 
        .text 
.globl foo 
        .type   foo, @function 
foo: 
        pushl   %ebp 
        movl    %esp, %ebp 
        movl    8(%ebp), %eax 
        movl    $0, (%eax) 
        movl    $0, 4(%eax) 
        movl    12(%ebp), %eax 
        movl    $0, (%eax) 
        movl    $0, 4(%eax) 
        leave 
        ret 
        .size   foo, .-foo 
        .ident  "GCC: (GNU) 3.3.1 20030626 (Debian prerelease)" 
-- 
 
It would be much better size-wise if it stored a zero in a register 
and then stored the register into those locations.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]