public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/25295]  New: unused register saved in function prolog
@ 2005-12-07 15:09 bcrl at kvack dot org
  2005-12-07 15:10 ` [Bug middle-end/25295] " bcrl at kvack dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bcrl at kvack dot org @ 2005-12-07 15:09 UTC (permalink / raw)
  To: gcc-bugs

The attached code compiled with the command line below results in the following
assembly that saves an unused register (r8) in the function prolog.

gcc -fno-strict-aliasing -fno-common -ffreestanding -Os    
-fomit-frame-pointer -march=nocona -ffixed-r10 -mno-red-zone -mcmodel=kernel
-pipe -fno-reorder-blocks   -fno-asynchronous-unwind-tables -funit-at-a-time
-mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wdeclaration-after-statement
-Wno-pointer-sign -S rw-double-save.c
        .file   "rw-double-save.c"
        .text
.globl sys_read
        .type   sys_read, @function
sys_read:
        pushq   %r13
        pushq   %r12
        pushq   %rbp
        pushq   %rbx
        pushq   %r8
        movq    %rsi, %r13
        movq    %rdx, %r12
        call    fget_light
        movq    %rax, %rbx
        cmpq    $-1000, %rax
        jle     .L2
        movq    %rax, %rdx
        jmp     .L4
.L2:
        movq    16(%rax), %rbp
        movq    %rbp, %rcx
        movq    %r12, %rdx
        movq    %r13, %rsi
        movq    %rax, %rdi
        call    vfs_read
        movq    %rax, %rdx
        testq   %rax, %rax
        jle     .L5
        testb   $16, 8(%rbx)
        jne     .L5
        leaq    (%rbp,%rax), %rax
        movq    %rax, 16(%rbx)
.L5:
        cmpq    $0, 8(%r10)
        je      .L4
        movq    %rdx, %rsi
        movq    %rbx, %rdi
        popq    %rcx
        popq    %rbx
        popq    %rbp
        popq    %r12
        popq    %r13
        jmp     fput_ret
.L4:
        movq    %rdx, %rax
        popq    %rdx
        popq    %rbx
        popq    %rbp
        popq    %r12
        popq    %r13
        ret
        .size   sys_read, .-sys_read
        .ident  "GCC: (GNU) 4.2.0 20051202 (experimental)"
        .section        .note.GNU-stack,"",@progbits


-- 
           Summary: unused register saved in function prolog
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bcrl at kvack dot org
 GCC build triplet: x86_64-unknown-linux
  GCC host triplet: x86_64-unknown-linux
GCC target triplet: x86_64-unknown-linux


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/25295] unused register saved in function prolog
  2005-12-07 15:09 [Bug middle-end/25295] New: unused register saved in function prolog bcrl at kvack dot org
@ 2005-12-07 15:10 ` bcrl at kvack dot org
  2005-12-12 20:46 ` [Bug target/25295] " pinskia at gcc dot gnu dot org
  2006-12-04 23:21 ` michael dot meissner at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: bcrl at kvack dot org @ 2005-12-07 15:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bcrl at kvack dot org  2005-12-07 15:10 -------
Created an attachment (id=10433)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10433&action=view)
test case


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/25295] unused register saved in function prolog
  2005-12-07 15:09 [Bug middle-end/25295] New: unused register saved in function prolog bcrl at kvack dot org
  2005-12-07 15:10 ` [Bug middle-end/25295] " bcrl at kvack dot org
@ 2005-12-12 20:46 ` pinskia at gcc dot gnu dot org
  2006-12-04 23:21 ` michael dot meissner at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-12 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-12 20:46 -------
It comes after splitting a RTL pattern.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/25295] unused register saved in function prolog
  2005-12-07 15:09 [Bug middle-end/25295] New: unused register saved in function prolog bcrl at kvack dot org
  2005-12-07 15:10 ` [Bug middle-end/25295] " bcrl at kvack dot org
  2005-12-12 20:46 ` [Bug target/25295] " pinskia at gcc dot gnu dot org
@ 2006-12-04 23:21 ` michael dot meissner at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: michael dot meissner at amd dot com @ 2006-12-04 23:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from michael dot meissner at amd dot com  2006-12-04 23:21 -------
I've done some analysis on the test case.  The current GCC 4.2 and mainline
branches no longer generate the initial push of %r8, but instead do a subq
$8,%rsp.  I believe in the compiler you used it did the push to allocate 8
bytes of stack instead of the subtract.  Note, the epilogue still uses a pop to
remove the stack location.  The core of the problem is that the compiler is
allocating 8 bytes too much stack in this particular case.  I think I
understand whats going on, but I want to dig a bit more.


-- 

michael dot meissner at amd dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michael dot meissner at amd
                   |                            |dot com


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-04 23:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 15:09 [Bug middle-end/25295] New: unused register saved in function prolog bcrl at kvack dot org
2005-12-07 15:10 ` [Bug middle-end/25295] " bcrl at kvack dot org
2005-12-12 20:46 ` [Bug target/25295] " pinskia at gcc dot gnu dot org
2006-12-04 23:21 ` michael dot meissner at amd 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).