diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-10-13 08:08:26 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-10-13 14:16:05 +0200 |
commit | 5364b425934436b9ba52bd95ed8a8a19ce7af207 (patch) | |
tree | d3a5dda87a1a6ab4d63007f29604b7a85a2f6547 | |
parent | 786e4c024f941671a233f5779d73a5d22f4e9588 (diff) | |
download | gcc-5364b425934436b9ba52bd95ed8a8a19ce7af207.zip gcc-5364b425934436b9ba52bd95ed8a8a19ce7af207.tar.gz gcc-5364b425934436b9ba52bd95ed8a8a19ce7af207.tar.bz2 |
Add op1_op2_relation for float operands.
op1_op2_relation can be called for relops (bool = a < b) as well as
regular binary operators (z = a + b). This patch adds the overloaded
method for floating point results.
gcc/ChangeLog:
* range-op-float.cc (range_operator_float::op1_op2_relation): New.
(class foperator_equal): Add using.
(class foperator_not_equal): Same.
(class foperator_lt): Same.
(class foperator_le): Same.
(class foperator_gt): Same.
(class foperator_ge): Same.
* range-op.cc (range_op_handler::op1_op2_relation): New.
* range-op.h (range_operator_float::op1_op2_relation): New.
-rw-r--r-- | gcc/range-op-float.cc | 12 | ||||
-rw-r--r-- | gcc/range-op.cc | 4 | ||||
-rw-r--r-- | gcc/range-op.h | 1 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 229b9d2..23e0f5e 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -160,6 +160,12 @@ range_operator_float::op1_op2_relation (const irange &lhs ATTRIBUTE_UNUSED) cons return VREL_VARYING; } +relation_kind +range_operator_float::op1_op2_relation (const frange &lhs ATTRIBUTE_UNUSED) const +{ + return VREL_VARYING; +} + // Return TRUE if OP1 is known to be free of NANs. static inline bool @@ -338,6 +344,7 @@ class foperator_equal : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -444,6 +451,7 @@ class foperator_not_equal : public range_operator_float { using range_operator_float::fold_range; using range_operator_float::op1_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -545,6 +553,7 @@ class foperator_lt : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -660,6 +669,7 @@ class foperator_le : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -767,6 +777,7 @@ class foperator_gt : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -882,6 +893,7 @@ class foperator_ge : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 16fa1f4..f8255dd 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -4476,7 +4476,9 @@ range_op_handler::op1_op2_relation (const vrange &lhs) const gcc_checking_assert (m_valid); if (m_int) return m_int->op1_op2_relation (as_a <irange> (lhs)); - return m_float->op1_op2_relation (as_a <irange> (lhs)); + if (is_a <irange> (lhs)) + return m_float->op1_op2_relation (as_a <irange> (lhs)); + return m_float->op1_op2_relation (as_a <frange> (lhs)); } // Cast the range in R to TYPE. diff --git a/gcc/range-op.h b/gcc/range-op.h index b2f063a..48adcec 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -160,6 +160,7 @@ public: const frange &op2, relation_kind = VREL_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + virtual relation_kind op1_op2_relation (const frange &lhs) const; }; class range_op_handler |