EasyManuals Logo

Intel ARCHITECTURE IA-32 User Manual

Intel ARCHITECTURE IA-32
568 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #205 background imageLoading...
Page #205 background image
Coding for SIMD Architectures 3
3-25
The __declspec(align(16)) specifications can be placed before data
declarations to force 16-byte alignment. This is particularly useful for
local or global data declarations that are assigned to 128-bit data types.
The syntax for it is
__declspec(align(integer-constant))
where the integer-constant is an integral power of two but no greater
than 32. For example, the following increases the alignment to 16-bytes:
__declspec(align(16)) float buffer[400];
The variable buffer could then be used as if it contained 100 objects of
type
__m128 or F32vec4. In the code below, the construction of the
F32vec4 object, x, will occur with aligned data.
void foo() {
F32vec4 x = *(__m128 *) buffer;
...
}
Without the declaration of __declspec(align(16)), a fault may occur.
Alignment by Using a
union Structure. Preferably, when feasible, a
union can be used with 128-bit data types to allow the compiler to align
the data structure by default. Doing so is preferred to forcing alignment
with
__declspec(align(16)) because it exposes the true program
intent to the compiler in that
__m128 data is being used. For example:
union {
float f[400];
__
m128 m[100];
} buffer;
The 16-byte alignment is used by default due to the __m128 type in the
union; it is not necessary to use __declspec(align(16)) to force it.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel ARCHITECTURE IA-32 and is the answer not in the manual?

Intel ARCHITECTURE IA-32 Specifications

General IconGeneral
Instruction Setx86
Instruction Set TypeCISC
Memory SegmentationSupported
Operating ModesReal mode, Protected mode, Virtual 8086 mode
Max Physical Address Size36 bits (with PAE)
Max Virtual Address Size32 bits
ArchitectureIA-32 (Intel Architecture 32-bit)
Addressable Memory4 GB (with Physical Address Extension up to 64 GB)
Floating Point Registers8 x 80-bit
MMX Registers8 x 64-bit
SSE Registers8 x 128-bit
RegistersGeneral-purpose registers (EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP), Segment registers (CS, DS, SS, ES, FS, GS), Instruction pointer (EIP), Flags register (EFLAGS)
Floating Point UnitYes (x87)

Related product manuals