8.1.1 x86 extensions
GCC can take advantage of the additional instructions in the MMX, SSE,
SSE2, SSE3 and 3dnow extensions of recent Intel and AMD processors. The
options -mmmx
, -msse
, -msse2
, -msse3
and -m3dnow
enable the use of these extra instructions, allowing
multiple words of data to be processed in parallel. The resulting
executables will only run on processors supporting the appropriate
extensions--on other systems they will crash with an Illegal
instruction
error (or similar).(23)
The option -mfpmath=sse
instructs GCC to use the SSE extensions
for floating-point arithmetic where possible. For this option to take
effect, the SSE or SSE2 extensions must first be enabled with
-msse
or -msse2
.
Note that the plain SSE extensions only support single precision
operations--double precision arithmetic is part of SSE2. Since most C
and C++ programs declare floating-point variables as double
rather than float
, the combined options -msse2
-mfpmath=sse
are usually needed. On 64-bit processors these
options are enabled by default.