lbz
Load Byte and Zero
lbz RT, D(RA)
Loads a byte from memory into the low 8 bits of a register and clears the upper 56 bits.
Details
The effective address (EA) is computed as the sum of the contents of register RA and the sign-extended immediate value D. The byte at EA is loaded into RT, with the upper 56 bits set to zero.
Pseudocode Operation
if 'lbz' then
EA ← (RA|0) + EXTS64(D)
RT ← EXTZ(MEM(EA, 1))
Programming Note
The lbz instruction is commonly used for loading a single byte from memory into a register while zeroing out the upper bits. Ensure that the address is properly aligned to avoid potential performance penalties or exceptions. This instruction operates at user privilege level and will raise an exception if the EA is outside the valid address space.
Example
lbz r3, 0(r4)
Encoding
Binary Layout
34
0
RT
6
RA
11
D
16
Operands
-
RT
Target Register -
D
Displacement (16-bit Signed) -
RA
Base Register