Message ID | 20190202103238.GC2135@tucnak |
---|---|
State | New |
Headers | show |
Series | Fix up gcc.target/i386/call-1.c testcase (PR rtl-optimization/11304) | expand |
On Feb 2, 2019, at 2:32 AM, Jakub Jelinek <jakub@redhat.com> wrote: > > Regardless of the PR87485 decision, I think we should fix this testcase. > ok for trunk? Ok. > 2019-02-02 Jakub Jelinek <jakub@redhat.com> > > PR rtl-optimization/11304 > * gcc.target/i386/call-1.c (set_eax): Add "eax" clobber. > * gcc.target/i386/call-2.c: New test. > > void set_eax(int val) > { > - __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val)); > + __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val) : "eax"); > }
--- gcc/testsuite/gcc.target/i386/call-1.c.jj 2008-09-05 12:54:23.000000000 +0200 +++ gcc/testsuite/gcc.target/i386/call-1.c 2019-02-02 11:23:25.566902736 +0100 @@ -11,7 +11,7 @@ volatile int r; void set_eax(int val) { - __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val)); + __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val) : "eax"); } void foo(int val) --- gcc/testsuite/gcc.target/i386/call-2.c.jj 2019-02-02 11:23:31.922797178 +0100 +++ gcc/testsuite/gcc.target/i386/call-2.c 2019-02-02 11:23:47.757534186 +0100 @@ -0,0 +1,12 @@ +/* PR optimization/11304 */ +/* Originator: <manuel.serrano@sophia.inria.fr> */ +/* { dg-do run } */ +/* { dg-options "-O -fomit-frame-pointer" } */ + +/* Verify that %eax is always restored after a call. */ + +__attribute__((noipa)) void set_eax(int val); +__attribute__((noipa)) void foo(int val); +__attribute__((noipa)) int bar(int x); + +#include "call-1.c"