User`s guide

How the MACRO Compiler Functions on Different Platforms
2.11 Preserving VAX Atomicity and Granularity
To preserve the granularity of a MOVL R1,(R2) instruction, the compiler always
writes whole longwords with a STL instruction, even if the address to which
it is writing is assumed to be unaligned. If the address is unaligned, the STL
instruction will cause an unaligned memory reference fault. The PALcode
unaligned fault handler will then do the loads, masks, and stores necessary to
write the unaligned longword. However, since PALcode is noninterruptible, this
ensures that the surrounding memory locations are not corrupted.
When porting an application to an OpenVMS Alpha system, you should determine
whether the application performs byte, word, or unaligned longword writes to
memory that is shared either with processes executing on the local processor,
or with processes executing on another processor in the system, or with an
AST routine or condition handler. See Migrating to an OpenVMS AXP System:
Recompiling and Relinking Applications for a more complete discussion of the
programming issues involved in granularity operations in an OpenVMS Alpha
system.
Note
INSV instructions do not generate code that correctly preserves
granularity when granularity is turned on.
2.11.3 Precedence of Atomicity Over Granularity
If you enable the preservation of both granularity and atomicity, and the compiler
encounters VAX code that requires that both be preserved, atomicity takes
precedence over granularity.
For example, the instruction INCW 1(R0), when compiled with
.PRESERVE=GRANULARITY, retries the write of the new word value, if it
is interrupted. However, when compiled with .PRESERVE=ATOMICITY, it will
also refetch the initial value and increment it, if interrupted. If both options are
specified, it will do the latter.
In addition, while the compiler can successfully generate code for unaligned words
and longwords that preserves granularity, it cannot generate code for unaligned
words or longwords that preserves atomicity. If both options are specified, all
memory references must be to aligned addresses.
2.11.4 When Atomicity Cannot Be Guaranteed
Because compiler atomicity guarantees only affect memory modification operands
in VAX instructions, you should take special care in examining VAX MACRO
sources for coding problems that /PRESERVE=ATOMICITY cannot resolve on
OpenVMS Alpha or OpenVMS I64 systems.
For example, consider the following VAX instruction:
ADDL2 (R1),4(R1)
For this instruction, the compiler generates an Alpha code sequence such as
the following, when /PRESERVE=ATOMICITY (or .PRESERVE ATOMICITY) is
specified:
2–26 How the MACRO Compiler Functions on Different Platforms