https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121652

--- Comment #20 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
(In reply to Aurelien Jarno from comment #18)
> Created attachment 62345 [details]
> Patch / Proof of concept
> 
> In case we want to keep the condition unchanged, here is a patch to
> correctly handle the sNaN case. 

You mean the expander gate ? I don't see a strong argument to not change it if
we can agree it is wrong. I still don't fully comprehend all the discussions
above regarding this, but I won't mind changing that too (in addition to other
changes u proposed). With review and enough testing I think that change should
be fine too.


> It checks for NaN using feq, and jump to a
> code adding the two arguments in case flag_trapping_math is active to
> convert the sNaN into a qNan. This is similar to what is done on the GLIVC
> side. This means there is no need to save and restore the fflags anymore, as
> this is allowed by -ffp-int-builtin-inexact.

Cool.


> Note that it is my first changes in that area of GCC, and I am not fully
> sure I have done things correctly with the jumps, and especially with the
> emit_barrier() call. That's why it's maybe only a proof of concept. 

I think its worthwhile to pos tit as RFC to the list. That way we get more eyes
to stare at the patch especially with the expertise of Joseph and others
proficient in the area.

> That said I have however checked and tested the generated code for various
> combinaison of -f(no-)fp-int-builtin-inexact and -f(no-)signaling-nans. I
> also checked that the GLIBC testsuite fully passes with this change.

Nice.

You change for early Nan detection and removal of save/restore look sane to me.

Reply via email to