[PATCH] gimple-range-op: Improve handling of sqrt ranges
Mikael Morin
morin-mikael@orange.fr
Fri May 5 11:38:48 GMT 2023
Hello,
Le 05/05/2023 à 10:00, Jakub Jelinek via Gcc-patches a écrit :
> Hi!
>
> The previous patch just added basic intrinsic ranges for sqrt
> ([-0.0, +Inf] +-NAN being the general result range of the function
> and [-0.0, +Inf] the general operand range if result isn't NAN etc.),
> the following patch intersects those ranges with particular range
> computed from argument or result's exact range with the expected
> error in ulps taken into account and adds a function (frange_arithmetic
> variant) which can be used by other functions as well as helper.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
I think there is something wrong with the handling of NAN and lower
bounds in op1_range. If the lhs has positive lower bound and can be
nan, op1 should have -inf lower bound regardless of lhs's lower bound value.
Maybe it would be less error prone to combine the ordered range part
(r2) and the unordered one (r) with union instead of intersection?
The rest looks good. There is the case of slightly negative lhs bounds
coming (through ulps) from slightly positive op1 that could get better
than infinite bounds for op1 range, but at least it is conservatively
correct, and I'm not sure it's that important anyway.
Mikael
More information about the Gcc-patches
mailing list