Skip to content

Commit

Permalink
xform_expr_infer: support negation of conditional expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
maximumspatium committed Dec 30, 2017
1 parent 1030abe commit 129ecee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xform_expr_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ def uni(ex, pat):
lambda W: EXPR(W["rel_op"], W["x1"], expr_neg(W["x2"]))
))

RULES.append((
EXPR("!", EXPR(V("rel_op"), V("x1"), V("x2"))),
lambda W: W["rel_op"] in ("==", "!=", "<", "<=", ">=", ">"),
lambda W: EXPR(COND.NEG[W["rel_op"]], W["x1"], W["x2"])
))


def simplify(ex):
for r in RULES:
Expand Down

0 comments on commit 129ecee

Please sign in to comment.