[Info-vax] nice for VMS
John Reagan
johnrreagan at earthlink.net
Mon Apr 13 09:24:09 EDT 2009
"Arne Vajhøj" <arne at vajhoej.dk> wrote in message
news:49e28914$0$90266$14726298 at news.sunsite.dk...
>
> Most HLL compiler allow you to specify that data should not be
> natural aligned. And take the performance hit, which even at older
> Alphas could be >x10.
>
> Arne
We have no such feature. Unless you lie to the compiler, we should never
generate code that gets an alignment fault on either Alpha or Itanium.
- If the compiler knows that the field is aligned, we'll generate a single
LDL/LDQ instruction.
- If the compiler knows (or thinks) the field is unaligned (ie, you used
#pragma nomember_alignment or the equivalent in the language - some
languages like COBOL/BASIC default to byte-aligned packing like VAX), then
the compiler will generate multiple instructions to fetch/store the data in
pieces to avoid the alignment fault.
Same for Itanium.
The common place to get alignment faults are mostly pointer dereferences. C
will assume that a pointer to an int is a pointer to an ALIGNED int. So if
you take the address of some random byte in a buffer and pass that pointer
to some code to start filling in the buffer, you'll get alignment faults.
There are pragmas to tell the compiler that the destination is no aligned
and to generate the multi-instruction sequence.
Again, same for Itanium.
So in summary, asking for VAX-style packing on byte boundaries should not
generate alignment faults. Now, it isn't as fast as aligned code since
you'll execute perhaps 6-8 instructions for the unaligned form vs 1
instruction for the aligned form.
John
More information about the Info-vax
mailing list