toolchain/share/doc/as.html/MIPS-NaN-Encodings.html

88 lines
4.5 KiB
HTML

<html lang="en">
<head>
<title>MIPS NaN Encodings - 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="MIPS_002dDependent.html#MIPS_002dDependent" title="MIPS-Dependent">
<link rel="prev" href="MIPS-FP-ABIs.html#MIPS-FP-ABIs" title="MIPS FP ABIs">
<link rel="next" href="MIPS-Option-Stack.html#MIPS-Option-Stack" title="MIPS Option Stack">
<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="MIPS-NaN-Encodings"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="MIPS-Option-Stack.html#MIPS-Option-Stack">MIPS Option Stack</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="MIPS-FP-ABIs.html#MIPS-FP-ABIs">MIPS FP ABIs</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="MIPS_002dDependent.html#MIPS_002dDependent">MIPS-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.27.10 Directives to record which NaN encoding is being used</h4>
<p><a name="index-MIPS-IEEE-754-NaN-data-encoding-selection-1596"></a><a name="index-g_t_0040code_007b_002enan_007d-directive_002c-MIPS-1597"></a>The IEEE 754 floating-point standard defines two types of not-a-number
(NaN) data: &ldquo;signalling&rdquo; NaNs and &ldquo;quiet&rdquo; NaNs. The original version
of the standard did not specify how these two types should be
distinguished. Most implementations followed the i387 model, in which
the first bit of the significand is set for quiet NaNs and clear for
signalling NaNs. However, the original MIPS implementation assigned the
opposite meaning to the bit, so that it was set for signalling NaNs and
clear for quiet NaNs.
<p>The 2008 revision of the standard formally suggested the i387 choice
and as from Sep 2012 the current release of the MIPS architecture
therefore optionally supports that form. Code that uses one NaN encoding
would usually be incompatible with code that uses the other NaN encoding,
so MIPS ELF objects have a flag (<code>EF_MIPS_NAN2008</code>) to record which
encoding is being used.
<p>Assembly files can use the <code>.nan</code> directive to select between the
two encodings. &lsquo;<samp><span class="samp">.nan 2008</span></samp>&rsquo; says that the assembly file uses the
IEEE 754-2008 encoding while &lsquo;<samp><span class="samp">.nan legacy</span></samp>&rsquo; says that the file uses
the original MIPS encoding. If several <code>.nan</code> directives are given,
the final setting is the one that is used.
<p>The command-line options <samp><span class="option">-mnan=legacy</span></samp> and <samp><span class="option">-mnan=2008</span></samp>
can be used instead of &lsquo;<samp><span class="samp">.nan legacy</span></samp>&rsquo; and &lsquo;<samp><span class="samp">.nan 2008</span></samp>&rsquo;
respectively. However, any <code>.nan</code> directive overrides the
command-line setting.
<p>&lsquo;<samp><span class="samp">.nan legacy</span></samp>&rsquo; is the default if no <code>.nan</code> directive or
<samp><span class="option">-mnan</span></samp> option is given.
<p>Note that <span class="sc">gnu</span> <code>as</code> does not produce NaNs itself and
therefore these directives do not affect code generation. They simply
control the setting of the <code>EF_MIPS_NAN2008</code> flag.
<p>Traditional MIPS assemblers do not support these directives.
</body></html>