BUILDING libSIMDx86
NOTE:
This only builds under GNU C Compiler.
Building
with libSIMDx86config, the interactive configuration program.
Get the sources and
extract them
This can be done by going to
www.sourceforge.net/projects/simdx86.
Then extract them to a folder.
Compile
libSIMDx86config
libSIMDx86config is written in
vanilla ANSI C, compiled with all warnings enabled and under
pedantic mode. Pretty much any ANSI C compiler should be able to
compile this program without any problems. To compile under the GNU
C Compiler, type:
shell$
gcc libSIMDx86config.c -o libSIMDx86config
3. Run
libSIMDx86config
Execute libSIMDx86config. On
UNIX based systems this is done by:
shell$
./libSIMDx86config
On
Win32 based systems, double-click the program
libSIMDx86config.exe
Follow
the on-screen instructions through the program.
4. Run the generated build
script
Now you need to run the script. On UNIX based
systems this is done by:
shell$
sh build.sh
On
Win32 based systems, double-click the batch file
build.bat
Building
without libSIMDx86config
Get the sources and
extract them.
This can be done by going to
www.sourceforge.net/projects/simdx86.
Then extract them to a folder.
Decide on instruction
set and options
SIMDx86 can use the following
instruction sets:
1) MMX
2) 3DNow! (includes MMX)
3)
3DNow!+/MMX+ (includes MMX)
4) SSE (includes MMX)
5) SSE2
(includes MMX/SSE)
6) SSE3 (includes MMX/SSE/SSE2)
7) SSSE3
(includes MMX/SSE/SSE2/SSE3)
Additionally, SIMDx86 can
optimize for:
1) Speed (Often for 3D-Games)
2) Accuracy
(Often for non-realtime rendering)
3) AMD processors rather than
Intel
To optimize for speed, do NOT define HIPREC. To
optimize for precision, use #define HIPREC. HIPREC tells SIMDx86 not
use low precision reciprocal or other various hacks, but instead to
do as correct math as possible. Without HIPREC defined, special
processor instructions will be used. You can expect precision to at
least three decimal places in the worst cases.
Optimizing for AMD
processors hurts performance on Intel processors, and vice versa,
but Intel processors take a larger hit from this flag than do AMD
processors.
If using 3DNow! or MMX, SIMDx86 can omit
'[f]emms' instruction
Since executing an '[f]emms' instruction can take extra cycles
when a context switch is not required, it may be beneficial not to
implicitly execute it at the end of each routine. If the symbol
"NO_EMMS" is defined, MMX and 3DNow! routines will NOT
execute an [f]emms instruction. If you have no idea what is being
mentioned here, then ingore this.
For MMX, the preprocessor
constant must be: USE_MMX=1
For 3DNow!, the preprocessor constant
must be: USE_3DNOW=1
For 3DNow!+/MMX+, the preprocessor constant
must be: USE_3DNOW=2
For SSE, the preprocessor constant must be:
USE_SSE=1
For SSE2, the preprocessor constant must be:
USE_SSE=2
For SSE3, the preprocessor constant must be:
USE_SSE=3
For SSSE3, the preprocessor constant must be:
USE_SSE=3.5
To omit '[f]emms' instructions, define the symbol
NO_EMMS. You must explicitly call 'SIMDx86_femms() or
SIMDx86_emms(). Or you can directly add the following: asm("femms");
or asm("emms"); to explictly execute the instructions.
Compile it
This
will create libSIMDx86 in the bin/
directory.
To
do a custom build:
shell$
cd src
shell$ gcc -c *.c -I../include [-DUSE_XXX=YYY] [-DHIPREC]
[-DNO_EMMS]
shell$ ar cru ../bin/libSIMDx86.a *.o
shell$
ranlib ../bin/libSIMDx86.a
Note
that the [] bracketed arguments are optional. By not defining any
USE_XXX constant, libSIMDx86 will be built in x87 mode, meaning no
SIMD instructions will be used.
BACK