range-op-float: Extend lhs by 0.5ulp rather than 1ulp if not -frounding-math [PR109008]
authorJakub Jelinek <jakub@redhat.com>
Fri, 10 Mar 2023 11:40:23 +0000 (12:40 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 10 Mar 2023 11:40:23 +0000 (12:40 +0100)
commit44f80a370b76fd1564e280f08d6640d0f641d487
tree7a17b91249f3829a383ee17dfc168513ba6a58ba
parent37c8a083d44f8123ad81a3cd411389b0b7b42ae6
range-op-float: Extend lhs by 0.5ulp rather than 1ulp if not -frounding-math [PR109008]

This patch, incremental to the just posted one, improves the reverse
operation ranges significantly by widening just by 0.5ulp in each
direction rather than 1ulp.  Again, REAL_VALUE_TYPE has both wider
exponent range and wider mantissa precision (160 bits) than any
supported type, this patch uses the latter property.

The patch doesn't do it if -frounding-math, because then the rounding
can be +-1ulp in each direction depending on the rounding mode which
we don't know, or for IBM double double because that type is just weird
and we can't trust in sane properties.

I've performed testing of these 2 patches on 300000 random tests as with
yesterday's patch, exact numbers are in the PR, but I see very significant
improvement in the precision of the ranges while keeping it conservatively
correct.

2023-03-10  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109008
* range-op-float.cc (float_widen_lhs_range): If not
-frounding-math and not IBM double double format, extend lhs
range just by 0.5ulp rather than 1ulp in each direction.
gcc/range-op-float.cc