ld


Data is loaded.

[Syntax]

-

ld.b disp[reg1], reg2

-

ld.h disp[reg1], reg2

-

ld.w disp[reg1], reg2

-

ld.bu disp[reg1], reg2

-

ld.hu disp[reg1], reg2

Note

For the detail of ld.dw, see ld23.dw.

 

The following can be specified for displacement (disp):

-

Absolute expression having a value of up to 32 bits

-

Relative expression

-

Either of the above expressions with LOWW applied

[Function]

The ld.b, ld.bu, ld.h, ld.hu, and ld.w instructions load data of 1 byte, 1 halfword, and 1 word, from the address specified by the first operand, int the register specified by the second operand.

[Description]

-

If any of the following is specified for disp, the assembler generates one ld machine instructionNote. In the following explanations, ld denotes the ld.b/ld.h/ld.w/ld.bu/ld.hu instructions.

(a)

Absolute expression having a value in the range of -32,768 to +32,767

ld      disp16[reg1], reg2
ld      disp16[reg1], reg2

(b)

Relative expression having $label for a label having a definition in the sdata/sbss-attribute section

ld      $label[reg1], reg2
ld      $label[reg1], reg2

(c)

Relative expression having !label or %label

ld      !label[reg1], reg2
ld      !label[reg1], reg2
ld      %label[reg1], reg2
ld      %label[reg1], reg2

(d)

Expression with , LOWW

ld      disp16[reg1], reg2
ld      disp16[reg1], reg2

Note

The ld machine instruction takes an immediate value in the range of -32,768 to +32,767 (0xFFFF8000 to 0x7FFF) as the displacement

 

-

If any of the following is specified for disp, the assembler performs instruction expansion to generate multiple machine instructions.

(a)

Absolute expression having a value exceeding the range of -32,768 to +32,767, but within the range of -4,194,304 to +4,194,303

ld      disp23[reg1], reg2
ld      disp23[reg1], reg2

(b)

Absolute expression having a value exceeding the range of -4,194,304 to +4,194,303

ld      disp[reg1], reg2
movhi   HIGHW1(disp), reg1, r1
ld      LOWW(disp)[r1], reg2

(c)

Relative expression having #label or label, or that having $label for a label having definition in the sdata/sbss-attribute section

ld      #label[reg1], reg2
movhi   HIGHW1(#label), reg1, r1
ld      LOWW(#label)[r1], reg2
ld      label[reg1], reg2
movhi   HIGHW1(label), reg1, r1
ld      LOWW(label)[r1], reg2
ld      $label[reg1], reg2
movhi   HIGHW1($label), reg1, r1
ld      LOWW($label)[r1], reg2

 

-

If disp is omitted, the assembler assumes 0.

-

If an absolute expression, a relative expression having !label, a relative expression having #label, or a relative expression having #label and with LOWW applied is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [r0] is specified.

-

If a relative expression having $label, or a relative expression having $label and with LOWW applied, is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [gp] is specified.

-

If a relative expression having %label is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [ep] is specified.

-

Specify an ld23 instruction to specify an ld instruction with a 23 bit-wide disp..

[Flag]

CY

---

OV

---

S

---

Z

---

SAT

---

[Caution]

-

ld.b and ld.h sign-extend the data of 1 byte and 1 halfword, respectively, and load the data into a register as 1 word.

-

If a value that is not a multiple of 2 is specified as disp of ld.h, ld.w, or ld.hu, the assembler aligns disp with 2 and generates a code. Then, the assembler outputs the following messages.

W0550019 : Illegal operand (immediate must be multiple of 2).

-

If r0 is specified as the second operand of ld.bu and ld.hu, the assembler outputs the following message and stops assembling.

E0550240 : Illegal operand (cannot use r0 as destination in RH850 mode).