public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/11877] New: gcc should use xor trick with -Os
@ 2003-08-10 15:47 debian-gcc at lists dot debian dot org
2003-08-10 16:03 ` [Bug target/11877] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2003-08-10 15:47 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
@ 2003-08-10 16:03 ` pinskia at gcc dot gnu dot org
2003-08-23 1:15 ` dhazeghi at yahoo dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-10 16:03 UTC (permalink / raw)
To: gcc-bugs
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
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-08-10 16:03:50
date| |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-10 16:03 -------
I can confirm that the xor trick will be a size win.
The movl still happens with the mainline (20030810).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
2003-08-10 16:03 ` [Bug target/11877] " pinskia at gcc dot gnu dot org
@ 2003-08-23 1:15 ` dhazeghi at yahoo dot com
2003-12-31 21:39 ` kazu at cs dot umass dot edu
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23 1:15 UTC (permalink / raw)
To: gcc-bugs
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
dhazeghi at yahoo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|386-linux |i386-linux
GCC target triplet|386-linux |i386-linux
Target Milestone|3.4 |---
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
2003-08-10 16:03 ` [Bug target/11877] " pinskia at gcc dot gnu dot org
2003-08-23 1:15 ` dhazeghi at yahoo dot com
@ 2003-12-31 21:39 ` kazu at cs dot umass dot edu
2004-01-04 6:55 ` kazu at cs dot umass dot edu
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2003-12-31 21:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2003-12-31 21:19 -------
(set (mem:DI ...) (const_int 0)) is split into two moves in SImode after reload.
We could delay the split until after peephole2.
In peephole2, if a scratch reg is available,
load 0 into it with XOR and then copy that reg to two mem:SI locations.
Reduced to:
void
foo (long long *p)
{
*p = 0;
}
The reduction from 13 bytes down to 7 bytes sounds impressive.
My proposed solution would still leave two XORs, though.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |kazu at cs dot umass dot edu
AssignedTo|unassigned at gcc dot gnu |kazu at cs dot umass dot edu
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (2 preceding siblings ...)
2003-12-31 21:39 ` kazu at cs dot umass dot edu
@ 2004-01-04 6:55 ` kazu at cs dot umass dot edu
2004-01-04 7:50 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-01-04 6:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-01-04 06:55 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00153.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (3 preceding siblings ...)
2004-01-04 6:55 ` kazu at cs dot umass dot edu
@ 2004-01-04 7:50 ` pinskia at gcc dot gnu dot org
2004-02-01 17:24 ` kazu at cs dot umass dot edu
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-04 7:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-04 07:50 -------
What about expanding (set (mem:DI ...) (const_int 0)) at expand time, this will cause more
opportunities to happen and then the discusion is up to other parts of the compiler.
It looks like an easy change to ix86_expand_move.
Also interesting is that this testcase:
void
foo (long *p)
{
*p = 0;
p[1] = 0;
}
Does not use the xor trick either.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (4 preceding siblings ...)
2004-01-04 7:50 ` pinskia at gcc dot gnu dot org
@ 2004-02-01 17:24 ` kazu at cs dot umass dot edu
2004-03-25 19:16 ` kazu at cs dot umass dot edu
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-01 17:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-02-01 17:24 -------
Then we need something like an un-cse pass.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (5 preceding siblings ...)
2004-02-01 17:24 ` kazu at cs dot umass dot edu
@ 2004-03-25 19:16 ` kazu at cs dot umass dot edu
2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-25 19:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-03-25 19:16 -------
Even if you split the long move in ix86_expand_move,
the constant 0 is propagated into the two moves.
I guess the right way may be uncse sometime after register allocation.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (7 preceding siblings ...)
2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
@ 2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 5:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-12 05:27 -------
*** Bug 23338 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |dann at godzilla dot ics dot
| |uci dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/11877] gcc should use xor trick with -Os
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
` (6 preceding siblings ...)
2004-03-25 19:16 ` kazu at cs dot umass dot edu
@ 2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 5:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-12 05:28 -------
PR 23102 is the bug for multiple xors.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |23102
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11877
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-08-12 5:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-10 15:47 [Bug target/11877] New: gcc should use xor trick with -Os debian-gcc at lists dot debian dot org
2003-08-10 16:03 ` [Bug target/11877] " pinskia at gcc dot gnu dot org
2003-08-23 1:15 ` dhazeghi at yahoo dot com
2003-12-31 21:39 ` kazu at cs dot umass dot edu
2004-01-04 6:55 ` kazu at cs dot umass dot edu
2004-01-04 7:50 ` pinskia at gcc dot gnu dot org
2004-02-01 17:24 ` kazu at cs dot umass dot edu
2004-03-25 19:16 ` kazu at cs dot umass dot edu
2005-08-12 5:28 ` pinskia at gcc dot gnu dot org
2005-08-12 5:28 ` pinskia 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).