Encoding:

AUI

000100

rt

rs

immediate

DAUI

111100

rt

rs

immediate

POOL32I

010000

DAHI

10001

rs

immediate

POOL32I

010000

DATI

10000

rs

immediate

6

5

5

16

Format:

AUI DAUI DAHI DATI 

Add Upper Immediate

AUI rt, rs immediate

microMIPS32 Release 6

Add Upper Immediate

DAUI rt, rs immediate

microMIPS64 Release 6

Doubleword Add Upper Immediate

DAHI rs, rs immediate

microMIPS64 Release 6

Doubleword Add Higher Immediate

DATI rs, rs immediate

microMIPS64 Release 6

Doubleword Add Top Immediate

Purpose:

Add Immediate to Upper Bits

AUI: Add Upper Immediate

DAUI: Doubleword Add Upper Immediate

DAHI: Doubleword Add Higher Immediate

DATI: Doubleword Add Top Immediate

Description:

AUI:  GPR[rt] = sign_extend.32( GPR[rs] + sign_extend(immediate << 16) )
DAUI: GPR[rt] = GPR[rs] + sign_extend(immediate << 16)
DAHI: GPR[rs] = GPR[rs] + sign_extend(immediate << 32)
DATI: GPR[rs] = GPR[rs] + sign_extend(immediate << 48)

AUI: The 16 bit immediate is shifted left 16 bits, sign-extended, and added to the register rs, storing the result in rt.

AUI is a 32-bit compatible instruction, so on a 64-bit CPU the result is sign extended as if a 32-bits signed address.

DAHI: The 16 bit immediate is shifted left 32 bits, sign-extended, and added to the register rs, overwriting rs with the result.

DATI: The 16 bit immediate is shifted left 48bits, sign-extended, and added to the register rs, overwriting rs with the result.

DAUI: The 16-bit immediate is shifted left 16 bits, sign-extended, and added to the register rs; the results are stored in rt.

In Release 6, LUI is an assembly idiom for AUI with rs=0.

Restrictions:

DAUI: rs cannot be r0, the zero register. The encoding may be used for other instructions or must signal a Reserved

Instruction exception.

DAUI, DAHI, DATI: Reserved Instruction exception if 64-bit instructions are not enabled.

Availability and Compatibility:

AUI is introduced by and required as of Release 6.

DAUI is introduced by and required as of MIPS64 Release 6.

DAHI is introduced by and required as of MIPS64 Release 6.

DATI is introduced by and required as of MIPS64 Release 6.

Operation:

AUI:  GPR[rt] = sign_extend.32( GPR[rs] + sign_extend(immediate << 16) )
DAUI: GPR[rt] = GPR[rs] + sign_extend(immediate << 16)
DAHI: GPR[rs] = GPR[rs] + sign_extend(immediate << 32)
DATI: GPR[rs] = GPR[rs] + sign_extend(immediate << 48)

Exceptions:

AUI: None.

DAUI, DAHI, DATI: Reserved Instruction

Programming Notes:

AUI (and DAUI, DAHI and DATI on MIPS64 Release 6) can be used to synthesize large constants in situations where it is not convenient to load a large constant from memory. To simplify hardware that may recognize sequences of instructions as generating large constants, AUI/DAUI/DAHI/DATI should be used in a stylized manner.

To create an integer:

LUI rd, imm_low(rtmp)
ORI rd, rd, imm_upper
DAHI rd, imm_high
DATI rd, imm_top

To create a large offset for a memory access whose address is of the form rbase+large_offset:

AUI rtmp, rbase, imm_upper
DAHI rtmp, imm_high
DATI rtmp, imm_top
LW rd, (rtmp)imm_low

To create a large constant operand for an instruction of the form rd:=rs+large_immediate or rd:=rs-large_immediate:

32-bits:

AUI  rtmp, rs,  imm_upper
ADDIU rd,  rtmp, imm_low

64-bits:

AUI  rtmp, rs, imm_upper
DAHI rtmp, imm_high
DATI rtmp, imm_top
DADDUI rd, rtmp,imm_low