z/OS MVS Programming: Extended Addressability Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Pitfalls to avoid

z/OS MVS Programming: Extended Addressability Guide
SA23-1394-00

As you begin to use the 64-bit instructions, consider the following:

  1. Some instructions reference or change all 64 bits of a GPR regardless of the AMODE.
  2. Some instructions reference or change only the low-order half of a GPR regardless of the AMODE.
  3. Some instructions reference or change only the high-order half of a GPR regardless of the AMODE.
  4. When you are using signed integers in arithmetic operations, you can't mix instructions that handle 64-bit integers with instructions that handle 31-bit integers. The interpretation of a 32-bit-signed number differs from the interpretation of a 64-bit-signed number. With the 32-bit-signed number, the sign is extended in the low half of the doubleword. With the 64-bit-signed number, the sign is extended to the left for the entire doubleword.
Consider the following example, where a 31-bit subtraction instruction has left a 31-bit negative integer in bits 32 through 63 of GPR3 and has left the high-order half unchanged.
ieaa500c

Next, the instruction AG R3,MYDOUBLEWORD, mentioned earlier, adds the doubleword at the location MYDOUBLEWORD to the contents of the GPR3 and places the sum at GPR3. Because the high-order half of the GPR has uncertain contents, the result of the AG instruction is incorrect. To change the value in the GPR3 so that the AG instruction adds the correct integers, before you use the AG instruction, use the Load G Fullword Register (LGFR) instruction to propagate the sign to the high-order half of GPR3.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014