public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/36661] New: x86 asm "+r" operands cause unnecessary spills/copies
@ 2008-06-28 23:35 astrange at ithinksw dot com
2008-06-28 23:35 ` [Bug target/36661] " astrange at ithinksw dot com
0 siblings, 1 reply; 2+ messages in thread
From: astrange at ithinksw dot com @ 2008-06-28 23:35 UTC (permalink / raw)
To: gcc-bugs
Compiling the attached source on i386 with:
> gcc -O3 -fomit-frame-pointer -fno-pic -S asm-spills.i
produces:
.text
.align 4,0x90
.globl _get_cabac_noinline
_get_cabac_noinline:
subl $76, %esp
movl %esi, 64(%esp)
movl %edi, 68(%esp)
movl %ebp, 72(%esp)
movl %ebx, 60(%esp)
movl 80(%esp), %esi
movl 84(%esp), %edi
movl (%esi), %edx
movl 4(%esi), %ebx
movl %edx, 28(%esp) # unused spill
movl %edx, %ebp # pointless move
# 24 "../strange-spills.i" 1
#%eax %bp %ebx 16(%esi) %edx (%edi)
# 0 "" 2
movl %ebp, (%esi)
movl %ebx, 4(%esi)
andl $1, %eax
movl 60(%esp), %ebx
movl %eax, 44(%esp) #unused spill
movl 64(%esp), %esi
movl 68(%esp), %edi
movl 72(%esp), %ebp
addl $76, %esp
ret
.subsections_via_symbols
which has several unnecessary stack spills.
Reading through RTL dumps:
- everything is fine before asmcons
- asmcons inserts copies of c->low/range after they're loaded. There's no point
to this, since the original is never used later, but I guess there isn't a
problem as long as it's cleaned up.
- Somehow, the RA gets confused by the asmcons copy and the later one to copy
the return value into eax. Instead of assigning both sides of the copy to the
same register (which is obviously possible), or even using mov, it spills and
reloads them into different registers.
- Later passes optimize away the reloads but keep the stores.
This isn't a regression (gcc 3.4 isn't much better) and still happens in the
IRA branch. For some reason, changing "=&q"(tmp) to "=&d" improves IRA but not
trunk.
This is about the same source as
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36539.
--
Summary: x86 asm "+r" operands cause unnecessary spills/copies
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: astrange at ithinksw dot com
GCC target triplet: i?86-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36661
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/36661] x86 asm "+r" operands cause unnecessary spills/copies
2008-06-28 23:35 [Bug target/36661] New: x86 asm "+r" operands cause unnecessary spills/copies astrange at ithinksw dot com
@ 2008-06-28 23:35 ` astrange at ithinksw dot com
0 siblings, 0 replies; 2+ messages in thread
From: astrange at ithinksw dot com @ 2008-06-28 23:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from astrange at ithinksw dot com 2008-06-28 23:35 -------
Created an attachment (id=15823)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15823&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36661
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-28 23:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-28 23:35 [Bug target/36661] New: x86 asm "+r" operands cause unnecessary spills/copies astrange at ithinksw dot com
2008-06-28 23:35 ` [Bug target/36661] " astrange at ithinksw dot com
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).