public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16355] New: Duplicate function epilog
@ 2004-07-04 5:10 anton at samba dot org
2004-07-04 7:05 ` [Bug c/16355] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: anton at samba dot org @ 2004-07-04 5:10 UTC (permalink / raw)
To: gcc-bugs
A 3.5 powerpc64 toolchain from cvs (20040703) was used to compile a linux
kernel. I noticed some functions had more than one function epilog. A cut down
testcase is:
int foo(a)
{
if (a)
return 1;
#if 1
bar();
#endif
return 0;
}
When the call to bar() is present we get 2 function epilogs:
.foo:
cmpdi 7,3,0
mflr 0
li 3,1
std 0,16(1)
stdu 1,-112(1)
beq- 7,.L6
addi 1,1,112
ld 0,16(1)
mtlr 0
blr
.L6:
bl .bar
nop
addi 1,1,112
li 3,0
ld 0,16(1)
mtlr 0
blr
We only duplicate 4 instructions here, but on functions which spill a large
number of registers the duplication is worse.
--
Summary: Duplicate function epilog
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anton at samba dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16355
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/16355] Duplicate function epilog
2004-07-04 5:10 [Bug c/16355] New: Duplicate function epilog anton at samba dot org
@ 2004-07-04 7:05 ` pinskia at gcc dot gnu dot org
2004-07-04 7:44 ` anton at samba dot org
2004-07-04 7:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-04 7:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-04 07:05 -------
If you want size reduced use -Os, this is done for speed reasons since you do not have to branch back.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16355
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/16355] Duplicate function epilog
2004-07-04 5:10 [Bug c/16355] New: Duplicate function epilog anton at samba dot org
2004-07-04 7:05 ` [Bug c/16355] " pinskia at gcc dot gnu dot org
@ 2004-07-04 7:44 ` anton at samba dot org
2004-07-04 7:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: anton at samba dot org @ 2004-07-04 7:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From anton at samba dot org 2004-07-04 07:44 -------
If we schedule it properly the branch should be free on POWER4, 970 etc.
futex_requeue is an example of what Im worried about, the duplication is a
rather big abuser of icache:
c000000000078d74: 38 21 01 10 addi r1,r1,272
c000000000078d78: 7f 63 db 78 mr r3,r27
c000000000078d7c: e8 01 00 10 ld r0,16(r1)
c000000000078d80: ea a1 ff a8 ld r21,-88(r1)
c000000000078d84: ea c1 ff b0 ld r22,-80(r1)
c000000000078d88: ea e1 ff b8 ld r23,-72(r1)
c000000000078d8c: eb 01 ff c0 ld r24,-64(r1)
c000000000078d90: eb 21 ff c8 ld r25,-56(r1)
c000000000078d94: eb 41 ff d0 ld r26,-48(r1)
c000000000078d98: eb 61 ff d8 ld r27,-40(r1)
c000000000078d9c: eb 81 ff e0 ld r28,-32(r1)
c000000000078da0: eb a1 ff e8 ld r29,-24(r1)
c000000000078da4: 7c 08 03 a6 mtlr r0
c000000000078da8: eb c1 ff f0 ld r30,-16(r1)
c000000000078dac: eb e1 ff f8 ld r31,-8(r1)
c000000000078db0: 4e 80 00 20 blr
c000000000078db4: 3b 60 ff f2 li r27,-14
c000000000078db8: 4b ff ff 80 b c000000000078d38
<.futex_requeue+0x12c>
c000000000078dbc: e8 7e 80 28 ld r3,-32728(r30)
c000000000078dc0: 38 80 01 66 li r4,358
c000000000078dc4: 4b fd 4f 85 bl c00000000004dd48 <.__might_sleep>
c000000000078dc8: 60 00 00 00 nop
c000000000078dcc: 7f 6a db 78 mr r10,r27
c000000000078dd0: 81 1d 00 00 lwz r8,0(r29)
c000000000078dd4: 4b ff ff 48 b c000000000078d1c
<.futex_requeue+0x110>
c000000000078dd8: 48 18 22 79 bl c0000000001fb050 <.rwsem_wake>
c000000000078ddc: 60 00 00 00 nop
c000000000078de0: 38 21 01 10 addi r1,r1,272
c000000000078de4: 7f 63 db 78 mr r3,r27
c000000000078de8: e8 01 00 10 ld r0,16(r1)
c000000000078dec: ea a1 ff a8 ld r21,-88(r1)
c000000000078df0: ea c1 ff b0 ld r22,-80(r1)
c000000000078df4: ea e1 ff b8 ld r23,-72(r1)
c000000000078df8: eb 01 ff c0 ld r24,-64(r1)
c000000000078dfc: eb 21 ff c8 ld r25,-56(r1)
c000000000078e00: eb 41 ff d0 ld r26,-48(r1)
c000000000078e04: eb 61 ff d8 ld r27,-40(r1)
c000000000078e08: eb 81 ff e0 ld r28,-32(r1)
c000000000078e0c: eb a1 ff e8 ld r29,-24(r1)
c000000000078e10: 7c 08 03 a6 mtlr r0
c000000000078e14: eb c1 ff f0 ld r30,-16(r1)
c000000000078e18: eb e1 ff f8 ld r31,-8(r1)
c000000000078e1c: 4e 80 00 20 blr
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16355
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/16355] Duplicate function epilog
2004-07-04 5:10 [Bug c/16355] New: Duplicate function epilog anton at samba dot org
2004-07-04 7:05 ` [Bug c/16355] " pinskia at gcc dot gnu dot org
2004-07-04 7:44 ` anton at samba dot org
@ 2004-07-04 7:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-04 7:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-04 07:54 -------
Give the full example, instead of the cut down one then because right now the cut down one is faster
with the duplication, and yes the branch can be free but usually is not. Oh and if you do something
werid like a lot of sib calling, you would consider that a huge hit also when in fact it can save you a
couple of cycles instead. Note if we dup the epilog we can schedule it with the previous instructions
and get a little speed increase. Also again -Os disables the duplication.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16355
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-04 7:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-04 5:10 [Bug c/16355] New: Duplicate function epilog anton at samba dot org
2004-07-04 7:05 ` [Bug c/16355] " pinskia at gcc dot gnu dot org
2004-07-04 7:44 ` anton at samba dot org
2004-07-04 7:54 ` 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).