On 5 Nov 2021, at 21:13, Steve Kargl <s...@troutmask.apl.washington.edu> wrote:
> 
> Why was this committed?
> 
> commit ac76bc1145dd7f4476e5d982ce8f355f71015713
> Author: Dimitry Andric <d...@freebsd.org>
> Date:   Tue Feb 9 22:06:51 2021 +0100
> 
>    Fix lib/msun's ctrig_test/test_inf_inputs test case with clang >= 10
> 
>    This sprinkles a few strategic volatiles in an attempt to defeat clang's
>    optimization interfering with the expected floating-point exception
>    flags.
> 
> There is nothing, and I mean, nothing strategic about "sprinkling"
> volatile onto the declaration of "float x, y, h;"  These variables
> are referenced in all floating pointing operations in the file,
> which means that there are needless reloading of x, y, and h
> from memory.

There was more context in https://bugs.freebsd.org/244732, but the gist
was that with clang >= 10, ctanh() and ctanhf() had FE_INVALID set after
calling them with {inf,inf}. The reasons for this were obscure to me at
the time, since it regressed with an llvm commit that seemed to have
very little to do with floating point.

However, in 3b00222f156d we added -fp-exception-behavior=maytrap to
clang's compile flags for lib/msun, for https://bugs.freebsd.org/254911,
to force it to use stricter floating point semantics. This turns out to
also make the admittedly ugly volatile fixes unnecessary.

So I have reverted ac76bc1145dd (minus the ctrig_test.c part) in:
https://cgit.freebsd.org/src/commit/?id=e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb

-Dimitry

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to