User`s guide

How the MACRO Compiler Functions on Different Platforms
2.9 Using Packed Decimal Instructions
Arguments are passed to the emulation routines by means of the argument
registers (R16 through R21 on OpenVMS Alpha systems); attempts to use
these registers as arguments in a packed decimal instruction will not work
correctly.
The compiler converts references to the VAX argument pointer (AP) into
references to the OpenVMS Alpha argument registers (see Section 2.3). For
example, the compiler converts a parameter reference off the VAX AP, such as
4(AP), to Alpha R16.
On OpenVMS I64 systems, the first parameters are passed not in registers
R16 through R21, but in registers R32 through R39. Thus, there are
eight rather than six argument registers. Also, on OpenVMS I64, the
MACRO compiler does not provide a way to refer to these registers by name.
Therefore, there is no opportunity to write conflicting uses of these registers.
On OpenVMS Alpha systems, to prevent problems with AP-based references
when packed decimal instructions are used, it is simplest to specify /HOME_
ARGS=TRUE on the entry point of the routine that contains these references.
This forces all AP-based references to be read from the procedure frame,
rather than the argument registers, so that no changes need to be made to
the instructions.
If /HOME_ARGS=TRUE is not used, the source code that contains
parameter references based on the AP register as operands to packed
decimal instructions should be changed. Copy any AP-based operand to
a temporary register first, and use that temporary register in the packed
decimal instruction. For example, change the following code:
MOVP R0, @8(AP), @4(AP)
to:
MOVL 8(AP), R1
MOVL 4(AP), R2
MOVP R0,(R1),(R2)
Note that, on OpenVMS I64 systems, the incoming argument registers are
disjoint from the outgoing argument registers.
Overflow traps
Bits 7 and 5 of the VAX Program Status Word (PSW) are the DV (decimal
overflow trap enable) and IV (integer overflow trap enable) bits respectively.
These bits are not emulated as part of the emulation of the VAX PSW, but the
packed decimal support allows you to enable or disable integer and decimal
overflow, although you must do so statically at compile time.
To enable decimal overflow faults, define the symbol PD_DEC_OVF to be
nonzero. If PD_DEC_OVF is not defined or is set to zero, the packed decimal
emulation routines will not generate decimal overflow faults. To enable
integer overflow faults, define the symbol PD_INT_OVF to be nonzero. If
PD_INT_OVF is not defined or is set to zero, the packed decimal emulation
routines will not generate integer overflow faults.
The MACRO qualifier /ENABLE=OVERFLOW and directive .ENABLE
OVERFLOW have no effect on overflow trap enabling for the packed decimal
emulation routines. You must use PD_DEC_OVF and PD_INT_OVF.
Trap routines for reserved operand, decimal divide by zero, integer overflow,
and decimal overflow
2–18 How the MACRO Compiler Functions on Different Platforms