Resulting Condition Code:
o First and second operands equal, second oper -
and replaced by third operand
1 First and second operands not equal, first oper -
and replaced by second operand
2 -
3 -
Program Exceptions:
Operation (if the conditional-swapping feature is
not installed)
Specification
Access (fetch and store, operand 2)
Programming Note
The instructionCOMPARE DOUBLE AND
SWAP may be used in a manner similar to that de
scribed in the programming notes forCOMPARE AND SWAP. In addition, it has another use. Consider a chained
list, with a control word used to address the first
message in the list, as described in the second exam
ple forCOMPARE AND SWAP. If mUltiple pro
grams are permitted to add and delete messages by
usingCOMPARE AND SWAP, there is a possibility
the list will be incorrectly updated. This would occur
if, after one program has fetched the address of the
most recent message in order to remove the message,
another program removes the first two messages and
then adds the first message back into the chain. The
first program, on continuing, is not aware that the
list is changed. By increasing the size of the control
word to a double word containing both the first mes
sage address and a word with a change number that
is incremented for each modification of the list, and
by usingCOMPARE DOUBLE AND SWAP to
update both fields together, the possibility of the list
being incorrectly updated is reduced to a negligible
level. That is, an incorrect update can occur only
if the first program is delayed while changesexact\y equal in number to a mUltiple of 2
32
'take place
and only if the last change places the original message
address in the control word.
It should be noted thatCOMPARE DOUBLE AND SW AP does not interlock against storage ac
cesses by channels. Therefore, the instruction should
not be used to update a double word all or part of
which is in an110 input area, since the input data
may be lost.
Page ofGA22-7000-4 Revised September 1, 1975
By TNL: GN22-0498
Compare Hal/word
CH
o 8 12 1620 31
The first operand is compared with the secondoper and, and the result determines the setting of the
condition code. The second operand is two bytes in
length and is considered to be a 16-bit signed inte
ger.
The second operand is expanded to 32 bits before
the comparison by propagating the sign-bit value
through the 16 high-order bit positions.
Comparison is algebraic, treating both compa
rands as 32-bit signed integers. Operands in regis
ters or storage are not changed.
Resulting Condition Code:
o Operands are equal
1 First operand is low
2 First operand is high
3 -
Program Exceptions:
Access (fetch, operand 2)
CompareLogif;al CLR Rl,R2 [RRJ
15I R, I R2 I 0 8 12 15
CL R 1 ,D2(X2,B2)
55I R, I X
2
[RX]
8
2 °2I 0 8 12 16 20 31
CLIDl(Bl),h [SI] I 95 12 I 6, I °1 0 8 16 20 31
CLC Dl(L,Bl),D2(B2)[8S] 05 L 8
1lSI 8
2I 0 8 16 20 32 36 47
General Instructions 125
o First and second operands equal, second oper -
and replaced by third operand
1 First and second operands not equal, first oper -
and replaced by second operand
2 -
3 -
Program Exceptions:
Operation (if the conditional-swapping feature is
not installed)
Specification
Access (fetch and store, operand 2)
Programming Note
The instruction
SW
scribed in the programming notes for
list, with a control word used to address the first
message in the list, as described in the second exam
ple for
grams are permitted to add and delete messages by
using
the list will be incorrectly updated. This would occur
if, after one program has fetched the address of the
most recent message in order to remove the message,
another program removes the first two messages and
then adds the first message back into the chain. The
first program, on continuing, is not aware that the
list is changed. By increasing the size of the control
word to a double word containing both the first mes
sage address and a word with a change number that
is incremented for each modification of the list, and
by using
update both fields together, the possibility of the list
being incorrectly updated is reduced to a negligible
level. That is, an incorrect update can occur only
if the first program is delayed while changes
32
'take place
and only if the last change places the original message
address in the control word.
It should be noted that
cesses by channels. Therefore, the instruction should
not be used to update a double word all or part of
which is in an
may be lost.
Page of
By TNL: GN22-0498
Compare Hal/word
CH
o 8 12 16
The first operand is compared with the second
condition code. The second operand is two bytes in
length and is considered to be a 16-bit signed inte
ger.
The second operand is expanded to 32 bits before
the comparison by propagating the sign-bit value
through the 16 high-order bit positions.
Comparison is algebraic, treating both compa
rands as 32-bit signed integers. Operands in regis
ters or storage are not changed.
Resulting Condition Code:
o Operands are equal
1 First operand is low
2 First operand is high
3 -
Program Exceptions:
Access (fetch, operand 2)
Compare
15
CL R 1 ,D2(X2,B2)
55
2
[RX]
8
2 °2
CLI
CLC Dl(L,Bl),D2(B2)
1
2
General Instructions 125