diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2021-07-26 06:08:24 -0500 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2021-07-26 16:49:14 +0200 |
commit | f384e2f551fef6dd73b815675633814fb8ff1e13 (patch) | |
tree | 37a6a60044f7f496a988d1c4eb58f2cf0de709df /gcc | |
parent | 3cb72ac17181fd38384cd2149993e643fb8df89f (diff) | |
download | gcc-f384e2f551fef6dd73b815675633814fb8ff1e13.zip gcc-f384e2f551fef6dd73b815675633814fb8ff1e13.tar.gz gcc-f384e2f551fef6dd73b815675633814fb8ff1e13.tar.bz2 |
Implement operator_bitwise_xor::op1_op2_relation_effect.
This patch adjusts XORing of ranges where the operands are known to be
equal or not equal.
We should probably do the same thing for the op[12]_range methods.
gcc/ChangeLog:
* range-op.cc (operator_bitwise_xor::op1_op2_relation_effect):
New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/range-op.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 4bdd14d..b1fb25c 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -3101,6 +3101,11 @@ public: const irange &lhs, const irange &op1, relation_kind rel = VREL_NONE) const; + virtual bool op1_op2_relation_effect (irange &lhs_range, + tree type, + const irange &op1_range, + const irange &op2_range, + relation_kind rel) const; } op_bitwise_xor; void @@ -3135,6 +3140,34 @@ operator_bitwise_xor::wi_fold (irange &r, tree type, } bool +operator_bitwise_xor::op1_op2_relation_effect (irange &lhs_range, + tree type, + const irange &, + const irange &, + relation_kind rel) const +{ + if (rel == VREL_NONE) + return false; + + int_range<2> rel_range; + + switch (rel) + { + case EQ_EXPR: + rel_range.set_zero (type); + break; + case NE_EXPR: + rel_range.set_nonzero (type); + break; + default: + return false; + } + + lhs_range.intersect (rel_range); + return true; +} + +bool operator_bitwise_xor::op1_range (irange &r, tree type, const irange &lhs, const irange &op2, |