linux-mips
[Top] [All Lists]

Re: mips inline asm question

To: ?$B9uDE ?$B4pLo <mips4700@yahoo.co.jp>
Subject: Re: mips inline asm question
From: Ralf Baechle <ralf@linux-mips.org>
Date: Tue, 23 Sep 2003 23:22:09 -0700
Cc: linux-mips@linux-mips.org
In-reply-to: <20030924060456.11903.qmail@web2307.mail.yahoo.co.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20030924060456.11903.qmail@web2307.mail.yahoo.co.jp>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.1i
On Wed, Sep 24, 2003 at 03:04:56PM +0900, ?$B9uDE ?$B4pLo wrote:

> The following code is from
> linux-2.4.20/include/asm-mips/mipsregs.h.
> Could anyone tell how the difference between %z0 ("Jr")
> and %0 ("r") is?
> I compiled this code and deassemble the object, but I
> can't find any 
> difference with my toolchains(gcc-2.95.3, binutils-2.11).
> 
> static inline void set_context(unsigned long val)
> {
>         __asm__ __volatile__(
>                 ".set push\n\t"
>                 ".set reorder\n\t"
>                 "mtc0 %z0, $4\n\t"
>                 ".set pop"
>                 : : "Jr" (val));
> }

%z0 is just like %0 except if %0 has the value of 0 the compiler will insert
register $0.  "Jr" mean the compiler can either use a register or the
constant zero.  Both combined mean the compiler will not waste a real
register but use $zero.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>