diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-11-12 09:36:59 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-11-12 09:40:48 +0100 |
commit | 5747470efa8ff0ac82bb5f53d737b29a44f18118 (patch) | |
tree | deda4419d16ed0b672b023d354e760e21556501c /gcc/ginclude/stdint-gcc.h | |
parent | 2d5c4a16dd833aa083f13dd3e78e3ef38afe6ebb (diff) | |
download | gcc-5747470efa8ff0ac82bb5f53d737b29a44f18118.zip gcc-5747470efa8ff0ac82bb5f53d737b29a44f18118.tar.gz gcc-5747470efa8ff0ac82bb5f53d737b29a44f18118.tar.bz2 |
range-op: Cleanup floating point multiplication and division fold_range [PR107569]
Admittedly there are many similar spots with the foperator_div case
(but also with significant differences), so perhaps if foperator_{mult,div}
inherit from some derived class from range_operator_float and that class
would define various smaller helper static? methods, like this
discussed in the PR - contains_zero_p, singleton_nan_p, zero_p,
that
+ bool must_have_signbit_zero = false;
+ bool must_have_signbit_nonzero = false;
+ if (real_isneg (&lh_lb) == real_isneg (&lh_ub)
+ && real_isneg (&rh_lb) == real_isneg (&rh_ub))
+ {
+ if (real_isneg (&lh_lb) == real_isneg (&rh_ub))
+ must_have_signbit_zero = true;
+ else
+ must_have_signbit_nonzero = true;
+ }
returned as -1/0/1 int, and those set result (based on the above value) to
[+INF, +INF], [-INF, -INF] or [-INF, +INF]
or
[+0, +0], [-0, -0] or [-0, +0]
or
[+0, +INF], [-INF, -0] or [-INF, +INF]
and the
+ for (int i = 1; i < 4; ++i)
+ {
+ if (real_less (&cp[i], &cp[0])
+ || (real_iszero (&cp[0]) && real_isnegzero (&cp[i])))
+ std::swap (cp[i], cp[0]);
+ if (real_less (&cp[4], &cp[i + 4])
+ || (real_isnegzero (&cp[4]) && real_iszero (&cp[i + 4])))
+ std::swap (cp[i + 4], cp[4]);
+ }
block, it could be smaller and more readable.
2022-11-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/107569
* range-op-float.cc (zero_p, contains_p, singleton_inf_p,
signbit_known_p, zero_range, inf_range, zero_to_inf_range): New
functions.
(foperator_mult_div_base): New class.
(foperator_mult, foperator_div): Derive from that and use
protected static method from it as well as above new functions
to simplify the code.
Diffstat (limited to 'gcc/ginclude/stdint-gcc.h')
0 files changed, 0 insertions, 0 deletions