Re: egcs 1.0.1 miscompiles Linux 2.0.33

Mathias Froehlich (frohlich@na.mathematik.uni-tuebingen.de)
Mon, 2 Mar 1998 14:29:57 +0100 (MET)


> On Sun, Mar 01, 1998 at 01:59:56PM -0800, Linus Torvalds wrote:
> > #define restore_flags(restore_value) \
> > asm("rdwrexception %0\n\t" \
> > "andl $0xfffffffe,%0\n\t" \
> > "orl %1,%0\n\t" \
> > "rdwrexception %0" \
> > : /* no outputs */ \
> > :"c" (0xffffffff), \
> > "g" (restore_value) \
> > :"cx")
> >
> > Now, how should I re-write this to avoid the clobber?
> >
> > I could use "=c" and "0" to tell gcc that %ecx is a read-write thing and
> > will change. But that doesn't tell gcc that it mustn't use %ecx for the
> > value in "restore_value"
>
> You should use "=&c" to say that the output should use a new register.
> That output will be shared with no other input except an explicit "0".

Note that the condition code register is clobbered here, so "cc" should be
included in the list of clobbered registers!

Regards...

Mathias Fr"ohlich

-- 
Mathias Fr"ohlich              e-mail: frohlich@na.uni-tuebingen.de
Institut f"ur Mathematik, Universit"at T"ubingen, D-72076 T"ubingen

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu