Re: [PATCH -v1] MIPS: a few of fixups and cleanups for the compressed kernel support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2009 at 10:16:14AM +0800, Chih-hung Lu wrote:

> May I ask a question,
> what is the difference between "addu a0, 4" and "addiu a0, a0, 4"?

That's because you are human - you're smart enough to notice the difference
without even thinking about it :)

The machine instructions addu and addiu differ.  Addiu takes an immediate
constant as it's last op.  Addu takes a register instead.  Now the assembler
is trying to make things a little easier to us.  Depending on the type of
the last argument it will assemble an "addu" assembler instruction either
into an addiu or addu.

The other difference between the two instructions used in your example is
that the first has two operands, the other three operands.  If there is
only two operands, the assembler will implicitly assume, that the 2nd
register is the same as the first register.

Or in other words, the code generated from both will be entirely identical.

  Ralf


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux