Comparison and swap (Compare and Exchange for Interlock)
Word data is read from the specified address and compared with the word data in general-purpose register reg2, and the result is indicated by flags in the PSW. Comparison is performed by subtracting the read word data from the word data in general-purpose register reg2. If the comparison result is "0", word data in general-purpose register reg3 is stored in the generated address, otherwise the read word data is stored in the generated address.
Afterward, the read word data is stored in general-purpose register reg3. General-purpose registers reg1 and reg2 are not affected.