as: MIPS NaN Encodings
9.26.10 Directives to record which NaN encoding is being used
-------------------------------------------------------------
The IEEE 754 floating-point standard defines two types of not-a-number
(NaN) data: "signalling" NaNs and "quiet" 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.
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 ('EF_MIPS_NAN2008') to record
which encoding is being used.
Assembly files can use the '.nan' directive to select between the two
encodings. '.nan 2008' says that the assembly file uses the IEEE
754-2008 encoding while '.nan legacy' says that the file uses the
original MIPS encoding. If several '.nan' directives are given, the
final setting is the one that is used.
The command-line options '-mnan=legacy' and '-mnan=2008' can be used
instead of '.nan legacy' and '.nan 2008' respectively. However, any
'.nan' directive overrides the command-line setting.
'.nan legacy' is the default if no '.nan' directive or '-mnan' option
is given.
Note that GNU 'as' does not produce NaNs itself and therefore these
directives do not affect code generation. They simply control the
setting of the 'EF_MIPS_NAN2008' flag.
Traditional MIPS assemblers do not support these directives.