This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Thu, 16 Mar 2017, Jeff Law wrote:
On 03/16/2017 06:54 AM, Trevor Saunders wrote:The equivalences you derive here must hold for both objects. So without additional range information you can't really determine anything about (a | b) > 0.+ if (TREE_CODE (op0) == SSA_NAME && integer_zerop (op1)) + { + enum tree_code code = eq->cond.ops.binary.op; + if ((code == EQ_EXPR && eq->value == boolean_true_node) + || (code == NE_EXPR && eq->value == boolean_false_node)) + derive_equivalencs_from_bit_ior (op0, const_and_copies); + + /* TODO: We could handle BIT_AND_EXPR in a similar fashion + recording that the operands have a nonzero value. */ ++ /* TODO: We can handle more cases here, particularly when OP0 is+ known to have a boolean range. */I don't think its necessarily useful to put a list here of all possible improvements, but we could also handle things like if ((a | b) </> 0) since those imply !=.
I didn't follow the discussion so I am probably completely off, but (a|b)>=0 is equivalent to (a>=0)&(b>=0) since it just tests for the sign bit (surprisingly we seem to generate different code for the 2 versions).
-- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |