This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A patch for linux 2.1.127
- To: Linus Torvalds <torvalds at transmeta dot com>
- Subject: Re: A patch for linux 2.1.127
- From: Bernd Schmidt <crux at pool dot informatik dot rwth-aachen dot de>
- Date: Mon, 9 Nov 1998 21:42:38 +0100 (MET)
- cc: Richard Henderson <rth at cygnus dot com>, egcs at cygnus dot com, linux kernel <linux-kernel at vger dot rutgers dot edu>
On Sun, 8 Nov 1998, Linus Torvalds wrote:
> On Sun, 8 Nov 1998, Richard Henderson wrote:
> >
> > Unfortunately, those patches are way too massive to go back to the
> > 1.1 branch. For that I don't really know what to do.
>
> How about something simple like:
>
> if (SMALL_REGISTER_SET)
> never_inline_functions_unless_the_user_asked_for_it();
>
> which means that even with -O6 you would not inline functions unless they
> were marked inline.
>
> Note that this is not just a workaround for a bug.
It's not even a workaround for a bug. Function inlining has nothing to
do with the problem. The following testcase (gcc.dg/clobbers.c in the egcs
testsuite) demonstrates that:
int main ()
{
int i;
__asm__ ("movl $1,%0\n\txorl %%eax,%%eax" : "=r" (i) : : "eax");
if (i != 1)
abort ();
__asm__ ("movl $1,%0\n\txorl %%ebx,%%ebx" : "=r" (i) : : "ebx");
if (i != 1)
abort ();
__asm__ ("movl $1,%0\n\txorl %%ecx,%%ecx" : "=r" (i) : : "ecx");
if (i != 1)
abort ();
__asm__ ("movl $1,%0\n\txorl %%edx,%%edx" : "=r" (i) : : "edx");
if (i != 1)
abort ();
__asm__ ("movl $1,%0\n\txorl %%esi,%%esi" : "=r" (i) : : "esi");
if (i != 1)
abort ();
__asm__ ("movl $1,%0\n\txorl %%edi,%%edi" : "=r" (i) : : "edi");
if (i != 1)
abort ();
return 0;
}
It might be possible to construct a workaround for egcs-1.1, but it would most
likely be rather ugly, and it doesn't help people who use gcc-2.7.2 or
egcs-1.0.3. The simplest workaround is to avoid using clobbers on the x86.
Bernd