This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: HI and LO qualifiers in MIPS assembly
- From: Thiemo Seufer <ths at networkno dot de>
- To: Nikolaos Kavvadias <nkavv at physics dot auth dot gr>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 10 Mar 2006 16:44:46 +0000
- Subject: Re: HI and LO qualifiers in MIPS assembly
- References: <4411A449.2010001@physics.auth.gr>
On Fri, Mar 10, 2006 at 06:07:37PM +0200, Nikolaos Kavvadias wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi there
>
> i have a question on some alternative syntaxes of the MIPS
> instructions regarding the %hi and
> %lo qualifiers. The %hi is necessary when specifying addition of a
> carry from the lower part
> highest bit.
>
> Sometimes gas emits what i believe is a macro-instruction, e.g. this
> one is for the LUI:
I assume you mean "gcc emits ..."
> lui $reg, %hi(symbol)
> e.g.
> lui $10,%hi(sym)
>
> another one is:
> lw $2, %lo(v)($10)
Those aren't macros (or, pedantically speaking, macros which just
expand to single instructions with the same mnemnonic). The %hi
and %lo tell gas/ld to encode the appropriate part of the symbol
value in the associated relocation.
> How can I expand these expressions into "normal" instructions, as
> these are defined in the MIPS32 architecture manual for programmers
> (vol. 2)?
lui and lw are MIPS32 instructions. There is also a lw macro in gas
which may expand into multiple instruction for e.g.
lw $1, sym($4)
With a percent op, you get a direct mapping to a relocation.
Thiemo