[EXTERNAL]Re: [PATCH 2/5] sim: Factor out NaN handling in floating point operations

Faraz Shahbazker fshahbazker@wavecomp.com
Sun May 23 06:32:53 GMT 2021


On 5/22/21 6:55 AM, Mike Frysinger wrote:
> so some of the logic you replaced below do:
> 	if (sim_fpu_is_qnan (l))
> 	  {
> 	    *f = *l;
> 	    return 0;
> 	  }
> 	if (sim_fpu_is_qnan (r))
> 	  {
> 	    *f = *r;
> 	    return 0;
> 	  }
> 
> but others do:
> 	if (sim_fpu_is_qnan (l))
> 	  {
> 	    *f = *l;
> 	    f->class = sim_fpu_class_qnan;
> 	    return 0;
> 	  }
> 	if (sim_fpu_is_qnan (r))
> 	  {
> 	    *f = *r;
> 	    f->class = sim_fpu_class_qnan;
> 	    return 0;
> 	  }
> 
> it seems like we should have been consistently doing the latter ?

Isn't the extra assignment redundant? If sim_fpu_is_qnan(l), then 
l->class == sim_fpu_class_qnan, and so *f = *l is sufficient.

Only sNaN-handling needs the extra assignment because it has to be 
downgraded to qNaN.

- Faraz


More information about the Gdb-patches mailing list