360 Assembly/360 Instructions/LR

LR - Load Register - RR Instruction - Opcode 18

Format

edit
LR 2,6 Copy the contents of register 6 into register 2, replacing the existing contents of register 2

The specific syntax is

LR target register, source register.

Opcode

edit
RR Instruction (2 bytes)
Byte 1
bits (0-7)
Byte 2
target register
(8-11)
source register
(12-15)
(in hex) Opcode
18
(4 bits)
0..F / (dec 0..15)
(4 bits)
0..F / (dec 0..15)
  • The first argument is a target register which value is affected by the instruction.
  • The second argument is the source register.
  • The target register and source register values are 0 to 15.


Example usage

edit

The LR instruction is used to copy the contents of the second register argument (the source register) into the first register argument (the target register), replacing the contents of the target register with the contents of the source register. The following is an example of how the instruction would assemble in various forms from an assembly language listing:

1826        LR   2,6
1892        LR   9,2
18FA        LR   15,10

Typical Usage

edit

When it is necessary to copy the contents of a register in order to preserve the value in the original register, or where the purpose is to propagate the value contained in one register to another register.

Availability

edit

The LR instruction is available on all models of the 360, 370 and z/System.

Operation

edit

The LR instruction copies the 32-bit value from the register specified by the second argument to the register specified by the first argument.

Register 0 is valid for either register and is not ignored as in some other instructions.

Condition Codes

edit

Condition codes are not changed.

Exceptions and Faults

edit

None.

edit

The most closely-related instruction is Add Logical Register (ALR) and not Load Address (LA), as is sometimes assumed. Whereas L loads a value from memory, LA does not access memory; it only calculates a number, which can but does not have to be an address.

32-Bit Instructions

edit
  • To load an 8-bit byte (character) value from memory, see IC.
  • To load one or more 8-bit byte values into a register according to a mask, see ICM
  • To load a 16-bit half-word value from memory, see LH.
  • To load a 12-bit unsigned value into a register or add up to 4095 to the values in one or two 32-bit registers, see LA.
  • To copy a 32-bit word value from one register to another register, see LR.
  • To load a 32-bit word value from memory, see L.
  • To store an 8-bit byte (character) value in memory, see STC.
  • To store one or more 8-bit byte values into memory according to a mask, see STCM
  • To store a 16-bit half-word value in memory, see STH.
  • To store a 32-bit word value in memory, see ST.

64-Bit Instructions

edit
  • To load a 20-bit signed value into a 32-bit or 64-bit register from an extended (20-bit) signed memory offset, see LAY.
  • To load a 32-bit value into a 64-bit register from an extended (20-bit) signed memory offset, see LGF.
  • To copy a 64-bit value from one 64-bit register to another 64-bit register, see LGR.
  • To load a 64-bit value into a 64-bit register from memory, see LG.
  • To store a 32-bit value from a register to an extended (20-bit) signed memory offset, see STY.
  • To store a 64-bit value from a 64-bit register to an address in memory, see STG.
Previous Instruction
LPXR
360 Assembly Instructions
{{{name}}}
Next Instruction
LRA
Previous Opcode
17
Next Opcode
19
360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Priveleged Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages