This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mips SNaN/QNaN is swapped


On Mar 24, 2003, Richard Henderson <rth at redhat dot com> wrote:

> On Mon, Mar 24, 2003 at 01:36:05AM -0300, Alexandre Oliva wrote:
>> -	    image ^= 1 << 23 | 1 << 22;
>> +	    image ^= (1 << 23) - 1;

> I think this is wrong.  If you want to change the canonical
> NaN, then you should change get_canonical_[qs]nan.

AFAICT, get_canonical_[qs]nan are supposed to generate NaNs in the
internal format.  It seems that it is real_nan() that needs tweaking,
but then, I don't see any nice way to make this bit in it:

      /* Our intermediate format forces QNaNs to have MSB-1 set.
	 If the target format has QNaNs with the top bit unset,
	 mirror the output routines and invert the top two bits.  */
      if (!fmt->qnan_msb_set)
	r->sig[SIGSZ-1] ^= (SIG_MSB >> 1) | (SIG_MSB >> 2);

float format-specific.  Since there's not much point in trying to
emulate the exact bit-pattern generated by the machines, maybe I
should just give it up, and make sure we do generate NaNs that are
valid, as opposed to emulating the machine behavior exactly.

I believe some bug-fixing for real_nan() is in order: it seems to me
that there is a case in which one may be able to force real_nan() to
generate all-zero bit patterns.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]