Intel 7xx Servers Power Supply User Manual


 
floating-point data may be copied using the floating-point loads and store, resulting in an alignment
interrupt.
As an example, consider the following structures, one specifying "packed" and the other allowed to be
aligned per the compiler. For example:
struct FPAlignmentStruct Packed
{
long FloatingPointOp1;
char ACharacter;
long FloatingPointOp2; // Byte aligned; Can result in alignment interrupt.
}
struct FPAlignmentStructNormal // Allows for preferred alignment
{
long FloatingPointOp1;
char ACharacter;
long FloatingPointOp2; // Compiler padding added.
}
The first of these structures uses packing in order to minimize the amount of storage used. Here the
structure consumes exactly 17 bytes, 8 each for the two floating-point values and one byte for the
character. Assuming that the first is doubleword aligned as preferred, the second floating-point variable
will be aligned on a doubleword+1 boundary. Each access of this second floating-point variable will
result in an interrupt on Power6 processors.
The second of these structures allows the compiler to assure preferred alignment. Here the structure
consumes exactly 24 bytes. The extra 7 bytes over the first comes from the compiler adding padding of
seven bytes after the character variable in order to assure that the second floating-point variable is
doubleword aligned.
If minimal storage is nonetheless required, there is another technique which will assure preferred
alignment and
minimal storage. This is accomplished by packaging the larger variables first as in the
following example:
struct FPAlignmentStructNormal
{
long FloatingPointOp1;
long FloatingPointOp2; // Aligned without padding.
char ACharacter;
}
This structure is also seventeen bytes in size and does assure preferred alignment.
IBM i 6.1 Performance Capabilities Reference - January/April/October 2008
© Copyright IBM Corp. 2008 Chapter 20 - General Tips and Techniques 325