📄 i386-and-x86-64-options.html
字号:
<html lang="en">
<head>
<title>Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
<!--
Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Funding
Free Software", the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below). A copy of the license is
included in the section entitled "GNU Free Documentation License".
<p>(a) The FSF's Front-Cover Text is:
<p>A GNU Manual
<p>(b) The FSF's Back-Cover Text is:
<p>You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.-->
</head>
<body>
<div class="node">
<p>
Node:<a name="i386%20and%20x86-64%20Options">i386 and x86-64 Options</a>,
Next:<a rel="next" accesskey="n" href="HPPA-Options.html#HPPA%20Options">HPPA Options</a>,
Previous:<a rel="previous" accesskey="p" href="MIPS-Options.html#MIPS%20Options">MIPS Options</a>,
Up:<a rel="up" accesskey="u" href="Submodel-Options.html#Submodel%20Options">Submodel Options</a>
<hr><br>
</div>
<h4 class="subsection">Intel 386 and AMD x86-64 Options</h4>
<p>These <code>-m</code> options are defined for the i386 and x86-64 family of
computers:
<dl>
<dt><code>-mcpu=</code><var>cpu-type</var><code></code>
<dd>Tune to <var>cpu-type</var> everything applicable about the generated code, except
for the ABI and the set of available instructions. The choices for
<var>cpu-type</var> are <code>i386</code>, <code>i486</code>, <code>i586</code>, <code>i686</code>,
<code>pentium</code>, <code>pentium-mmx</code>, <code>pentiumpro</code>, <code>pentium2</code>,
<code>pentium3</code>, <code>pentium4</code>, <code>k6</code>, <code>k6-2</code>, <code>k6-3</code>,
<code>athlon</code>, <code>athlon-tbird</code>, <code>athlon-4</code>, <code>athlon-xp</code>,
<code>athlon-mp</code>, <code>winchip-c6</code>, <code>winchip2</code> and <code>c3</code>.
<p>While picking a specific <var>cpu-type</var> will schedule things appropriately
for that particular chip, the compiler will not generate any code that
does not run on the i386 without the <code>-march=</code><var>cpu-type</var><code></code> option
being used. <code>i586</code> is equivalent to <code>pentium</code> and <code>i686</code>
is equivalent to <code>pentiumpro</code>. <code>k6</code> and <code>athlon</code> are the
AMD chips as opposed to the Intel ones.
<br><dt><code>-march=</code><var>cpu-type</var><code></code>
<dd>Generate instructions for the machine type <var>cpu-type</var>. The choices
for <var>cpu-type</var> are the same as for <code>-mcpu</code>. Moreover,
specifying <code>-march=</code><var>cpu-type</var><code></code> implies <code>-mcpu=</code><var>cpu-type</var><code></code>.
<br><dt><code>-m386</code>
<dd><dt><code>-m486</code>
<dd><dt><code>-mpentium</code>
<dd><dt><code>-mpentiumpro</code>
<dd>These options are synonyms for <code>-mcpu=i386</code>, <code>-mcpu=i486</code>,
<code>-mcpu=pentium</code>, and <code>-mcpu=pentiumpro</code> respectively.
These synonyms are deprecated.
<br><dt><code>-mfpmath=</code><var>unit</var><code></code>
<dd>generate floating point arithmetics for selected unit <var>unit</var>. the choices
for <var>unit</var> are:
<dl>
<dt><code>387</code>
<dd>Use the standard 387 floating point coprocessor present majority of chips and
emulated otherwise. Code compiled with this option will run almost everywhere.
The temporary results are computed in 80bit precision instead of precision
specified by the type resulting in slightly different results compared to most
of other chips. See <code>-ffloat-store</code> for more detailed description.
<p>This is the default choice for i386 compiler.
<br><dt><code>sse</code>
<dd>Use scalar floating point instructions present in the SSE instruction set.
This instruction set is supported by Pentium3 and newer chips, in the AMD line
by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
instruction set supports only single precision arithmetics, thus the double and
extended precision arithmetics is still done using 387. Later version, present
only in Pentium4 and the future AMD x86-64 chips supports double precision
arithmetics too.
<p>For i387 you need to use <code>-march=</code><var>cpu-type</var><code></code>, <code>-msse</code> or
<code>-msse2</code> switches to enable SSE extensions and make this option
effective. For x86-64 compiler, these extensions are enabled by default.
<p>The resulting code should be considerably faster in majority of cases and avoid
the numerical instability problems of 387 code, but may break some existing
code that expects temporaries to be 80bit.
<p>This is the default choice for x86-64 compiler.
<br><dt><code>sse,387</code>
<dd>Attempt to utilize both instruction sets at once. This effectively double the
amount of available registers and on chips with separate execution units for
387 and SSE the execution resources too. Use this option with care, as it is
still experimental, because gcc register allocator does not model separate
functional units well resulting in instable performance.
</dl>
<br><dt><code>-masm=</code><var>dialect</var><code></code>
<dd>Output asm instructions using selected <var>dialect</var>. Supported choices are
<code>intel</code> or <code>att</code> (the default one).
<br><dt><code>-mieee-fp</code>
<dd><dt><code>-mno-ieee-fp</code>
<dd>Control whether or not the compiler uses IEEE floating point
comparisons. These handle correctly the case where the result of a
comparison is unordered.
<br><dt><code>-msoft-float</code>
<dd>Generate output containing library calls for floating point.
<strong>Warning:</strong> the requisite libraries are not part of GCC.
Normally the facilities of the machine's usual C compiler are used, but
this can't be done directly in cross-compilation. You must make your
own arrangements to provide suitable library functions for
cross-compilation.
<p>On machines where a function returns floating point results in the 80387
register stack, some floating point opcodes may be emitted even if
<code>-msoft-float</code> is used.
<br><dt><code>-mno-fp-ret-in-387</code>
<dd>Do not use the FPU registers for return values of functions.
<p>The usual calling convention has functions return values of types
<code>float</code> and <code>double</code> in an FPU register, even if there
is no FPU. The idea is that the operating system should emulate
an FPU.
<p>The option <code>-mno-fp-ret-in-387</code> causes such values to be returned
in ordinary CPU registers instead.
<br><dt><code>-mno-fancy-math-387</code>
<dd>Some 387 emulators do not support the <code>sin</code>, <code>cos</code> and
<code>sqrt</code> instructions for the 387. Specify this option to avoid
generating those instructions. This option is the default on FreeBSD,
OpenBSD and NetBSD. This option is overridden when <code>-march</code>
indicates that the target cpu will always have an FPU and so the
instruction will not need emulation. As of revision 2.6.1, these
instructions are not generated unless you also use the
<code>-funsafe-math-optimizations</code> switch.
<br><dt><code>-malign-double</code>
<dd><dt><code>-mno-align-double</code>
<dd>Control whether GCC aligns <code>double</code>, <code>long double</code>, and
<code>long long</code> variables on a two word boundary or a one word
boundary. Aligning <code>double</code> variables on a two word boundary will
produce code that runs somewhat faster on a <code>Pentium</code> at the
expense of more memory.
<p><strong>Warning:</strong> if you use the <code>-malign-double</code> switch,
structures containing the above types will be aligned differently than
the published application binary interface specifications for the 386
and will not be binary compatible with structures in code compiled
without that switch.
<br><dt><code>-m128bit-long-double</code>
<dd>Control the size of <code>long double</code> type. i386 application binary interface
specify the size to be 12 bytes, while modern architectures (Pentium and newer)
prefer <code>long double</code> aligned to 8 or 16 byte boundary. This is
impossible to reach with 12 byte long doubles in the array accesses.
<p><strong>Warning:</strong> if you use the <code>-m128bit-long-double</code> switch, the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -