views:

26

answers:

0

This is probably a simple, obvious thing I'm just not seeing, but how do I load an address in a MIPS64 processor? In a MIPS32 processor the following assembler pseudo-instruction:

la $at, LabelAddr

Expands into:

lui $at, LabelAddr[31:16]
ori $at,$at, LabelAddr[15:0]

Looking at the MIPS64 instruction set, I see that lui still loads a 16-bit immediate into the upper half of a 32-bit word. There doesn't appear to be any kind of expanded instruction that loads an immediate anywhere into the upper area of a 64-bit word. This seems, then, that to do the equivalent of an la pseudo-instruction I'd need to expand into code something like:

lui $at, LabelAddr[63:48]
ori $at, $at, LabelAddr[47:32]
sll $at, 16
ori $at, $at, LabelAddr[31:16]
sll $at, 16
ori $at, $at, LabelAddr[15:0]

This strikes me as a bit ... convoluted for something as basic as loading an address so it leaves me convinced that I've overlooked something.

What is it I've overlooked (if anything)?