CHAPTER GENERAL INSTRUCTIONS Data Format .......•.••..•.•...•....••••.....••••...•...•.• 7-2
Binary-Integer Representation ••..•.•••.•.•..•••••..•...••. 7-2
Binary Arithmetic ...•...••.••.••.•..•....•...•.•••.•.••.•• 7-3 Signed Binary Arithmetic ..........•....•.•....•.•.•..... 7-3
Addition and Subtraction •.•••.•......•..•....•..•.••.• 7-3 Fixed-Point Overflow ..•••..•••••.•...•..••...•..••••.• 7-3
Unsigned Binary Arithmetic •.•.•.•..••.•••••••..•••••.••• 7-3 Signed and Logical Comparison ........••..••...•••••.••.•.. 7-4
Instruct ions ......•....•..........•...•..•.•.••..•......•. 7-4
ADD .............................•.....................•. 7-7
ADD HALFWORD ....•.•••...•.•..••..•.•...••••...•.•.•..••• 7-7
ADD LOGICAL .....•....................................... 7-8
AND .•...................•...•.....••..••......•..•.•..•. 7-8 BRANCH AND LINK .............•...•...........•••.....•.•. 7-9
BRANCH AND SAVE ...........•.....•..•.................... 7-9 BRANCH ON CONDITION ...•...•............•................ 7-10 BRANCH ON COUNT ...•.•.••....•.•..•.....•.•......••.•.••. 7 -11
BRANCH ON INDEX HIGH •...•.......•..•..........•......••. 7-11 BRANCH ON INDEX LOW OR EQUAL ..........................•. 7-11 COt" PAR E .......•...•............................••.•..••. 7 -1 2 COMPARE AND SWAP ..•............••.•.•..••.•••.•••••..••. 7-12 COMPARE DOUBLE AND SWAP .........•..•.....••••....•.•..•• 7-12 COMPARE HALFWORD ...•......•.....•..........•.•••.•...••. 7-14 COMPARE LOGICAL •..•....•••.......•••...••••.•••••.•••••. 7-14 COMPARE LOGICAL CHARACTERS UNDER MASK •.••..••.•.•.•..••• 7-15 COMPARE LOGICAL LONG ....•...•......•....••..••••......•. 7-15 CONVERT TO BINARy •....•.....•••.•......•..••.•••.•.••••• 7-16 CONVERT TO DECIMAL .......•......•..•...•....••.......... 7-17 DIVIDE .............................•............•.•..••. 7-17 EXCLUSIVE OR ..........•.•......•.•••...•..•••••........• 7-18 EXECUTE .......•.•••••...•.......•......••.•.•.•.•....••. 7-19 INSERT CHARACTER ...••.•........••.••.••..••.........••.. 7-20 INSERT CHARACTERS UNDER MASK ...........•..•.••.....•..•. 7-20 LOAD .••.....•...•••.•.•••....•..••...•.....•..••.•..•..• 7-20 LOAD ADDRESS .........•.........•.........•.•..••..•••... 7-21 LOAD AND TEST ....••.....••....••.•••••.•.•••.••...••••.. 7-21 LOAD COMPLEMENT ......................................... 7-21 LOAD HALFWORD .....•••••••.••.•••.•••....•.•••...•••••••. 7-22 LOAD MUL TIPLE ....••.•...•.•.•••..••••....•.••••....•..•. 7-22 LOAD NEGATIVE ....•....•.........•..•...•.•.•............ 7-22 LOAD POSITIVE ......••...........•..•.•.•..........•..... 7-22 CALL •..•••••...•..•••..•••.•.••••••••....••..... 7-23 MOVE .•....•.•...••.•...••.........•.•..•...••.........•. 7-23 INVERSE •.........•...........•..........•....•...•. 7-24 MOVE LONG •......••..•....•.•...•...•....•..•....•.•••.•• 7-24 MOVE NUMERICS ...•..•...•.•••.•.•.•••••.•..••..•••••.•..• 7-27 MOVE WITH OFFSET .••.•.•..••.•............•••••...••••••• 7-27 MOVE ZONES ..•..•................•.•••..•..•....••.•••••. 7-28
MUL TIPL Y ....•...•...•........•••..•.•...••.....••••••.•• 7-28 MULTIPLY HALFWORD •....•••••••..•••..••••.•••••••••••.••• 7-29 OR .••..•.••.••...•..•.••.....••••..••..•..•••••••••••••. 7-29 PACK ....•.......•.•.•..••••.••.•.•.•••.••.•••.•••••••••• 7-30 SET PROGRAM MASK ..•••.....•...•••.•.••.••.•••.••.••••••• 7-31 SHIFT LEFT DOUBLE •..••••••••••.••••.•••••••••••••••••••. 7-31 SHIFT LEFT DOUBLE LOGICAL ••••••.••••.•.••••••....••.•.•. 7-32 SHIFT LEFT SINGLE ••..••.••••..••••••••.••••••••.•.•••••• 7-32 SHIFT LEFT SINGLE LOGICAL •.••••.•..•••.•••••••••••••..•• 7-33 SHIFT RIGHT DOUBLE •...••••.••••••.••....••.••••••••.•••. 7-33 SHIFT RIGHT DOUBLE LOGICAL ••.•..••.••..••••••.•••••••••• 7-33 SHIFT RIGHT SINGLE •.•••••••.•••••••••••••••••••••••••••• 7-34 SHIFT RIGHT SINGLE LOGICAL •...•••..••..••.••••••.••••••. 7-34 STORE ........•.......•..........••••...•..•............. 7-34 STORE CHARACTER ..........••.••.•••••••.•.••••.••.••••••• 7-34 STORE CHARACTERS UNDER MASK ••••••••••.•••••••••••••••••• 7-35 STORE CLOCK .....••..••••..•••••••••..•••••.••••••••••••• 7-35 STORE HALFWORD .••••.•••.••.••••••••••••••••••.•••••••••• 7-36 STORE MULTIPLE •••••••••••••••••••••••••••••••••••••••••• 7-36 SUBTRACT •••.•••.••••••••••••••••••••••.••••••••••••••••• 7-36
Chapter 7. General Instructions 7-1
SUBTRACT HALFWORD ••••••••••••.••••••.••••••.•••••••••••. 7-37 SUBTRACT LOGICAL •••••.•••••••••••••••.••••••.•••••.•.••• 7-37 SUPERVISOR CALL ••••••••••••••.•••••••••••••••••••••••••• 7-38 TEST AND SET •••••••••.••••••.•••••.•••••.••••••••••••••• 7-38 TEST UNDER MASK •••••...••••••.••••.••.••.....•.•••••••.• 7-38 TRANSLATE ........•.•...•..•••..•.......•....••...•....•. 7-39 TRANSLATE AND TEST ••••..•••••.•••••••••••••.••..•..••..• 7-40 UNPACK .••.••.•.••••...•••••••••.••••••••.••••••.••.••••• 7-40 This chapter includes all the unprivi­
leged instructions described in this
publication other than the decimal and
floating-point instructions.
DATA FORMAT The general instructions treat data as being of four types: signed binary integers, unsigned binary integers,
unstructured logical data, and decimal
data. Data is treated as decimal by the
conversion, packing, and unpacking
instructions. Decimal data is described
in Chapter 8, "Decimal Instructions."
The general instructions manipulate data which resides in general registers or in
storage or is introduced from the instruction stream. Some general
instructions operate on data which resides in the PSW or the TOO clock.
In a storage-to-storage operation the
operand fields may be defined in such a way that they overlap. The effect of
this overlap depends upon the operation.
When the operands remain unchanged, as
in COMPARE or TRANSLATE AND TEST, over­
lapping does not affect the execution of
the operation. For instructions such as MOVE and TRANSLATE, one operand is
replaced by new data, and the execution
of the operation may be affected by the
amount of overlap and the manner in
which data is fetched or stored. For
purposes of evaluating the effect of
overlapped operands, data is considered to be handled one eight-bit byte at a
time. Special rules apply to the oper­
ands of MOVE LONG and MOVE INVERSE. BINARY-INTEGER REPRESENTATION Binary integers are treated as signed or
unsigned.
In an unsigned binary integer, all bits
are used to express the absolute value
of the number. When two unsigned binary
integers of different lengths are added,
7-2 System/370 Principles of Operation the shorter number is considered to be extended on the left with zeros.
In some operations, the result is achieved by the use of the one's comple­
ment of the number. The one's comple­
ment of a number is obtained by
inverting each bit of the number,
including the sign.
For signed binary integers, the leftmost
bit represents the sign, which is
followed by the numeric field. Positive numbers are represented in true binary
notation with the sign bit set to zero. When the value is zero, all bits are
zeros, including the sign bit. Negative numbers are represented in two's­
complement binary notation with a one in
the sign-bit position.
Specifically, a negative number is
represented by the two's complement of
the positive number of the same absolute
value. The two's complement of a number
is obtained by forming the one's comple­
ment of the number, adding a value of
one in the rightmost bit position,
allowing a carry into the sign position, and ignoring any carry out of the sign
position.
This number representation can be considered the rightmost portion of an infinitely long representation of the
number. When the number is positive, all bits to the left of the most signif­
icant bit of the number are zeros. When
the number is negative, these bits are
ones. Therefore, when a signed operand
must be extended with bits on the left,
the extension is achieved by setting these bits equal to the sign bit of the
operand.
The notation for signed binary integers
does not include a negative zero. It
has a number range in which, for a given
length, the set of negative nonzero
numbers is one larger than the set of
positive nonzero numbers. The maximum
positive number consists of a sign bit
of zero followed by all ones, whereas
the maximum negative number (the nega­
tive number with the greatest absolute
value) consists of a sign bit of one
followed by all zeros.
Previous Page Next Page