public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/66179] New: Sub-optimal code generation with __attribute__((leaf))
@ 2015-05-17 5:10 mednafen at sent dot com
2015-05-17 5:23 ` [Bug other/66179] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: mednafen at sent dot com @ 2015-05-17 5:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66179
Bug ID: 66179
Summary: Sub-optimal code generation with __attribute__((leaf))
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: mednafen at sent dot com
Target Milestone: ---
Created attachment 35556
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35556&action=edit
C code which demonstrates the issue.
The attached code, when compiled like(for example):
gcc -fno-asynchronous-unwind-tables -O2 -S -o leaf.s -c leaf.c
(with 4.9.2 or 5.1.0, Linux x86_64)
produces bloated, sub-optimal assembly like:
test_call_leaf:
pushq %r12
pushq %rbp
pushq %rbx
movl a(%rip), %r12d
movl c(%rip), %ebx
call function_leaf
movl b(%rip), %ebp
addl $2, %r12d
addl $2, %ebx
movl %r12d, a(%rip)
call function_leaf
addl $2, %ebp
movl %ebx, c(%rip)
movl %ebp, b(%rip)
popq %rbx
popq %rbp
popq %r12
ret
compared to a more optimal possibility:
test_call_normal:
subq $8, %rsp
addl $2, a(%rip)
call function_normal
addl $2, b(%rip)
call function_normal
addl $2, c(%rip)
addq $8, %rsp
ret
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug other/66179] Sub-optimal code generation with __attribute__((leaf))
2015-05-17 5:10 [Bug other/66179] New: Sub-optimal code generation with __attribute__((leaf)) mednafen at sent dot com
@ 2015-05-17 5:23 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-05-17 5:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66179
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias, missed-optimization
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to bug 5739.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-17 5:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-17 5:10 [Bug other/66179] New: Sub-optimal code generation with __attribute__((leaf)) mednafen at sent dot com
2015-05-17 5:23 ` [Bug other/66179] " 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).