Accelerator Manual (G06.24+, H06.03+)

Preparing Your Program for TNS/R Systems
Accelerator Manual527303-002
2-10
Odd-Byte References
Odd-Byte References
When a language compiler applies a TNS word instruction to an operand with an odd-
byte address, run-time results are unpredictable. The instruction might do any, or any
combination, of:
“Round down” the misaligned address (as the TNS CISC processors always did)
Use the misaligned address without rounding it down
Cause the instruction to fail
The TNS instruction’s misalignment behavior depends on:
Operand size (16-bit, 32-bit, or 64-bit)
Execution mode
In TNS mode or accelerated mode, the action also depends on:
°
TNS opcodes such as QCMP
Although 64-bit integers with odd-byte addresses usually are not rounded
down, they can be (QCMP is one such example).
°
Contextual optimizations
°
How the instruction's result is used by later instructions
The SCF attribute TNSMISALIGN (see Misalignment Handling on page 2-15)
The varying behaviors and symptoms that misalignment errors cause can be confusing
for the following reasons:
A source program can produce erroneous TNS object code that seems to execute
correctly until you change the source program in an apparently innocent way.
The program might behave differently in TNS mode than it does in accelerated
mode. (Neither mode is better for avoiding alignment problems.)
The debugger might display a different value for a variable than the program sees,
because the debugger never “rounds down” addresses.
The program might “round down” addresses for storage operations but not for
subsequent retrieval operations of the same misaligned operand (or the reverse).
TNS/R systems do not support the same odd-byte references to doublewords (4-byte
units) or quadruplewords (8-byte units) as TNS systems do. Odd-byte references are
made when the least significant bit (bit 31) of an extended pointer is set.
TNS systems ignore bit 31 of an extended pointer and fetch or store data starting
from the byte prior to the addressed one to ensure that the address is on a word
boundary. This behavior is probably not what you intended.
On TNS/R systems, odd-byte references to doublewords or quadruplewords are
unpredictable; programs might trap or they might continue executing. Extended
pointers to variables accessed as doublewords or quadruplewords must not have