------- Comment #1 from pinskia at gmail dot com  2010-05-29 15:39 -------
Subject: Re:   New: IRA/reload moves asm statement

I don't think this is valid. You cannot depend on where the spill will  
happen around a function call. It is spilling to save the volatile  
register. With -O, we don't use volatile registers to keep variables  
across functions. While at -O2 we do so it saves it right before the  
function call.

Sent from my iPhone

On May 29, 2010, at 8:25 AM, "hjl dot tools at gmail dot com"
<gcc-bugzi...@gcc.gnu.org 
 > wrote:

> On Linux/x86-64, IRA/reload moves asm statement by
> adding "movss" at -O2:
>
> [...@gnu-6 vzeroupper-1]$ cat foo.c
> extern void bar2 (void);
> float
> foo (float y)
> {
>  asm volatile ("nop");
>  bar2 ();
>  return y;
> }
> [...@gnu-6 vzeroupper-1]$ gcc -S -O foo.c
> [...@gnu-6 vzeroupper-1]$ cat foo.s
>        .file   "foo.c"
>        .text
> .globl foo
>        .type   foo, @function
> foo:
> .LFB0:
>        .cfi_startproc
>        subq    $24, %rsp
>        .cfi_def_cfa_offset 32
>        movss   %xmm0, 12(%rsp)
> #APP
> # 5 "foo.c" 1
>        nop
> # 0 "" 2
> #NO_APP
>        call    bar2
>        movss   12(%rsp), %xmm0
>        addq    $24, %rsp
>        .cfi_def_cfa_offset 8
>        ret
>        .cfi_endproc
> .LFE0:
>        .size   foo, .-foo
>        .ident  "GCC: (GNU) 4.4.3 20100127 (Red Hat 4.4.3-4)"
>        .section        .note.GNU-stack,"",@progbits
> [...@gnu-6 vzeroupper-1]$ gcc -S -O2 foo.c
> [...@gnu-6 vzeroupper-1]$ cat foo.s
>        .file   "foo.c"
>        .text
>        .p2align 4,,15
> .globl foo
>        .type   foo, @function
> foo:
> .LFB0:
>        .cfi_startproc
>        subq    $24, %rsp
>        .cfi_def_cfa_offset 32
> #APP
> # 5 "foo.c" 1
>        nop
> # 0 "" 2
> #NO_APP
>        movss   %xmm0, (%rsp)
>        call    bar2
>        movss   (%rsp), %xmm0
>        addq    $24, %rsp
>        .cfi_def_cfa_offset 8
>        ret
>        .cfi_endproc
> .LFE0:
>        .size   foo, .-foo
>        .ident  "GCC: (GNU) 4.4.3 20100127 (Red Hat 4.4.3-4)"
>        .section        .note.GNU-stack,"",@progbits
> [...@gnu-6 vzeroupper-1]$
>
>
> -- 
>           Summary: IRA/reload moves asm statement
>           Product: gcc
>           Version: 4.6.0
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: rtl-optimization
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: hjl dot tools at gmail dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44323
>


-- 


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

Reply via email to