Compiler Data

Within the recent Visual C++ and Intel compilers SIMD functionality has been incorporated, such as the allocation of registers and aligned stack memory.

Definition

Description

__m64

(64-bit) memory for MMX

__m128

(128-bit) memory for single-precision floating-point

__m128d

(128-bit) memory for double-precision floating-point

__m128i

(128-bit) memory for streaming integer SSE2

These align stack memory through a mask.

 __m128 ta, tb;  push     ebx   mov      ebx,esp   and      esp,0FFFFFFF0h ; 16-byte alignment  movaps   xmm0,xmmword ptr [esp-20h] ; tb   movaps   xmm1,xmmword ptr [esp-10h] ; ta 

Using this same implementation, a bit of magic using unions can be utilized:

 #define MY_FLT_ARY 100 union  {   __m128 t[ MYFLT_ARY/4 ];   float ary[ MYFLT_ARY ];  }; 

The __m128 aligns the stack memory, which the float takes advantage of since it is the same size , and maps to the same location compliments of the nameless union declaration.

There are other methodologies, but these should get you rolling for now.

Tip 

Use assertions in your code to trap errors early in the development process.



32.64-Bit 80X86 Assembly Language Architecture
32/64-Bit 80x86 Assembly Language Architecture
ISBN: 1598220020
EAN: 2147483647
Year: 2003
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net