http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484

--- Comment #20 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Charles L. Wilcox from comment #19)
> (In reply to Uroš Bizjak from comment #11)
> > On an x86 target using the legacy x87 instructions and the 80-bit registers,
> > a load of a 64-bit or 32-bit value in memory into the 80-bit registers
> > counts as a format conversion and an signaling NaN input will turn into a
> > quiet NaN in the register format.
> 
> Does this mean if a 80-bit sNaN was generated and loaded into a register it
> was still have the signaling bit set correctly?  And if so, could this value

80-bit load is not considered as a format conversion, so signalling bit will be
set correctly.

> then be down-converted to a 32 or 64-bit float?  In C++:
>     float float32_snan const
>       = static_cast< float >( std::numeric_limits< long double
> >::signaling_NaN() );
>     double float64_snan const
>       = static_cast< double >( std::numeric_limits< long double
> >::signaling_NaN() );
> Or, is the "cast" here a format conversion, causing the signaling NaN to
> convert to a quiet NAN?

I don't know the c++ details, but compiler can spill the value out from the
register stack using 32- or 64-bit float moves. In any case, signalling bit in
x87 is unreliable and should not be used.

Reply via email to