On Mon, Nov 07, 2022 at 01:48:28PM +0100, Aldy Hernandez wrote:
> On Mon, Nov 7, 2022 at 1:43 PM Jakub Jelinek <ja...@redhat.com> wrote:
> >
> > On Mon, Nov 07, 2022 at 01:35:35PM +0100, Aldy Hernandez wrote:
> > > Let me see if I understand you correctly...
> > >
> > > real_isdenormal is always returning false for our uses in frange?  So
> > > instead of using real_isdenormal in flush_denormals_to_zero, perhaps
> > > we should be using:
> > >
> > > REAL_EXP (r) < REAL_MODE_FORMAT (mode)->emin
> > >
> > > ??
> > >
> > > Could we perhaps make real_isdenormal always work for all values?  Is
> > > that possible?
> >
> > Yes.  Or have real_isdenormal_target for the uses in real.cc
> > which would be private to real.cc and would do what real_isdenormal
> > currently does, and then real_isdenormal with the above definition
> > (well, r->cl == rvc_normal && ...).
> 
> If the REAL_EXP(r)... definition works for everyone, can't we just use
> that?  Or do you think there'd be a measurable performance impact?

It doesn't work alone.

Either denormals are in normalized form, then
r->cl == rvc_normal && REAL_EXP (r) < REAL_MODE_FORMAT (mode)->emin
is true, or they are in denormal form, then
r->cl == rvc_normal && (r->sig[SIGSZ-1] & SIG_MSB) == 0
is true.

You could use
r->cl == rvc_normal
&& (REAL_EXP (r) < REAL_MODE_FORMAT (mode)->emin
    || (r->sig[SIGSZ-1] & SIG_MSB) == 0)
but that would be waste of compile time both in real.cc and outside of
real.cc.

        Jakub

Reply via email to