Next:Directives to save and restore options, Previous:Directives to control the FP ABI, Up:MIPS Dependent Features [Contents][Index]
The IEEE 754 floating-point standard defines two types of not-a-number(NaN) data: “signalling” NaNs and “quiet” NaNs. The original versionof the standard did not specify how these two types should bedistinguished. Most implementations followed the i387 model, in whichthe first bit of the significand is set for quiet NaNs and clear forsignalling NaNs. However, the original MIPS implementation assigned theopposite meaning to the bit, so that it was set for signalling NaNs andclear for quiet NaNs.
The 2008 revision of the standard formally suggested the i387 choiceand as from Sep 2012 the current release of the MIPS architecturetherefore optionally supports that form. Code that uses one NaN encodingwould usually be incompatible with code that uses the other NaN encoding,so MIPS ELF objects have a flag (EF_MIPS_NAN2008
) to record whichencoding is being used.
Assembly files can use the.nan
directive to select between thetwo encodings. ‘.nan 2008’ says that the assembly file uses theIEEE 754-2008 encoding while ‘.nan legacy’ says that the file usesthe 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=2008can be used instead of ‘.nan legacy’ and ‘.nan 2008’respectively. However, any.nan
directive overrides thecommand-line setting.
‘.nan legacy’ is the default if no.nan
directive or-mnan option is given.
Note thatGNUas
does not produce NaNs itself andtherefore these directives do not affect code generation. They simplycontrol the setting of theEF_MIPS_NAN2008
flag.
Traditional MIPS assemblers do not support these directives.
Next:Directives to save and restore options, Previous:Directives to control the FP ABI, Up:MIPS Dependent Features [Contents][Index]