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.
This commit is contained in:
Aldy Hernandez 2021-07-26 06:08:24 -05:00
parent 3cb72ac171
commit f384e2f551

View file

@ -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
@ -3134,6 +3139,34 @@ operator_bitwise_xor::wi_fold (irange &r, tree type,
r.set_varying (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,