toolchain/share/doc/as.html/i386_002dFloat.html

86 lines
6.3 KiB
HTML

<html lang="en">
<head>
<title>i386-Float - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="i386_002dDependent.html#i386_002dDependent" title="i386-Dependent">
<link rel="prev" href="i386_002dJumps.html#i386_002dJumps" title="i386-Jumps">
<link rel="next" href="i386_002dSIMD.html#i386_002dSIMD" title="i386-SIMD">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="i386-Float"></a>
<a name="i386_002dFloat"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="i386_002dSIMD.html#i386_002dSIMD">i386-SIMD</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="i386_002dJumps.html#i386_002dJumps">i386-Jumps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="i386_002dDependent.html#i386_002dDependent">i386-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.16.9 Floating Point</h4>
<p><a name="index-i386-floating-point-1229"></a><a name="index-floating-point_002c-i386-1230"></a><a name="index-x86_002d64-floating-point-1231"></a><a name="index-floating-point_002c-x86_002d64-1232"></a>All 80387 floating point types except packed BCD are supported.
(BCD support may be added without much difficulty). These data
types are 16-, 32-, and 64- bit integers, and single (32-bit),
double (64-bit), and extended (80-bit) precision floating point.
Each supported type has an instruction mnemonic suffix and a constructor
associated with it. Instruction mnemonic suffixes specify the operand's
data type. Constructors build these data types into memory.
<p><a name="index-g_t_0040code_007bfloat_007d-directive_002c-i386-1233"></a><a name="index-g_t_0040code_007bsingle_007d-directive_002c-i386-1234"></a><a name="index-g_t_0040code_007bdouble_007d-directive_002c-i386-1235"></a><a name="index-g_t_0040code_007btfloat_007d-directive_002c-i386-1236"></a><a name="index-g_t_0040code_007bfloat_007d-directive_002c-x86_002d64-1237"></a><a name="index-g_t_0040code_007bsingle_007d-directive_002c-x86_002d64-1238"></a><a name="index-g_t_0040code_007bdouble_007d-directive_002c-x86_002d64-1239"></a><a name="index-g_t_0040code_007btfloat_007d-directive_002c-x86_002d64-1240"></a>
<ul>
<li>Floating point constructors are &lsquo;<samp><span class="samp">.float</span></samp>&rsquo; or &lsquo;<samp><span class="samp">.single</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">.double</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">.tfloat</span></samp>&rsquo; for 32-, 64-, and 80-bit formats.
These correspond to instruction mnemonic suffixes &lsquo;<samp><span class="samp">s</span></samp>&rsquo;, &lsquo;<samp><span class="samp">l</span></samp>&rsquo;,
and &lsquo;<samp><span class="samp">t</span></samp>&rsquo;. &lsquo;<samp><span class="samp">t</span></samp>&rsquo; stands for 80-bit (ten byte) real. The 80387
only supports this format via the &lsquo;<samp><span class="samp">fldt</span></samp>&rsquo; (load 80-bit real to stack
top) and &lsquo;<samp><span class="samp">fstpt</span></samp>&rsquo; (store 80-bit real and pop stack) instructions.
<p><a name="index-g_t_0040code_007bword_007d-directive_002c-i386-1241"></a><a name="index-g_t_0040code_007blong_007d-directive_002c-i386-1242"></a><a name="index-g_t_0040code_007bint_007d-directive_002c-i386-1243"></a><a name="index-g_t_0040code_007bquad_007d-directive_002c-i386-1244"></a><a name="index-g_t_0040code_007bword_007d-directive_002c-x86_002d64-1245"></a><a name="index-g_t_0040code_007blong_007d-directive_002c-x86_002d64-1246"></a><a name="index-g_t_0040code_007bint_007d-directive_002c-x86_002d64-1247"></a><a name="index-g_t_0040code_007bquad_007d-directive_002c-x86_002d64-1248"></a><li>Integer constructors are &lsquo;<samp><span class="samp">.word</span></samp>&rsquo;, &lsquo;<samp><span class="samp">.long</span></samp>&rsquo; or &lsquo;<samp><span class="samp">.int</span></samp>&rsquo;, and
&lsquo;<samp><span class="samp">.quad</span></samp>&rsquo; for the 16-, 32-, and 64-bit integer formats. The
corresponding instruction mnemonic suffixes are &lsquo;<samp><span class="samp">s</span></samp>&rsquo; (single),
&lsquo;<samp><span class="samp">l</span></samp>&rsquo; (long), and &lsquo;<samp><span class="samp">q</span></samp>&rsquo; (quad). As with the 80-bit real format,
the 64-bit &lsquo;<samp><span class="samp">q</span></samp>&rsquo; format is only present in the &lsquo;<samp><span class="samp">fildq</span></samp>&rsquo; (load
quad integer to stack top) and &lsquo;<samp><span class="samp">fistpq</span></samp>&rsquo; (store quad integer and pop
stack) instructions.
</ul>
<p>Register to register operations should not use instruction mnemonic suffixes.
&lsquo;<samp><span class="samp">fstl %st, %st(1)</span></samp>&rsquo; will give a warning, and be assembled as if you
wrote &lsquo;<samp><span class="samp">fst %st, %st(1)</span></samp>&rsquo;, since all register to register operations
use 80-bit floating point operands. (Contrast this with &lsquo;<samp><span class="samp">fstl %st, mem</span></samp>&rsquo;,
which converts &lsquo;<samp><span class="samp">%st</span></samp>&rsquo; from 80-bit to 64-bit floating point format,
then stores the result in the 4 byte location &lsquo;<samp><span class="samp">mem</span></samp>&rsquo;)
</body></html>